Material-ui: Dialog is not open using wrapper component

Created on 24 Apr 2017  路  4Comments  路  Source: mui-org/material-ui

import React, { PropTypes } from 'react';
import Dialog from 'material-ui/Dialog';

    export default class simpleModal extends React.Component {

        constructor(props){
          super(props)
        }

        handlePrimaryButton = () => {
          this.props.router.push('/some/path');
        }

        render(){
          return(
              <Dialog
                actions={<RaisedButton
                  label="OK"
                  primary={true}
                  onTouchTap={this.handlePrimaryButton}
                />}
                modal={false}
                open={this.props.open}
              >
                {this.props.msg}
              </Dialog>
          )
        }
    }

I created a wrapper using material-ui Dialog component but I can't open it. In another component I have this in my render method:

<simpleModal open={this.state.openSimpleModal} />
I then change the state of openSimpleModal using this.setState({openSimpleModal: true})

I don't see the modal being open. Is there anything missing in my above code? I manage to use Dialog component of material-ui directly but not with a wrapper.

Note: No error in chrome console at all.

question

Most helpful comment

if you feel you're missing something if you installed the latest react version and it is not working, ensure your react-dom version matches up with the latest react version.
For example install react 16.4.0 and react-dom 16.4.0 . it worked for me

All 4 comments

Please submit support requests and questions to StackOverflow using the tag material-ui. StackOverflow is better suited for this kind of support. The issue tracker is for bug reports and feature discussions. See also our CONTRIBUTING guidelines.

if you feel you're missing something if you installed the latest react version and it is not working, ensure your react-dom version matches up with the latest react version.
For example install react 16.4.0 and react-dom 16.4.0 . it worked for me

Thanks @philsam . You saved my day!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

damianobarbati picture damianobarbati  路  55Comments

celiao picture celiao  路  54Comments

iceafish picture iceafish  路  62Comments

gndplayground picture gndplayground  路  54Comments

garygrubb picture garygrubb  路  57Comments