Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

theme or something not working #59

Open
eromoe opened this issue Sep 5, 2017 · 2 comments
Open

theme or something not working #59

eromoe opened this issue Sep 5, 2017 · 2 comments

Comments

@eromoe
Copy link

eromoe commented Sep 5, 2017

First, I don't know why I have to add

  static childContextTypes =
  {
      muiTheme: React.PropTypes.object
  }

  getChildContext()
  {
      return {
          muiTheme: getMuiTheme()
      }
  }

to

class TagTable extends Component {

  render() {

    const {data} = this.props;

    return (
      <MuiThemeProvider>
        <DataTables
          height={'auto'}
          selectable={false}
          showRowHover={true}
          showHeaderToolbar={true}
          showFooterToolbar={true}
          columns={TABLE_COLUMNS}
          data={data}
          showCheckboxes={false}
          onCellClick={this.handleCellClick}
          onCellDoubleClick={this.handleCellDoubleClick}
          onFilterValueChange={this.handleFilterValueChange}
          onSortOrderChange={this.handleSortOrderChange}
          page={1}
          count={100}
        />
      </MuiThemeProvider>
    );
  }
}

Or it would complain

Uncaught TypeError: Cannot read property 'baseTheme' of undefined
    at getStyles (DataTables.js?7f0e:96)
    at DataTables.render (DataTables.js?7f0e:298)
    at eval (ReactCompositeComponent.js:795)
    at measureLifeCyclePerf (ReactCompositeComponent.js:75)
    at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (

Even if I add theme, can not work well :
once click a button, the button would be masked by a gray layer.

image

@hyojin
Copy link
Owner

hyojin commented Sep 7, 2017

@eromoe I'm not sure where you defined the code related to theme (like, getMuiTheme() function). How about to pass theme as a prop?

http://www.material-ui.com/#/customization/themes

@coding2012
Copy link

@hyojin Thanks that fixed my issue - I was getting the same exact error.
Added this to my app.tsx:
import lightBaseTheme from 'material-ui/styles/baseThemes/lightBaseTheme';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import getMuiTheme from 'material-ui/styles/getMuiTheme';

And this is just inside my router element:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants