Change App Background Color In React Native


Answer :

I've solved my problem, it was caused by StackNavigator. To solve it , just add some extra options

    const HomeStack = StackNavigator(   {     Home: {       screen: HomeScreen,     },     Item: {       screen: ItemScreen,       navigationOptions: ({ navigation }) => ({         title: `${navigation.state.params.title}`,       }),     },   },   **   {     headerMode: 'screen',     cardStyle: { backgroundColor: '#FFFFFF' },   },   ** ); 

For React Navigation 5 and above

<Stack.Navigator     initialRouteName='dashboard'     screenOptions={{         headerStyle: { elevation: 0 },         cardStyle: { backgroundColor: '#fff' }     }} >     <Stack.Screen name="Home" component={HomeStack} /> </Stack.Navigator> 

For React Navigation 4 and earlier

const HomeStack = StackNavigator( {     Home: {         screen: HomeScreen,     }, }, {     headerMode: 'screen',     cardStyle: { backgroundColor: '#fff' }, }, ); 

Edit your View tag like this,

  <View style={{flex: 1,backgroundColor: '#6ED4C8'}}></View> 

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?