2

i'm using meteor react-packages and i have the appbar displayed properly, but i can't get the nav toggle to work. i'm using code straight out of examples and i even read the code in the material-ui repo and it's seems like it should be working. what am i doing wrong?

let {AppBar, LeftNav} = mui

AppLayout = React.createClass({
  menuItems: [
    {route: '/profile/bio', text: 'bio'},
    {route: '/profile/photos', text: 'photos'},
    {route: '/profile/videos', text: 'videos'},
    {route: '/profile/filmography', text: 'filmography'},
    {route: '/profile/settings', text: 'settings'},
    {route: '/profile/accounts', text: 'accounts'}
  ],

  _toggle(e){
    e.preventDefault()
    this.refs.leftNav.toggle()
  },

  render(){
    return (
      <div>
        <AppBar onLeftIconButtonTouchTap={this._toggle} title='react+meteor'  />
        <LeftNav ref="leftNav" docked={false} menuItems={this.menuItems} />
        <AppView />
      </div>
   )
  }
})
4

1 回答 1

5

所以按照这里的指南:http ://react-in-meteor.readthedocs.org/en/latest/client-npm/

我在这里错过了 mui 指南的一部分:http: //material-ui.com/#/get-started

这是我的lib/app.browserify.js文件:

// material ui
mui = require('material-ui')
injectTapEventPlugin = require("react-tap-event-plugin")
// Needed for onTouchTap
// Can go away when react 1.0 release
// Check this repo:
// https://github.com/zilverline/react-tap-event-plugin
injectTapEventPlugin()

// this is needed for material-ui styling to work properly
ThemeManager = new mui.Styles.ThemeManager()
React.initializeTouchEvents(true)

我错过了injectTapEventPlugin()实际进行注射的这条线!在我添加并刷新浏览器后,菜单完美运行。

于 2015-07-09T00:13:09.923 回答