From 47de378dca8bd9ea1489f716207cff63ef86965c Mon Sep 17 00:00:00 2001 From: Kacper Kafara Date: Wed, 6 Nov 2024 08:34:25 +0100 Subject: [PATCH 1/2] Change default value for fullScreenSwipeShadowEnabled to true --- guides/GUIDE_FOR_LIBRARY_AUTHORS.md | 4 ++-- ios/RNSScreen.mm | 1 + native-stack/README.md | 4 ++-- src/fabric/ModalScreenNativeComponent.ts | 2 +- src/fabric/ScreenNativeComponent.ts | 2 +- src/native-stack/types.tsx | 4 ++-- src/native-stack/views/NativeStackView.tsx | 2 +- src/types.tsx | 8 ++++---- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/guides/GUIDE_FOR_LIBRARY_AUTHORS.md b/guides/GUIDE_FOR_LIBRARY_AUTHORS.md index d4635f0283..3056cf935a 100644 --- a/guides/GUIDE_FOR_LIBRARY_AUTHORS.md +++ b/guides/GUIDE_FOR_LIBRARY_AUTHORS.md @@ -60,7 +60,7 @@ Boolean indicating whether the swipe gesture should work on whole screen. Swipin Boolean indicating whether the full screen dismiss gesture has shadow under view during transition. The gesture uses custom transition and thus doesn't have a shadow by default. When enabled, a custom shadow view is added during the transition which tries to mimic the -default iOS shadow. Defaults to `false`. +default iOS shadow. Defaults to `true`. ### `gestureEnabled` (iOS only) @@ -223,7 +223,7 @@ Allows for the customization of how the given screen should appear/disappear whe - `"fade"` – fades screen in or out - `fade_from_bottom` – performs a fade from bottom animation - `"flip"` – flips the screen, requires `stackPresentation: "modal"` (iOS only) -- `"simple_push"` – performs a default animation, but without shadow and native header transition (iOS only) +- `"simple_push"` – performs a default animation, but without native header transition (iOS only) - `"slide_from_bottom"` - slide in the new screen from bottom to top - `"slide_from_right"` - slide in the new screen from right to left (Android only, resolves to default transition on iOS) - `"slide_from_left"` - slide in the new screen from left to right diff --git a/ios/RNSScreen.mm b/ios/RNSScreen.mm index acc15a63cb..d834a98a96 100644 --- a/ios/RNSScreen.mm +++ b/ios/RNSScreen.mm @@ -119,6 +119,7 @@ - (void)initCommonProps _hasOrientationSet = NO; _hasHomeIndicatorHiddenSet = NO; _activityState = RNSActivityStateUndefined; + _fullScreenSwipeShadowEnabled = YES; #if !TARGET_OS_TV _sheetExpandsWhenScrolledToEdge = YES; #endif // !TARGET_OS_TV diff --git a/native-stack/README.md b/native-stack/README.md index b8ab002b25..4ebd61d325 100644 --- a/native-stack/README.md +++ b/native-stack/README.md @@ -96,7 +96,7 @@ Boolean indicating whether the swipe gesture should work on whole screen. Swipin Boolean indicating whether the full screen dismiss gesture has shadow under view during transition. The gesture uses custom transition and thus doesn't have a shadow by default. When enabled, a custom shadow view is added during the transition which tries to mimic the -default iOS shadow. Defaults to `false`. +default iOS shadow. Defaults to `true`. #### `gestureEnabled` (iOS only) @@ -325,7 +325,7 @@ How the given screen should appear/disappear when pushed or popped at the top of - `fade` - fades screen in or out. - `fade_from_bottom` – performs a fade from bottom animation - `flip` – flips the screen, requires stackPresentation: `modal` (iOS only) -- `simple_push` – performs a default animation, but without shadow and native header transition (iOS only) +- `simple_push` – performs a default animation, but without native header transition (iOS only) - `slide_from_bottom` – performs a slide from bottom animation - `slide_from_right` - slide in the new screen from right to left (Android only, resolves to default transition on iOS) - `slide_from_left` - slide in the new screen from left to right diff --git a/src/fabric/ModalScreenNativeComponent.ts b/src/fabric/ModalScreenNativeComponent.ts index 16cd62b5e4..6f968db091 100644 --- a/src/fabric/ModalScreenNativeComponent.ts +++ b/src/fabric/ModalScreenNativeComponent.ts @@ -86,7 +86,7 @@ export interface NativeProps extends ViewProps { sheetElevation?: WithDefault; customAnimationOnSwipe?: boolean; fullScreenSwipeEnabled?: boolean; - fullScreenSwipeShadowEnabled?: boolean; + fullScreenSwipeShadowEnabled?: WithDefault; homeIndicatorHidden?: boolean; preventNativeDismiss?: boolean; gestureEnabled?: WithDefault; diff --git a/src/fabric/ScreenNativeComponent.ts b/src/fabric/ScreenNativeComponent.ts index 1eb9071ac3..80832f2944 100644 --- a/src/fabric/ScreenNativeComponent.ts +++ b/src/fabric/ScreenNativeComponent.ts @@ -86,7 +86,7 @@ export interface NativeProps extends ViewProps { sheetElevation?: WithDefault; customAnimationOnSwipe?: boolean; fullScreenSwipeEnabled?: boolean; - fullScreenSwipeShadowEnabled?: boolean; + fullScreenSwipeShadowEnabled?: WithDefault; homeIndicatorHidden?: boolean; preventNativeDismiss?: boolean; gestureEnabled?: WithDefault; diff --git a/src/native-stack/types.tsx b/src/native-stack/types.tsx index da7a020a31..d0b5726570 100644 --- a/src/native-stack/types.tsx +++ b/src/native-stack/types.tsx @@ -164,7 +164,7 @@ export type NativeStackNavigationOptions = { /** * Whether the full screen dismiss gesture has shadow under view during transition. The gesture uses custom transition and thus * doesn't have a shadow by default. When enabled, a custom shadow view is added during the transition which tries to mimic the - * default iOS shadow. Defaults to `false`. + * default iOS shadow. Defaults to `true`. * * This does not affect the behavior of transitions that don't use gestures, enabled by `fullScreenGestureEnabled` prop. * @@ -456,7 +456,7 @@ export type NativeStackNavigationOptions = { * - "fade" – fades screen in or out * - "fade_from_bottom" – performs a fade from bottom animation * - "flip" – flips the screen, requires stackPresentation: "modal" (iOS only) - * - "simple_push" – performs a default animation, but without shadow and native header transition (iOS only) + * - "simple_push" – performs a default animation, but without native header transition (iOS only) * - "slide_from_bottom" – performs a slide from bottom animation * - "slide_from_right" - slide in the new screen from right to left (Android only, resolves to default transition on iOS) * - "slide_from_left" - slide in the new screen from left to right diff --git a/src/native-stack/views/NativeStackView.tsx b/src/native-stack/views/NativeStackView.tsx index 2276ec4e0b..b9f706734d 100644 --- a/src/native-stack/views/NativeStackView.tsx +++ b/src/native-stack/views/NativeStackView.tsx @@ -188,7 +188,7 @@ const RouteView = ({ const { options, render: renderScene } = descriptors[route.key]; const { - fullScreenSwipeShadowEnabled = false, + fullScreenSwipeShadowEnabled = true, gestureEnabled, headerShown, hideKeyboardOnSwipe, diff --git a/src/types.tsx b/src/types.tsx index ae5a9dc645..d4162c23bf 100644 --- a/src/types.tsx +++ b/src/types.tsx @@ -135,9 +135,9 @@ export interface ScreenProps extends ViewProps { */ fullScreenSwipeEnabled?: boolean; /** - * Whether the full screen dismiss gesture has shadow under view during transition. The gesture uses custom transition and thus - * doesn't have a shadow by default. When enabled, a custom shadow view is added during the transition which tries to mimic the - * default iOS shadow. Defaults to `false`. + * Whether the full screen dismiss gesture has shadow under view during transition. + * When enabled, a custom shadow view is added during the transition which tries to mimic the + * default iOS shadow. Defaults to `true`. * * This does not affect the behavior of transitions that don't use gestures, enabled by `fullScreenGestureEnabled` prop. * @@ -392,7 +392,7 @@ export interface ScreenProps extends ViewProps { * - "fade" – fades screen in or out * - "fade_from_bottom" – performs a fade from bottom animation * - "flip" – flips the screen, requires stackPresentation: "modal" (iOS only) - * - "simple_push" – performs a default animation, but without shadow and native header transition (iOS only) + * - "simple_push" – performs a default animation, but without native header transition (iOS only) * - `slide_from_bottom` – performs a slide from bottom animation * - "slide_from_right" - slide in the new screen from right to left (Android only, resolves to default transition on iOS) * - "slide_from_left" - slide in the new screen from left to right From 6037f123d726f80527098a29c226236be5268b90 Mon Sep 17 00:00:00 2001 From: Kacper Kafara Date: Wed, 6 Nov 2024 08:49:25 +0100 Subject: [PATCH 2/2] Update Android interfaces --- .../facebook/react/viewmanagers/RNSScreenManagerDelegate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java b/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java index d73de5dda3..884a93ad49 100644 --- a/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java +++ b/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java @@ -52,7 +52,7 @@ public void setProperty(T view, String propName, @Nullable Object value) { mViewManager.setFullScreenSwipeEnabled(view, value == null ? false : (boolean) value); break; case "fullScreenSwipeShadowEnabled": - mViewManager.setFullScreenSwipeShadowEnabled(view, value == null ? false : (boolean) value); + mViewManager.setFullScreenSwipeShadowEnabled(view, value == null ? true : (boolean) value); break; case "homeIndicatorHidden": mViewManager.setHomeIndicatorHidden(view, value == null ? false : (boolean) value);