react-toolbox / react-toolbox-themr

A tool to statically extract and generate custom themes for React Toolbox
MIT License
240 stars 24 forks source link

Cannot read property 'label' of undefined - template is undefined #37

Open joni7777 opened 7 years ago

joni7777 commented 7 years ago

After following the instructions in the README (setting up ThemeProvider), this throws the exception (

Cannot read property 'label' of undefined

):

import React from 'react';
import ThemeProvider from 'react-toolbox/lib/ThemeProvider';
import {Input} from 'react-toolbox/lib/input/Input';

import  '../../../public/react-toolbox/theme.css'

import theme from '../../../public/react-toolbox/theme'

export default class Grow extends React.Component {
    render() {
        return <ThemeProvider theme={theme}>
            <div className="grow-container">
                <Input className="grow-input" type='text' label='Contacts' name='name'/>
            </div>
        </ThemeProvider>
    }
}

and this doesnt throw the expection but no style:

import React from 'react';
import ThemeProvider from 'react-toolbox/lib/ThemeProvider';
import {Input} from 'react-toolbox/lib/input/Input';

import  '../../../public/react-toolbox/theme.css'

import theme from '../../../public/react-toolbox/theme'

export default class Grow extends React.Component {
    render() {
        return <ThemeProvider theme={theme}>
            <div className="grow-container">
                <Input theme={theme} className="grow-input" type='text' label='Contacts' name='name'/>
            </div>
        </ThemeProvider>
    }
}

package.json:

{
  "name": "react-grow",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "lodash": "^4.17.4",
    "open-sans-fontface": "^1.4.0",
    "react": "^15.4.2",
    "react-dom": "^15.4.2",
    "react-number-format": "^1.1.2",
    "react-router-dom": "^4.0.0",
    "react-tap-event-plugin": "^2.0.1"
  },
  "devDependencies": {
    "react-scripts": "0.9.5",
    "react-toolbox": "2.0.0-beta.6",
    "react-toolbox-themr": "^1.0.2"
  },
  "reactToolbox": {
    "include": [
      "AUTOCOMPLETE",
      "AVATAR",
      "BUTTON",
      "CARD",
      "CHECKBOX",
      "CHIP",
      "DATE_PICKER",
      "DIALOG",
      "DRAWER",
      "DROPDOWN",
      "INPUT",
      "LAYOUT",
      "LINK",
      "LIST",
      "MENU",
      "NAVIGATION",
      "OVERLAY",
      "PROGRESS_BAR",
      "RADIO",
      "RIPPLE",
      "SLIDER",
      "SNACKBAR",
      "SWITCH",
      "TABLE",
      "TABS",
      "TIME_PICKER",
      "TOOLTIP"
    ],
    "output": "public/react-toolbox"
  },
  "scripts": {
    "start": "npm run toolbox && react-scripts start",
    "build": "npm run toolbox && react-scripts build",
    "toolbox": "react-toolbox-themr"
  },
  "eslintConfig": {
    "extends": "react-app"
  }
}

anyone have any idea why?

burtontanner commented 7 years ago

I have the same problem

ejames17 commented 5 years ago

any progress on this? I have the same problem