简体   繁体   中英

Styling issue after upgrading React-Native

I recently upgraded my React Native from 0.15 to 0.18

Now when I run the app, it give the following error.

Invalid prop `backgroundColor` supplied to `StyleSheet mainContainer`.
StyleSheet mainContainer: {
  "justifyContent": "center",
  "alignItems": "center",
  "flexDirection": "row",
  "backgroundColor": "#fffffff",
  "marginBottom": -1
}

What is causing this?

The color you specified as background color is incorrect and does not exist. There is one f too many. Either you can change it to:

"backgroundColor": "#ffffff",

Or you can also specify the white background color like this:

"backgroundColor": "white",

Here is an overview of all the supported color formats in React Native. You can also find the list for named colors there. http://facebook.github.io/react-native/docs/colors.html

You have seven f characters in your background color rather than six - ie it is invalid.

Try "backgroundColor": "#ffffff"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM