-
-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
126 additions
and
34 deletions.
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
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
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,77 @@ | ||
import React from 'react'; | ||
import { View, StyleSheet, I18nManager } from 'react-native'; | ||
import { | ||
createNativeStackNavigator, | ||
NativeStackNavigationProp, | ||
} from 'react-native-screens/native-stack'; | ||
import { Button } from '../shared'; | ||
// import { ScreenTransition } from 'react-native-reanimated'; | ||
|
||
type StackParamList = { | ||
ScreenA: undefined; | ||
ScreenB: undefined; | ||
ScreenC: undefined; | ||
}; | ||
|
||
interface MainScreenProps { | ||
navigation: NativeStackNavigationProp<StackParamList, 'ScreenA'>; | ||
} | ||
|
||
const MainScreen = ({ navigation }: MainScreenProps): JSX.Element => ( | ||
<View style={{ ...styles.container, backgroundColor: 'moccasin' }}> | ||
<Button title="Go ScreenB" onPress={() => navigation.navigate('ScreenB')} /> | ||
<Button onPress={() => navigation.pop()} title="🔙 Back to Examples" /> | ||
</View> | ||
); | ||
|
||
interface ScreenBProps { | ||
navigation: NativeStackNavigationProp<StackParamList, 'ScreenB'>; | ||
} | ||
|
||
const ScreenB = ({ navigation }: ScreenBProps): JSX.Element => ( | ||
<View style={{ ...styles.container, backgroundColor: 'thistle' }}> | ||
<Button title="Go ScreenC" onPress={() => navigation.navigate('ScreenC')} /> | ||
<Button title="Go back" onPress={() => navigation.goBack()} /> | ||
</View> | ||
); | ||
|
||
interface ScreenCProps { | ||
navigation: NativeStackNavigationProp<StackParamList, 'ScreenC'>; | ||
} | ||
|
||
const ScreenC = ({ navigation }: ScreenCProps): JSX.Element => ( | ||
<View style={{ ...styles.container, backgroundColor: 'blue' }}> | ||
<Button title="Go back" onPress={() => navigation.goBack()} /> | ||
</View> | ||
); | ||
|
||
const Stack = createNativeStackNavigator<StackParamList>() as any; | ||
|
||
const App = (): JSX.Element => ( | ||
<Stack.Navigator | ||
screenOptions={{ | ||
headerHideBackButton: true, | ||
direction: I18nManager.isRTL ? 'rtl' : 'ltr', | ||
stackAnimation: 'none', | ||
goBackGesture: 'swipeRight', | ||
}}> | ||
<Stack.Screen name="ScreenA" component={MainScreen} /> | ||
<Stack.Screen | ||
name="ScreenB" | ||
component={ScreenB} | ||
options={{ | ||
goBackGesture: 'swipeLeft', | ||
}} | ||
/> | ||
<Stack.Screen name="ScreenC" component={ScreenC} options={{}} /> | ||
</Stack.Navigator> | ||
); | ||
|
||
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