-
-
Notifications
You must be signed in to change notification settings - Fork 518
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
fix(iOS): Crash while pushing n different screens at the same time #2249
Merged
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5a5f810
Add first approach of setting view controllers
tboba 2de7646
Add mountingTransactionDidMount method
tboba 7d1aa58
Add comma
tboba 51772cb
Merge branch 'main' into @tboba/fix-screen-traversing
tboba fb9e60f
Change code, according to code review
tboba 3d89cfd
Apply changes from code review
tboba 4aa7e16
Merge branch 'main' into @tboba/fix-screen-traversing
tboba 09bfe51
Filter mutations by tag, not component name & add nested stack to exa…
kkafar b9017e8
Add button to pop nested stack in example
kkafar a925830
Restore react-navigation to commit from main
kkafar 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 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,85 @@ | ||
import React from 'react'; | ||
import { View, StyleSheet } from 'react-native'; | ||
import { | ||
createNativeStackNavigator, | ||
NativeStackNavigationProp, | ||
} from '@react-navigation/native-stack'; | ||
import { Button } from '../shared'; | ||
import { NavigationContainer } from '@react-navigation/native'; | ||
|
||
type StackParamList = { | ||
Main: undefined; | ||
Detail: undefined; | ||
Detail2: undefined; | ||
}; | ||
|
||
interface MainScreenProps { | ||
navigation: NativeStackNavigationProp<StackParamList, 'Main'>; | ||
} | ||
|
||
const MainScreen = ({ navigation }: MainScreenProps): React.JSX.Element => ( | ||
<View style={{ ...styles.container, backgroundColor: 'moccasin' }}> | ||
<Button | ||
testID="simple-native-stack-go-to-detail" | ||
title="Go to detail" | ||
onPress={() => { | ||
navigation.navigate('Detail'); | ||
navigation.navigate('Detail2'); | ||
}} | ||
/> | ||
</View> | ||
); | ||
|
||
interface DetailScreenProps { | ||
navigation: NativeStackNavigationProp<StackParamList, 'Detail'>; | ||
} | ||
|
||
const DetailScreen = ({ navigation }: DetailScreenProps): React.JSX.Element => ( | ||
<View style={{ ...styles.container, backgroundColor: 'thistle' }}> | ||
<Button | ||
title="Go back" | ||
onPress={() => navigation.goBack()} | ||
testID="simple-native-stack-detail-go-back" | ||
/> | ||
</View> | ||
); | ||
|
||
const DetailScreen2 = ({ | ||
navigation, | ||
}: DetailScreenProps): React.JSX.Element => ( | ||
<View style={{ ...styles.container, backgroundColor: 'yellow' }}> | ||
<Button | ||
title="Go back" | ||
onPress={() => navigation.goBack()} | ||
testID="simple-native-stack-detail-go-back" | ||
/> | ||
</View> | ||
); | ||
|
||
const Stack = createNativeStackNavigator<StackParamList>(); | ||
|
||
const App = (): React.JSX.Element => ( | ||
<NavigationContainer> | ||
<Stack.Navigator | ||
screenOptions={{ | ||
headerBackVisible: false, | ||
}}> | ||
<Stack.Screen | ||
name="Main" | ||
component={MainScreen} | ||
options={{ title: 'Simple Native Stack' }} | ||
/> | ||
<Stack.Screen name="Detail" component={DetailScreen} /> | ||
<Stack.Screen name="Detail2" component={DetailScreen2} /> | ||
</Stack.Navigator> | ||
</NavigationContainer> | ||
); | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
paddingTop: 10, | ||
}, | ||
}); | ||
|
||
export default App; |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment isn't very helpful outside the scope of this PR since the deleted lines won't be visible. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just made it for the sake of questions like "why we cannot move this update method to the mount and unmount methods, if they're doing the same?" (especially, that removing this method won't be visible in git blame), but if you think this comment is unnecessary, I can remove it.