-
-
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.
Merge branch 'main' into @kkafar/native-native-animtions-for-ios-nati…
…ve-native
- Loading branch information
Showing
28 changed files
with
524 additions
and
227 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
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,87 @@ | ||
import React from 'react'; | ||
import { NavigationContainer } from '@react-navigation/native'; | ||
import { View, StyleSheet, Button } from 'react-native'; | ||
import { GestureHandlerRootView } from 'react-native-gesture-handler'; | ||
import { | ||
NativeStackNavigationProp, | ||
createNativeStackNavigator, | ||
} from 'react-native-screens/native-stack' | ||
import { GestureDetectorProvider } from 'react-native-screens/gesture-handler'; | ||
|
||
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>(); | ||
|
||
const App = (): JSX.Element => ( | ||
<GestureHandlerRootView style={{ flex: 1 }}> | ||
<NavigationContainer> | ||
<GestureDetectorProvider> | ||
<Stack.Navigator | ||
screenOptions={{ | ||
headerBackVisible: false, | ||
animation: 'none', | ||
}}> | ||
<Stack.Screen name="ScreenA" component={MainScreen} /> | ||
<Stack.Screen | ||
name="ScreenB" | ||
component={ScreenB} | ||
options={{ | ||
goBackGesture: 'twoDimensionalSwipe', | ||
}} | ||
/> | ||
<Stack.Screen name="ScreenC" component={ScreenC} /> | ||
</Stack.Navigator> | ||
</GestureDetectorProvider> | ||
</NavigationContainer> | ||
</GestureHandlerRootView> | ||
); | ||
|
||
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
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
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 |
---|---|---|
@@ -1,34 +1,22 @@ | ||
let supportsCodegenConfig = false; | ||
try { | ||
const rnCliAndroidVersion = | ||
require('@react-native-community/cli-platform-android/package.json').version; | ||
const [major] = rnCliAndroidVersion.split('.'); | ||
supportsCodegenConfig = major >= 9; | ||
} catch (e) { | ||
// ignore | ||
} | ||
|
||
module.exports = { | ||
dependency: { | ||
platforms: { | ||
android: supportsCodegenConfig | ||
? { | ||
componentDescriptors: [ | ||
"RNSFullWindowOverlayComponentDescriptor", | ||
"RNSScreenContainerComponentDescriptor", | ||
"RNSScreenNavigationContainerComponentDescriptor", | ||
"RNSScreenStackHeaderConfigComponentDescriptor", | ||
"RNSScreenStackHeaderSubviewComponentDescriptor", | ||
"RNSScreenStackComponentDescriptor", | ||
"RNSSearchBarComponentDescriptor", | ||
'RNSScreenComponentDescriptor', | ||
"RNSScreenFooterComponentDescriptor", | ||
"RNSScreenContentWrapperComponentDescriptor", | ||
'RNSModalScreenComponentDescriptor' | ||
], | ||
cmakeListsPath: "../android/src/main/jni/CMakeLists.txt" | ||
} | ||
: {}, | ||
android: { | ||
componentDescriptors: [ | ||
"RNSFullWindowOverlayComponentDescriptor", | ||
"RNSScreenContainerComponentDescriptor", | ||
"RNSScreenNavigationContainerComponentDescriptor", | ||
"RNSScreenStackHeaderConfigComponentDescriptor", | ||
"RNSScreenStackHeaderSubviewComponentDescriptor", | ||
"RNSScreenStackComponentDescriptor", | ||
"RNSSearchBarComponentDescriptor", | ||
'RNSScreenComponentDescriptor', | ||
"RNSScreenFooterComponentDescriptor", | ||
"RNSScreenContentWrapperComponentDescriptor", | ||
'RNSModalScreenComponentDescriptor' | ||
], | ||
cmakeListsPath: "../android/src/main/jni/CMakeLists.txt" | ||
}, | ||
}, | ||
}, | ||
}; |
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.