-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Document detachInactiveScreens #859
Conversation
Deploy preview for react-navigation-docs ready! Built with commit 5f035b0 https://deploy-preview-859--react-navigation-docs.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the PR to reflect the changes made in v5?
|
||
Boolean used to indicate whether inactive screens should be detached from the view hierarchy to save memory. Make sure to call `enableScreens` from [react-native-screens](https://github.com/software-mansion/react-native-screens) to make it work. Defaults to `true` on Android and `false` on iOS. | ||
|
||
#### `detachPreviousScreen` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be under options
@@ -51,6 +51,14 @@ The `Stack.Navigator` component accepts following props: | |||
|
|||
The name of the route to render on first load of the navigator. | |||
|
|||
#### `detachInactiveScreens` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move custom options to after screenOptions
@@ -49,6 +49,10 @@ The `Drawer.Navigator` component accepts following props: | |||
|
|||
The name of the route to render on first load of the navigator. | |||
|
|||
#### `detachInactiveScreens` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move custom options to after screenOptions
@@ -49,6 +49,10 @@ The `Tab.Navigator` component accepts following props: | |||
|
|||
The name of the route to render on first load of the navigator. | |||
|
|||
#### `detachInactiveScreens` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move custom options to after screenOptions
@@ -58,6 +58,8 @@ Options for the router: | |||
- `navigationOptions` - Navigation options for the navigator itself, to configure a parent navigator | |||
- `defaultNavigationOptions` - Default navigation options to use for screens | |||
- `paths` - A mapping of overrides for the paths set in the route configs | |||
- `detachInactiveScreens` - Boolean used to indicate whether inactive screens should be detached from the view hierarchy to save memory. Make sure to call `enableScreens` from [react-native-screens](https://github.com/software-mansion/react-native-screens) to make it work. Defaults to `true` on Android and `false` on iOS. | |||
- `detachPreviousScreen` - Boolean used to indicate whether to detach the previous screen from the view hierarchy to save memory. Set it to `false` if you need the previous screen to be seen through the active screen. Only applicable if `detachInactiveScreens` isn't set to `false`. Defaults to `false` for the last screen when `mode='modal'`, otherwise `true`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to under navigationOptions
@@ -29,6 +29,7 @@ The route configs object is a mapping from route name to a route config, which t | |||
## BottomTabNavigatorConfig | |||
|
|||
- `initialRouteName` - The routeName for the initial tab route when first loading. | |||
- `detachInactiveScreens` - Boolean used to indicate whether inactive screens should be detached from the view hierarchy to save memory. Make sure to call `enableScreens` from [react-native-screens](https://github.com/software-mansion/react-native-screens) to make it work. Defaults to `true`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place navigator related configs after the router related configs (after backBehavior
)
@@ -29,6 +29,7 @@ The route configs object is a mapping from route name to a route config, which t | |||
## BottomTabNavigatorConfig | |||
|
|||
- `initialRouteName` - The routeName for the initial tab route when first loading. | |||
- `detachInactiveScreens` - Boolean used to indicate whether inactive screens should be detached from the view hierarchy to save memory. Make sure to call `enableScreens` from [react-native-screens](https://github.com/software-mansion/react-native-screens) to make it work. Defaults to `true`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `detachInactiveScreens` - Boolean used to indicate whether inactive screens should be detached from the view hierarchy to save memory. Make sure to call `enableScreens` from [react-native-screens](https://github.com/software-mansion/react-native-screens) to make it work. Defaults to `true`. | |
- `detachInactiveScreens` - Boolean used to indicate whether inactive screens should be detached from the view hierarchy to save memory. Make sure to call `enableScreens` from [react-native-screens](https://github.com/software-mansion/react-native-screens) to make it work. Defaults to `true` on Android and `false` on iOS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is bottom-tabs
navigator not using RNScreens
on iOS by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to add this in stack-naviagtor
probably?
@@ -79,6 +79,14 @@ Visual options: | |||
|
|||
String that can be used as a fallback for `headerTitle`. Additionally, will be used as a fallback for `tabBarLabel` (if nested in a TabNavigator) or `drawerLabel` (if nested in a DrawerNavigator). | |||
|
|||
#### `detachInactiveScreens` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be under StackNavigatorConfig
Added information about the new prop to be introduced with
react-navigation/react-navigation#8805 and react-navigation/react-navigation#8816.