-
-
Notifications
You must be signed in to change notification settings - Fork 518
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove setting tintColor in ios14 (#748)
The change introduced in #552 brakes the behavior of headerRight (see Test748 without the change in native code) in iOS 14, and the bug, that #552 fixed, is not present anymore in iOS 14.
- Loading branch information
Showing
5 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react'; | ||
import {Button, ScrollView} from 'react-native'; | ||
import {NavigationContainer} from '@react-navigation/native'; | ||
import {createNativeStackNavigator} from 'react-native-screens/native-stack'; | ||
|
||
function HomeScreen({navigation}) { | ||
return ( | ||
<ScrollView contentContainerStyle={{flex: 1, alignItems: 'center', justifyContent: 'center'}}> | ||
<Button | ||
onPress={() => navigation.navigate('Details')} | ||
title="Go to Details" | ||
/> | ||
</ScrollView> | ||
); | ||
} | ||
|
||
function DetailsScreen() { | ||
return ( | ||
<ScrollView /> | ||
); | ||
} | ||
|
||
const RootStack = createNativeStackNavigator(); | ||
|
||
function RootStackScreen() { | ||
return ( | ||
<RootStack.Navigator | ||
screenOptions={{ | ||
backButtonImage: require('../assets/backButton.png'), | ||
headerBackTitleVisible: false, | ||
headerTintColor: 'red', | ||
}}> | ||
<RootStack.Screen name="Home" component={HomeScreen} options={{headerShown: false}}/> | ||
<RootStack.Screen | ||
name="Details" | ||
component={DetailsScreen} | ||
/> | ||
</RootStack.Navigator> | ||
); | ||
} | ||
|
||
export default function App() { | ||
return ( | ||
<NavigationContainer> | ||
<RootStackScreen /> | ||
</NavigationContainer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react'; | ||
import {Button, ScrollView, View} from 'react-native'; | ||
import {NavigationContainer, NavigationProp, ParamListBase} from '@react-navigation/native'; | ||
import {createNativeStackNavigator} from 'react-native-screens/native-stack'; | ||
|
||
function HomeScreen({navigation}: {navigation: NavigationProp<ParamListBase>}) { | ||
return ( | ||
<Button | ||
onPress={() => { | ||
navigation.navigate('Details'); | ||
}} | ||
title="Go to details" | ||
/> | ||
); | ||
} | ||
|
||
function DetailsScreen({navigation}: {navigation: NavigationProp<ParamListBase>}) { | ||
|
||
const [visible, setVisible] = React.useState(true); | ||
|
||
return ( | ||
<ScrollView> | ||
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}> | ||
<Button | ||
onPress={() => { | ||
navigation.setOptions({headerRight: visible ? () => <View style={{width: 40, height: 40, backgroundColor: 'red'}} /> : () => null}) | ||
setVisible(!visible); | ||
}} | ||
title="Swap headerRight" | ||
/> | ||
</View> | ||
</ScrollView> | ||
); | ||
} | ||
|
||
const RootStack = createNativeStackNavigator(); | ||
|
||
function RootStackScreen() { | ||
return ( | ||
<RootStack.Navigator> | ||
<RootStack.Screen name="Home" component={HomeScreen}/> | ||
<RootStack.Screen name="Details" component={DetailsScreen} /> | ||
</RootStack.Navigator> | ||
); | ||
} | ||
|
||
export default function App(): JSX.Element { | ||
return ( | ||
<NavigationContainer> | ||
<RootStackScreen /> | ||
</NavigationContainer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters