Skip to content

Commit 14bd59b

Browse files
jarvisluongbrentvatne
authored andcommitted
add docs for react-native-screens (react-navigation#407)
1 parent a28e7e9 commit 14bd59b

File tree

10 files changed

+95
-3
lines changed

10 files changed

+95
-3
lines changed

docs/limitations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ We are able to offload animations to another thread using React Native's [Animat
5757

5858
Some platform-specific behavior either cannot be implemented or has not yet been implemented in React Navigation.
5959

60-
Versions prior to 2.14.0 do not support the ["reachability feature" on iOS](https://www.cnet.com/how-to/how-to-use-reachability-on-iphone-6-6-plus/). When you toggle this feature, the app moves down towards the bottom of the screen so you can easily reach the navigation bar and other functionality near the top of the UI. When you navigate to another screen using the built-in iOS navigation API, the UI will jump back up to the top of the screen. React-navigation 2.14.0 and later supports this feature through integration with [react-native-screens](https://github.com/kmagiera/react-native-screens).
60+
Versions prior to 2.14.0 do not support the ["reachability feature" on iOS](https://www.cnet.com/how-to/how-to-use-reachability-on-iphone-6-6-plus/). When you toggle this feature, the app moves down towards the bottom of the screen so you can easily reach the navigation bar and other functionality near the top of the UI. When you navigate to another screen using the built-in iOS navigation API, the UI will jump back up to the top of the screen. React-navigation 2.14.0 and later supports this feature through integration with [react-native-screens](react-native-screens.html).
6161

6262
React-navigation does not include support for the peek & pop feature available on devices with 3D touch.

docs/react-native-screens.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
id: react-native-screens
3+
title: Optimize memory usage and performance
4+
sidebar_label: Optimize memory usage and performance
5+
---
6+
7+
Prior to `react-navigation@2.14.0`, all screens are essentially regular native `View` in each platform, which will increase memory usage and make the render tree deep in a heavy-stacked application. This is one of the reason your app is slowing down comparing to native navigation solution.
8+
9+
With the advent of `react-native-screens`, the native screen optimization is brought possible to `react-navigation` by bringing the native navigation component (`UIViewController` for iOS, and `FragmentActivity` for Android). By using `react-native-screens`, it is possible for each native platform to optimize the memory usage for screens that are under the view stack and also simplify the native node hierarchy. You can take a look at the comparison [here](https://twitter.com/janicduplessis/status/1039979591815897088?s=21) to see the performance gain.
10+
11+
## Setup when you are using Expo
12+
13+
By default expo already included `react-native-screens`, all you need to do is pasting the following snippet before your navigation stacks are rendered (typically in an `index.js` or `App.js` file):
14+
15+
```js
16+
// Before rendering any navigation stack
17+
import { useScreens } from 'react-native-screens';
18+
useScreens();
19+
```
20+
21+
## Setup in normal react-native applications
22+
23+
You will need to follow the installation instruction from [react-native-screens](https://github.com/kmagiera/react-native-screens) first. After that, you can import the library like mentioned above and enjoy the optimization.
24+
25+

website/i18n/en.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@
212212
"title": "Pitch & anti-pitch",
213213
"sidebar_label": "Pitch & anti-pitch"
214214
},
215+
"react-native-screens": {
216+
"title": "Optimize memory usage and performance",
217+
"sidebar_label": "Optimize memory usage and performance"
218+
},
215219
"redux-integration": {
216220
"title": "Redux integration",
217221
"sidebar_label": "Redux integration"
@@ -606,6 +610,10 @@
606610
"title": "Passing parameters to routes",
607611
"sidebar_label": "Passing parameters to routes"
608612
},
613+
"version-2.x-react-native-screens": {
614+
"title": "Optimize memory usage and performance",
615+
"sidebar_label": "Optimize memory usage and performance"
616+
},
609617
"version-2.x-redux-integration": {
610618
"title": "Redux integration",
611619
"sidebar_label": "Redux integration"
@@ -758,6 +766,10 @@
758766
"title": "Passing parameters to routes",
759767
"sidebar_label": "Passing parameters to routes"
760768
},
769+
"version-3.x-react-native-screens": {
770+
"title": "Optimize memory usage and performance",
771+
"sidebar_label": "Optimize memory usage and performance"
772+
},
761773
"version-3.x-redux-integration": {
762774
"title": "Redux integration",
763775
"sidebar_label": "Redux integration"

website/sidebars.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"next-steps",
1414
"glossary-of-terms",
1515
"common-mistakes",
16+
"react-native-screens",
1617
"limitations"
1718
],
1819
"Guides": [

website/versioned_docs/version-2.x/limitations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ We are able to offload animations to another thread using React Native's [Animat
5656

5757
Some platform-specific behavior either cannot be implemented or has not yet been implemented in React Navigation.
5858

59-
Versions prior to 2.14.0 do not support the ["reachability feature" on iOS](https://www.cnet.com/how-to/how-to-use-reachability-on-iphone-6-6-plus/). When you toggle this feature, the app moves down towards the bottom of the screen so you can easily reach the navigation bar and other functionality near the top of the UI. When you navigate to another screen using the built-in iOS navigation API, the UI will jump back up to the top of the screen. React-navigation 2.14.0 and later supports this feature through integration with [react-native-screens](https://github.com/kmagiera/react-native-screens).
59+
Versions prior to 2.14.0 do not support the ["reachability feature" on iOS](https://www.cnet.com/how-to/how-to-use-reachability-on-iphone-6-6-plus/). When you toggle this feature, the app moves down towards the bottom of the screen so you can easily reach the navigation bar and other functionality near the top of the UI. When you navigate to another screen using the built-in iOS navigation API, the UI will jump back up to the top of the screen. React-navigation 2.14.0 and later supports this feature through integration with [react-native-screens](react-native-screens.html).
6060

6161
React-navigation does not include support for the peek & pop feature available on devices with 3D touch.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
id: version-2.x-react-native-screens
3+
title: Optimize memory usage and performance
4+
sidebar_label: Optimize memory usage and performance
5+
original_id: react-native-screens
6+
---
7+
8+
Prior to `react-navigation@2.14.0`, all screens are essentially regular native `View` in each platform, which will increase memory usage and make the render tree deep in a heavy-stacked application. This is one of the reason your app is slowing down comparing to native navigation solution.
9+
10+
With the advent of `react-native-screens`, the native screen optimization is brought possible to `react-navigation` by bringing the native navigation component (`UIViewController` for iOS, and `FragmentActivity` for Android). By using `react-native-screens`, it is possible for each native platform to optimize the memory usage for screens that are under the view stack and also simplify the native node hierarchy. You can take a look at the comparison [here](https://twitter.com/janicduplessis/status/1039979591815897088?s=21) to see the performance gain.
11+
12+
## Setup when you are using Expo
13+
14+
By default expo already included `react-native-screens`, all you need to do is pasting the following snippet before your navigation stacks are rendered (typically in an `index.js` or `App.js` file):
15+
16+
```js
17+
// Before rendering any navigation stack
18+
import { useScreens } from 'react-native-screens';
19+
useScreens();
20+
```
21+
22+
## Setup in normal react-native applications
23+
24+
You will need to follow the installation instruction from [react-native-screens](https://github.com/kmagiera/react-native-screens) first. After that, you can import the library like mentioned above and enjoy the optimization.
25+
26+

website/versioned_docs/version-3.x/limitations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ We are able to offload animations to another thread using React Native's [Animat
5858

5959
Some platform-specific behavior either cannot be implemented or has not yet been implemented in React Navigation.
6060

61-
Versions prior to 2.14.0 do not support the ["reachability feature" on iOS](https://www.cnet.com/how-to/how-to-use-reachability-on-iphone-6-6-plus/). When you toggle this feature, the app moves down towards the bottom of the screen so you can easily reach the navigation bar and other functionality near the top of the UI. When you navigate to another screen using the built-in iOS navigation API, the UI will jump back up to the top of the screen. React-navigation 2.14.0 and later supports this feature through integration with [react-native-screens](https://github.com/kmagiera/react-native-screens).
61+
Versions prior to 2.14.0 do not support the ["reachability feature" on iOS](https://www.cnet.com/how-to/how-to-use-reachability-on-iphone-6-6-plus/). When you toggle this feature, the app moves down towards the bottom of the screen so you can easily reach the navigation bar and other functionality near the top of the UI. When you navigate to another screen using the built-in iOS navigation API, the UI will jump back up to the top of the screen. React-navigation 2.14.0 and later supports this feature through integration with [react-native-screens](react-native-screens.html).
6262

6363
React-navigation does not include support for the peek & pop feature available on devices with 3D touch.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
id: version-3.x-react-native-screens
3+
title: Optimize memory usage and performance
4+
sidebar_label: Optimize memory usage and performance
5+
original_id: react-native-screens
6+
---
7+
8+
Prior to `react-navigation@2.14.0`, all screens are essentially regular native `View` in each platform, which will increase memory usage and make the render tree deep in a heavy-stacked application. This is one of the reason your app is slowing down comparing to native navigation solution.
9+
10+
With the advent of `react-native-screens`, the native screen optimization is brought possible to `react-navigation` by bringing the native navigation component (`UIViewController` for iOS, and `FragmentActivity` for Android). By using `react-native-screens`, it is possible for each native platform to optimize the memory usage for screens that are under the view stack and also simplify the native node hierarchy. You can take a look at the comparison [here](https://twitter.com/janicduplessis/status/1039979591815897088?s=21) to see the performance gain.
11+
12+
## Setup when you are using Expo
13+
14+
By default expo already included `react-native-screens`, all you need to do is pasting the following snippet before your navigation stacks are rendered (typically in an `index.js` or `App.js` file):
15+
16+
```js
17+
// Before rendering any navigation stack
18+
import { useScreens } from 'react-native-screens';
19+
useScreens();
20+
```
21+
22+
## Setup in normal react-native applications
23+
24+
You will need to follow the installation instruction from [react-native-screens](https://github.com/kmagiera/react-native-screens) first. After that, you can import the library like mentioned above and enjoy the optimization.
25+
26+

website/versioned_sidebars/version-2.x-sidebars.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"version-2.x-next-steps",
1313
"version-2.x-glossary-of-terms",
1414
"version-2.x-common-mistakes",
15+
"version-2.x-react-native-screens",
1516
"version-2.x-limitations"
1617
],
1718
"Assorted Guides": [

website/versioned_sidebars/version-3.x-sidebars.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"version-3.x-next-steps",
1414
"version-3.x-glossary-of-terms",
1515
"version-3.x-common-mistakes",
16+
"version-3.x-react-native-screens",
1617
"version-3.x-limitations"
1718
],
1819
"Guides": [

0 commit comments

Comments
 (0)