Skip to content

Commit

Permalink
docs: remove from READMEs info about enabledScreens being required (#872
Browse files Browse the repository at this point in the history
)

Calling `enableScreens()` at the top of your application is no longer required since v3.0.0 and this should be reflected in the documentation.
  • Loading branch information
kacperkapusciak authored Apr 2, 2021
1 parent 54aa66a commit e50daf0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
6 changes: 4 additions & 2 deletions createNativeStackNavigator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions native-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e50daf0

Please sign in to comment.