React-native: Failed propType: Invalid props.style key 'color' supplied to [ 'View' | 'RCTView' ]

Created on 21 Mar 2017  路  4Comments  路  Source: facebook/react-native

Warning: Failed propType: Invalid props.style key 'color' supplied to [ 'View' | 'RCTView' ]

I used color property in react native app and it gives above error.

Reproduction

You can reproduce the issue

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    color:'white',
    justifyContent: 'center',
  },
});

Additional Information

  • React Native version: [0.43]
  • Platform: [Android]
  • Operating System: [MacOS]
  • Dev tools: [ Android SDK version using genymotion for emulator]
    screen shot 2017-03-21 at 10 00 55 am
Locked

Most helpful comment

You have to set the color style directly on a Text component for it to be white. Child components does not inherit style like on the web.

All 4 comments

backgroundColor

You have to set the color style directly on a Text component for it to be white. Child components does not inherit style like on the web.

What they said - set the color on the Text element. Be aware you're using a white background color on the View container, you'll probably want to use a different color for the text.

Thanks issue is resolved

Was this page helpful?
0 / 5 - 0 ratings