-
-
Notifications
You must be signed in to change notification settings - Fork 613
fix(iOS): Fix conditional rendering on Fabric #1978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4680b3c
Add tests
tboba d697786
Create preliminary solution with checking unmounted controller
tboba ab9528a
Change implementation of remounting recycled view
tboba 5441445
Make code prettier
tboba 1155a45
Rename TestX to Test1978
tboba cc1df06
Change the condition of checking screenChildComponent.controller.view
tboba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,90 @@ | ||
| import { NavigationContainer } from '@react-navigation/native'; | ||
| import { | ||
| createNativeStackNavigator, | ||
| NativeStackNavigationProp, | ||
| } from '@react-navigation/native-stack'; | ||
| import React, { useState } from 'react'; | ||
| import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; | ||
|
|
||
| type StackParamList = { | ||
| Home: undefined; | ||
| Home1: undefined; | ||
| Home2: undefined; | ||
| Home3: undefined; | ||
| }; | ||
|
|
||
| interface MainScreenProps { | ||
| navigation: NativeStackNavigationProp<StackParamList>; | ||
| } | ||
|
|
||
| const Home = ({ navigation }: MainScreenProps) => ( | ||
| <View style={styles.view}> | ||
| <Text onPress={() => navigation.navigate('Home1')}> | ||
| This is the initial View | ||
| </Text> | ||
| </View> | ||
| ); | ||
|
|
||
| const Home1 = () => ( | ||
| <View style={styles.view}> | ||
| <Text>This is View 1</Text> | ||
| </View> | ||
| ); | ||
|
|
||
| const Home2 = ({ navigation }: MainScreenProps) => ( | ||
| <View style={styles.view}> | ||
| <Text onPress={() => navigation.navigate('Home3')}>This is View 2</Text> | ||
| </View> | ||
| ); | ||
|
|
||
| const Home3 = () => ( | ||
| <View style={styles.view}> | ||
| <Text>This is View 3</Text> | ||
| </View> | ||
| ); | ||
|
|
||
| const Stack = createNativeStackNavigator(); | ||
|
|
||
| const Test1978 = () => { | ||
| const [hasChangedState, setHasChangedState] = useState(true); | ||
|
|
||
| return ( | ||
| <NavigationContainer> | ||
| <Stack.Navigator> | ||
| {hasChangedState ? ( | ||
| <> | ||
| <Stack.Screen name="Home" component={Home} /> | ||
| <Stack.Screen name="Home1" component={Home1} /> | ||
| </> | ||
| ) : ( | ||
| <> | ||
| <Stack.Screen name="Home2" component={Home2} /> | ||
| <Stack.Screen name="Home3" component={Home3} /> | ||
| </> | ||
| )} | ||
| </Stack.Navigator> | ||
| <TouchableOpacity | ||
| style={styles.button} | ||
| onPress={() => setHasChangedState(old => !old)}> | ||
| <Text>Change state</Text> | ||
| </TouchableOpacity> | ||
| </NavigationContainer> | ||
| ); | ||
| }; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| button: { | ||
| justifyContent: 'center', | ||
| alignItems: 'center', | ||
| height: 100, | ||
| }, | ||
| view: { | ||
| alignItems: 'center', | ||
| backgroundColor: '#b7c4bb', | ||
| flex: 1, | ||
| justifyContent: 'center', | ||
| padding: 12, | ||
| }, | ||
| }); | ||
|
|
||
| export default Test1978; |
This file contains hidden or 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
This file contains hidden or 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,90 @@ | ||
| import { NavigationContainer } from '@react-navigation/native'; | ||
| import { | ||
| createNativeStackNavigator, | ||
| NativeStackNavigationProp, | ||
| } from '@react-navigation/native-stack'; | ||
| import React, { useState } from 'react'; | ||
| import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; | ||
|
|
||
| type StackParamList = { | ||
| Home: undefined; | ||
| Home1: undefined; | ||
| Home2: undefined; | ||
| Home3: undefined; | ||
| }; | ||
|
|
||
| interface MainScreenProps { | ||
| navigation: NativeStackNavigationProp<StackParamList>; | ||
| } | ||
|
|
||
| const Home = ({ navigation }: MainScreenProps) => ( | ||
| <View style={styles.view}> | ||
| <Text onPress={() => navigation.navigate('Home1')}> | ||
| This is the initial View | ||
| </Text> | ||
| </View> | ||
| ); | ||
|
|
||
| const Home1 = () => ( | ||
| <View style={styles.view}> | ||
| <Text>This is View 1</Text> | ||
| </View> | ||
| ); | ||
|
|
||
| const Home2 = ({ navigation }: MainScreenProps) => ( | ||
| <View style={styles.view}> | ||
| <Text onPress={() => navigation.navigate('Home3')}>This is View 2</Text> | ||
| </View> | ||
| ); | ||
|
|
||
| const Home3 = () => ( | ||
| <View style={styles.view}> | ||
| <Text>This is View 3</Text> | ||
| </View> | ||
| ); | ||
|
|
||
| const Stack = createNativeStackNavigator(); | ||
|
|
||
| const Test1978 = () => { | ||
| const [hasChangedState, setHasChangedState] = useState(true); | ||
|
|
||
| return ( | ||
| <NavigationContainer> | ||
| <Stack.Navigator> | ||
| {hasChangedState ? ( | ||
| <> | ||
| <Stack.Screen name="Home" component={Home} /> | ||
| <Stack.Screen name="Home1" component={Home1} /> | ||
| </> | ||
| ) : ( | ||
| <> | ||
| <Stack.Screen name="Home2" component={Home2} /> | ||
| <Stack.Screen name="Home3" component={Home3} /> | ||
| </> | ||
| )} | ||
| </Stack.Navigator> | ||
| <TouchableOpacity | ||
| style={styles.button} | ||
| onPress={() => setHasChangedState(old => !old)}> | ||
| <Text>Change state</Text> | ||
| </TouchableOpacity> | ||
| </NavigationContainer> | ||
| ); | ||
| }; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| button: { | ||
| justifyContent: 'center', | ||
| alignItems: 'center', | ||
| height: 100, | ||
| }, | ||
| view: { | ||
| alignItems: 'center', | ||
| backgroundColor: '#b7c4bb', | ||
| flex: 1, | ||
| justifyContent: 'center', | ||
| padding: 12, | ||
| }, | ||
| }); | ||
|
|
||
| export default Test1978; |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.