reactjs - Material ui dropdown and other controls doesnt work propertly -
i have issue material-ui lib, dropdowns , menu doesnt work.
my code following.
import react 'react'; import {toolbar, toolbargroup, toolbarseparator, toolbartitle} 'material-ui/toolbar'; import dropdownmenu 'material-ui/dropdownmenu'; import menuitem 'material-ui/menuitem'; import injecttapeventplugin 'react-tap-event-plugin'; class interruptions extends react.component { constructor(props) { super(props); this.state = { value: 1 }; injecttapeventplugin(); } handlechange(event, index, value) { this.setstate({value: value}); } render(){ return ( <div classname="interruptions__wrapper"> <toolbar> <toolbargroup firstchild={true}> <dropdownmenu value={this.state.value} openimmediately={true} onchange={this.handlechange}> <menuitem value={1} primarytext="all broadcasts" /> <menuitem value={2} primarytext="all voice" /> <menuitem value={3} primarytext="all text" /> <menuitem value={4} primarytext="complete voice" /> <menuitem value={5} primarytext="complete text" /> <menuitem value={6} primarytext="active voice" /> <menuitem value={7} primarytext="active text" /> </dropdownmenu> </toolbargroup> <toolbargroup> <toolbartitle text="options" /> </toolbargroup> </toolbar> </div> ); } } export default interruptions;
and main render app in html.
import react 'react'; import reactdom 'react-dom'; import interruptions '../components/interruptions.jsx'; import muithemeprovider 'material-ui/styles/muithemeprovider'; import getmuitheme 'material-ui/styles/getmuitheme'; import {red500} 'material-ui/styles/colors'; import darkbasetheme 'material-ui/styles/basethemes/darkbasetheme'; const muitheme = getmuitheme({ palette: { textcolor: red500, } }); const interruptionsapp = () => ( <muithemeprovider muitheme={getmuitheme(darkbasetheme)}> <interruptions /> </muithemeprovider> ) reactdom.render(<interruptionsapp />, document.getelementbyid('myinterruptions'));
im using openimmediately={true} see if atleast menu showing (and does) when try click on open again doesnt show.
thanks in advice.
@jeff mccloud right. should injecttapeventplugin() before first use render function react-dom.
don't know how build application webpack or browserify?
run in issue too. sure have declared react, react-dom, react-tap-event-plugin , react addons using external libs. building vendor.js instance.
approach prevents have multiple version of react in project produce kind of behavior.
Comments
Post a Comment