Nativebase: undefined is not an object (evaluating 'variables.platformStyle')

Created on 18 Apr 2017  路  5Comments  路  Source: GeekyAnts/NativeBase

On the following;

"native-base": "^2.1.2", "react": "16.0.0-alpha.6", "react-native": "^0.43.3",

Getting this error every time I use the <StyleProvider> tag. Thus not being able to style anything.

awaiting response can't reproduce

Most helpful comment

It worked after adding style into StyleProvider Tag:

import getTheme from '../native-base-theme/components'
import material from '../native-base-theme/variables/material'
...
<StyleProvider style={getTheme(material)}>
...
</StyleProvider>

All 5 comments

@kheide can you share the code snippet .It will be easy to debug .and help you

Got the same problem when I try to use Icon.

"native-base": "^2.1.2", "react": "16.0.0-alpha.6", "react-native": "^0.43.4"

It worked after adding style into StyleProvider Tag:

import getTheme from '../native-base-theme/components'
import material from '../native-base-theme/variables/material'
...
<StyleProvider style={getTheme(material)}>
...
</StyleProvider>

@kheide @l3lackcurtains Yes, if you are using <StyleProvider>, you do need to pass theme to it through style prop

Have the same issue specifically on "Header" component (other components works fine)

  import headerTheme from '../Themes/Header';
  ...
  <StyleProvider style={headerTheme()}>
  ...
Was this page helpful?
0 / 5 - 0 ratings