react native share context between two screens code example
Example 1: react native add two view
<View style={{flex: 1}}>
<View style={{height: 200, backgroundColor: 'grey'}}></View>
<View style={{flexGrow: 1, backgroundColor: 'black', alignItems: 'center'}}>
<Image
source={require('./icon.png')}
style={{
position: 'absolute',
top: -40,
height: 80,
width: 80}}
/>
</View>
</View>
Example 2: react native sharing common options across screens
function StackScreen() {
return (
<Stack.Navigator
screenOptions={{
headerStyle: {
backgroundColor: '#f4511e',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
}}
>
<Stack.Screen
name="Home"
component={HomeScreen}
options={{ title: 'My home' }}
/>
</Stack.Navigator>
);
}