From e50daf05bb0b1ab65fe8a3c396cbb5c3dcab304d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Kapu=C5=9Bciak?= <39658211+kacperkapusciak@users.noreply.github.com> Date: Fri, 2 Apr 2021 10:15:08 +0200 Subject: [PATCH] docs: remove from READMEs info about enabledScreens being required (#872) Calling `enableScreens()` at the top of your application is no longer required since v3.0.0 and this should be reflected in the documentation. --- README.md | 20 +++++++++----------- createNativeStackNavigator/README.md | 6 ++++-- native-stack/README.md | 6 ++++-- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 11a4c4cff1..a0726ed502 100644 --- a/README.md +++ b/README.md @@ -43,9 +43,7 @@ Read usage guide depending on if you are [using Expo](#usage-in-expo-with-react- Screens support is built into [react-navigation](https://github.com/react-navigation/react-navigation) starting from version [2.14.0](https://github.com/react-navigation/react-navigation/releases/tag/2.14.0) for all the different navigator types (stack, tab, drawer, etc). We plan on adding it to other navigators shortly. -To configure react-navigation to use screens instead of plain RN Views for rendering screen views, follow the steps below: - -1. Add this library as a dependency to your project: +To configure react-navigation to use screens instead of plain RN Views for rendering screen views, simply add this library as a dependency to your project: ```bash # bare React Native project @@ -55,19 +53,19 @@ yarn add react-native-screens expo install react-native-screens ``` -2. Enable screens support before any of your navigation screens renders. Add the following code to your main application file (e.g. App.js): +Just make sure that the version of [react-navigation](https://github.com/react-navigation/react-navigation) you are using is 2.14.0 or higher. -```js -import { enableScreens } from 'react-native-screens'; +You are all set 🎉 – when screens are enabled in your application code react-navigation will automatically use them instead of relying on plain React Native Views. -enableScreens(); -``` +### Disabling `react-native-screens` -Note that the above code needs to execute before the first render of a navigation screen. You can check the Example's app [App.js](https://github.com/kmagiera/react-native-screens/blob/master/Example/App.js#L16) file as a reference. +If, for whatever reason, you'd like to disable native screens support and use plain React Native Views add the following code in your entry file (e.g. `App.js`): -3. Make sure that the version of [react-navigation](https://github.com/react-navigation/react-navigation) you are using is 2.14.0 or higher +```js +import { enableScreens } from 'react-native-screens'; -4. You are all set 🎉 – when screens are enabled in your application code react-navigation will automatically use them instead of relying on plain React Native Views. +enableScreens(false); +``` ### Using createNativeStackNavigator with React Navigation diff --git a/createNativeStackNavigator/README.md b/createNativeStackNavigator/README.md index 2551c4ed92..65524374d9 100644 --- a/createNativeStackNavigator/README.md +++ b/createNativeStackNavigator/README.md @@ -10,12 +10,14 @@ This navigator uses native navigation primitives (`UINavigationController` on iO npm install react-native-screens @react-navigation/native ``` -Make sure to enable `react-native-screens`. This needs to be done before our app renders. To do it, add the following code in your entry file (e.g. `App.js`): +## Disabling `react-native-screens` + +If, for whatever reason, you'd like to disable native screens support and use plain React Native Views add the following code in your entry file (e.g. `App.js`): ```js import { enableScreens } from 'react-native-screens'; -enableScreens(); +enableScreens(false); ``` ## API Definition diff --git a/native-stack/README.md b/native-stack/README.md index cdadd9fff4..aec1acb653 100644 --- a/native-stack/README.md +++ b/native-stack/README.md @@ -10,12 +10,14 @@ This navigator uses native navigation primitives (`UINavigationController` on iO npm install react-native-screens @react-navigation/native ``` -Make sure to enable `react-native-screens`. This needs to be done before our app renders. To do it, add the following code in your entry file (e.g. `App.js`): +## Disabling `react-native-screens` + +If, for whatever reason, you'd like to disable native screens support and use plain React Native Views add the following code in your entry file (e.g. `App.js`): ```js import { enableScreens } from 'react-native-screens'; -enableScreens(); +enableScreens(false); ``` ## API Definition