Skip to content
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

feat(iOS)!: change default of fullScreenSwipeShadowEnabled to true #2481

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions guides/GUIDE_FOR_LIBRARY_AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions ios/RNSScreen.mm
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ - (void)initCommonProps
_hasOrientationSet = NO;
_hasHomeIndicatorHiddenSet = NO;
_activityState = RNSActivityStateUndefined;
_fullScreenSwipeShadowEnabled = YES;
#if !TARGET_OS_TV
_sheetExpandsWhenScrolledToEdge = YES;
#endif // !TARGET_OS_TV
Expand Down
4 changes: 2 additions & 2 deletions native-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/fabric/ModalScreenNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export interface NativeProps extends ViewProps {
sheetElevation?: WithDefault<Int32, 24>;
customAnimationOnSwipe?: boolean;
fullScreenSwipeEnabled?: boolean;
fullScreenSwipeShadowEnabled?: boolean;
fullScreenSwipeShadowEnabled?: WithDefault<boolean, true>;
homeIndicatorHidden?: boolean;
preventNativeDismiss?: boolean;
gestureEnabled?: WithDefault<boolean, true>;
Expand Down
2 changes: 1 addition & 1 deletion src/fabric/ScreenNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export interface NativeProps extends ViewProps {
sheetElevation?: WithDefault<Int32, 24>;
customAnimationOnSwipe?: boolean;
fullScreenSwipeEnabled?: boolean;
fullScreenSwipeShadowEnabled?: boolean;
fullScreenSwipeShadowEnabled?: WithDefault<boolean, true>;
homeIndicatorHidden?: boolean;
preventNativeDismiss?: boolean;
gestureEnabled?: WithDefault<boolean, true>;
Expand Down
4 changes: 2 additions & 2 deletions src/native-stack/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/native-stack/views/NativeStackView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
const { options, render: renderScene } = descriptors[route.key];

const {
fullScreenSwipeShadowEnabled = false,
fullScreenSwipeShadowEnabled = true,
gestureEnabled,
headerShown,
hideKeyboardOnSwipe,
Expand Down Expand Up @@ -309,7 +309,7 @@
screensRefs.current[route.key] = screenRef;
return () => {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete screensRefs.current[route.key];

Check warning on line 312 in src/native-stack/views/NativeStackView.tsx

View workflow job for this annotation

GitHub Actions / install-and-lint

The ref value 'screensRefs.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy 'screensRefs.current' to a variable inside the effect, and use that variable in the cleanup function
};
});

Expand Down
8 changes: 4 additions & 4 deletions src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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
Expand Down
Loading