Skip to content

Commit 990b009

Browse files
committed
Update documentation about modals
1 parent 4608ec7 commit 990b009

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

versioned_docs/version-6.x/modal.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sidebar_label: Opening a modal
88

99
A modal displays content that temporarily blocks interactions with the main view.
1010

11-
A modal is like a popup — it's not part of your primary navigation flow — it usually has a different transition, a different way to dismiss it, and is intended to focus on one particular piece of content or interaction.
11+
A modal is like a popup — it usually has a different transition animation, and is intended to focus on one particular interaction or piece of content.
1212

1313
## Creating a stack with modal screens
1414

@@ -67,4 +67,14 @@ Instead of specifying this option for a group, it's also possible to specify it
6767

6868
## Summary
6969

70-
- To change the type of transition on a stack navigator you can use the `presentation` option. When set to `modal`, all modal screens animate-in from bottom to top rather than right to left by default. This applies to that entire group, so to use non-modal transitions on other screens, we add another group with the default configuration.
70+
- To change the type of transition on a stack navigator you can use the `presentation` option.
71+
- When `presentation` is set to `modal`, the screens behave like a modal, i.e. they have a bottom to top transition and may show part of the previous screen in the background.
72+
- Setting `presentation: 'modal'` on a group makes all the screens in the group modals, so to use non-modal transitions on other screens, we add another group with the default configuration.
73+
74+
## Best practices
75+
76+
Since modals are intended to be on top of other content, there are a couple of things to keep in mind when using modals:
77+
78+
- Avoid nesting them inside other navigators like tab or drawer. Modal screens should be defined as part of the root stack.
79+
- Modal screens should be the last in the stack - avoid pushing regular screens on top of modals.
80+
- The first screen in a stack appears as a regular screen even if configured as a modal, since there is no screen before it to show behind. So always make sure that modal screens are pushed on top of a regular screen or another modal screen.

versioned_docs/version-7.x/modal.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sidebar_label: Opening a modal
88

99
A modal displays content that temporarily blocks interactions with the main view.
1010

11-
A modal is like a popup — it's not part of your primary navigation flow — it usually has a different transition, a different way to dismiss it, and is intended to focus on one particular piece of content or interaction.
11+
A modal is like a popup — it usually has a different transition animation, and is intended to focus on one particular interaction or piece of content.
1212

1313
## Creating a stack with modal screens
1414

@@ -67,4 +67,14 @@ Instead of specifying this option for a group, it's also possible to specify it
6767

6868
## Summary
6969

70-
- To change the type of transition on a stack navigator you can use the `presentation` option. When set to `modal`, all modal screens animate-in from bottom to top rather than right to left by default. This applies to that entire group, so to use non-modal transitions on other screens, we add another group with the default configuration.
70+
- To change the type of transition on a stack navigator you can use the `presentation` option.
71+
- When `presentation` is set to `modal`, the screens behave like a modal, i.e. they have a bottom to top transition and may show part of the previous screen in the background.
72+
- Setting `presentation: 'modal'` on a group makes all the screens in the group modals, so to use non-modal transitions on other screens, we add another group with the default configuration.
73+
74+
## Best practices
75+
76+
Since modals are intended to be on top of other content, there are a couple of things to keep in mind when using modals:
77+
78+
- Avoid nesting them inside other navigators like tab or drawer. Modal screens should be defined as part of the root stack.
79+
- Modal screens should be the last in the stack - avoid pushing regular screens on top of modals.
80+
- The first screen in a stack appears as a regular screen even if configured as a modal, since there is no screen before it to show behind. So always make sure that modal screens are pushed on top of a regular screen or another modal screen.

0 commit comments

Comments
 (0)