You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -95,11 +95,18 @@ You can also specify `{ backgroundColor: 'transparent' }` to make the previous s
95
95
96
96
This is shortcut option which configures several options to configure the style for rendering and transitions:
97
97
98
-
-`card` - Use the standard iOS and Android screen transitions. This is the default.
99
-
-`modal` - This does few things:
98
+
-`card`: Use the default OS animations for iOS and Android screen transitions.
99
+
-`modal`: Use Modal animations. This changes a few things:
100
100
- Sets `headerMode` to `screen` for the screen unless specified otherwise.
101
101
- Changes the screen animation to match the platform behavior for modals.
102
+
-`transparentModal`: Similar to `modal`. This changes following things:
103
+
- Sets `headerMode` to `screen` for the screen unless specified otherwise.
104
+
- Sets background color of the screen to transparent, so previous screen is visible
102
105
- Adjusts the `detachPreviousScreen` option so that the previous screen stays rendered.
106
+
- Prevents the previous screen from animating from its last position.
107
+
- Changes the screen animation to a vertical slide animation.
108
+
109
+
See [Transparent modals](#transparent-modals) for more details on how to customize `transparentModal`.
103
110
104
111
#### `animationEnabled`
105
112
@@ -761,43 +768,102 @@ import { TransitionPresets } from '@react-navigation/stack';
761
768
762
769
### Transparent modals
763
770
764
-
A transparent modal is like a modal dialog which overlays the screen. The previous screen still stays visible underneath. To get a transparent modal screen, it's usually easier to create a separate modal stack. In the modal stack, you will want to configure few things:
765
-
766
-
- Set the `presentation` prop to `modal` which sets `detachPreviousScreen` option to `false` for the last screen
767
-
- Set the card background to transparent using `cardStyle`
768
-
- Use a custom animation instead of the default platform animation (we'll use fade in this case)
769
-
- Disable the header with `headerShown: false` (optional)
770
-
- Enable the overlay with `cardOverlayEnabled: true` (optional)
771
+
A transparent modal is like a modal dialog which overlays the screen. The previous screen still stays visible underneath. To get a transparent modal screen, you can specify `presentation: 'transparentModal'` in the screen's options.
Now, when you navigate to the `Modal` screen, the `Home` screen will still be visible underneath.
786
+
Now, when you navigate to the `Modal` screen, it'll have a transparent background and the `Home` screen will be visible underneath.
787
+
788
+
In addition to `presentation`, you might want to optionally specify few more things to get a modal dialog like behavior:
789
+
790
+
- Disable the header with `headerShown: false`
791
+
- Enable the overlay with `cardOverlayEnabled: true` (you can't tap the overlay to close the screen this way, see below for alternatives)
792
+
793
+
If you want to further customize how the dialog animates, or want to close the screen when tapping the overlay etc., you can use the `useCardAnimation` hook to customize elements inside your screen.
0 commit comments