Próbuję otworzyć pole Dialog
za pomocą kliknięcia przycisku. Kiedy jestem kliknięcie przycisku Dialog
przede wszystkim nie jest otwierany i otrzymuję błąd:Nie można odczytać właściwości 'prepareStyles' nieokreślonego
Uncaught TypeError: Cannot read property 'prepareStyles' of undefined.
Oto kod dla mojego składnika:
const muiThemebtn = getMuiTheme({
palette: {
alternateTextColor: darkBlack,
primary1Color: grey100,
}
})
export default class MyComponent extends React.Component {
constructor (props) {
super(props);
this.state = {open: true};
this.openModal = this.openModal.bind(this);
this.closeModal = this.closeModal.bind(this);
}
openModal=()=>{ this.setState({open: true}); }
closeModal=()=>{ this.setState({open: false}); }
render() {
const actions = [
<FlatButton
label="Cancel"
primary={true}
onTouchTap={this.handleClose}
/>,
<FlatButton
label="Submit"
primary={true}
keyboardFocused={true}
onTouchTap={this.handleClose}
/>,
];
return (
<div>
<MuiThemeProvider muiTheme={muiThemebtn}>
<RaisedButton label={Lang.AddUser}
onTouchTap={this.openModal}
primary={true}
display='none'
icon={<ContentAddBox color={darkBlack} style={{backgroundColor:'#e3e3e3'}}/>}
/>
</MuiThemeProvider>
<Dialog
title="Scrollable Dialog"
actions={actions}
modal={false}
open={this.state.open}
onRequestClose={this.handleClose}
autoScrollBodyContent={true}
>
Dialog Text
</Dialog>
</div>
);
}
}
Proszę zasugerować. Uwaga: muszę użyć MuiThemeProvider
miła propozycja, przepraszam, zapomniałem wspomnieć, że dodałem swoje sugestie w mojej odpowiedzi, +1 do tego, Teraz masz reputację do komentowania każdego posta :) –
Woot! dzięki :) –