From 66ca0f28463868ae3794657ad6aa69f0ca8d503e Mon Sep 17 00:00:00 2001 From: Krzysztof Piaskowy Date: Fri, 3 Nov 2023 12:26:45 +0100 Subject: [PATCH] Update example app --- Example/App.tsx | 25 ++++++- Example/ios/.xcode.env | 1 - Example/src/screens/SimpleNativeStack.tsx | 52 ++++++--------- Example/src/screens/SwipeBackAnimation.tsx | 77 ++++++++++++++++++++++ src/gesture-handler/GestureDetector.tsx | 3 + src/native-stack/types.tsx | 2 +- 6 files changed, 126 insertions(+), 34 deletions(-) create mode 100644 Example/src/screens/SwipeBackAnimation.tsx diff --git a/Example/App.tsx b/Example/App.tsx index acb64fb683..f53e19b350 100644 --- a/Example/App.tsx +++ b/Example/App.tsx @@ -15,6 +15,7 @@ import RNRestart from 'react-native-restart'; import { ListItem, SettingsSwitch } from './src/shared'; import SimpleNativeStack from './src/screens/SimpleNativeStack'; +import SwipeBackAnimation from './src/screens/SwipeBackAnimation'; import StackPresentation from './src/screens/StackPresentation'; import HeaderOptions from './src/screens/HeaderOptions'; import StatusBarExample from './src/screens/StatusBar'; @@ -49,6 +50,11 @@ const SCREENS: Record< component: SimpleNativeStack, type: 'example', }, + SwipeBackAnimation: { + title: 'Swipe Back Animation', + component: SwipeBackAnimation, + type: 'example', + }, StackPresentation: { title: 'Stack Presentation', component: StackPresentation, @@ -155,7 +161,24 @@ const ExampleApp = (): JSX.Element => ( - + + + {Object.keys(SCREENS).map(name => ( + SCREENS[name].component} + options={{ headerShown: false }} + /> + ))} + diff --git a/Example/ios/.xcode.env b/Example/ios/.xcode.env index 618e4c6fc5..b32032ca15 100644 --- a/Example/ios/.xcode.env +++ b/Example/ios/.xcode.env @@ -8,4 +8,3 @@ # For example, to use nvm with brew, add the following line # . "$(brew --prefix nvm)/nvm.sh" --no-use export NODE_BINARY=$(command -v node) -export NODE_BINARY=/opt/homebrew/opt/node@18/bin/node diff --git a/Example/src/screens/SimpleNativeStack.tsx b/Example/src/screens/SimpleNativeStack.tsx index c479b313fa..7b5ab78c22 100644 --- a/Example/src/screens/SimpleNativeStack.tsx +++ b/Example/src/screens/SimpleNativeStack.tsx @@ -5,65 +5,55 @@ import { 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; + Main: undefined; + Detail: undefined; }; interface MainScreenProps { - navigation: NativeStackNavigationProp; + navigation: NativeStackNavigationProp; } const MainScreen = ({ navigation }: MainScreenProps): JSX.Element => ( -