navigation header react native code example
Example 1: react native header style
function StackScreen() {
return (
<Stack.Navigator>
<Stack.Screen
name="Home"
component={HomeScreen}
options={{
title: 'My home',
headerStyle: {
backgroundColor: '#f4511e',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
}}
/>
</Stack.Navigator>
);
}
Example 2: react native navigation header Right
screenOptions={({route, navigation}) => ({ // transform screenOptions to a function
headerRight: () => (
<Button
onPress={() => navigation.navigate('Home');
/>
)
})}