score:2

Accepted answer

however, this renders without any of the maincontainer elements at all.

you need to use this.props.children

<lineargradient
  style={{ flex: 1 }}
  colors={[primary, primarygradient2, primarygradient1]}
  locations={locations}>
  //add this:
  {this.props.children}
</lineargradient>

it's a prop passed to all components using an opening and closing tag and contains whatever is between the opening and closing tags.

i'm not totally clear on exactly what you're trying to accomplish, but i suspect you would be best served by placing the <gradienttheme/> component at or near the root of your app, and managing the theme either locally in it's parent component state or with redux. in case you need it, here is a nice series of tutorials on using redux and react-navigation together in react-native.


Related Query

More Query from same tag