Skip to content

Commit 89a7b71

Browse files
committed
Update tab navigator docs to use react-navigation-tabs
1 parent bb9e80b commit 89a7b71

7 files changed

+51
-13
lines changed

docs/bottom-tab-navigator.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,22 @@ sidebar_label: createBottomTabNavigator
66

77
A simple tab bar on the bottom of the screen that lets you switch between different routes. Routes are lazily initialized -- their screen components are not mounted until they are first focused.
88

9-
> For a complete usage guide please visit [Tab Navigation](https://reactnavigation.org/docs/en/tab-based-navigation.html)
9+
To use this navigator, you need to install [`react-navigation-tabs`](https://github.com/react-navigation/react-navigation-tabs) and its peer dependencies:
10+
11+
```sh
12+
npm install react-navigation-tabs react-native-reanimated react-native-gesture-handler
13+
```
14+
15+
To use this tab navigator, import it from `react-navigation-tabs`:
1016

1117
```js
12-
createBottomTabNavigator(RouteConfigs, BottomTabNavigatorConfig);
18+
import { createBottomTabNavigator } from 'react-navigation-tabs';
19+
20+
createBottomTabNavigator(RouteConfigs, TabNavigatorConfig);
1321
```
1422

23+
> For a complete usage guide please visit [Tab Navigation](https://reactnavigation.org/docs/en/tab-based-navigation.html)
24+
1525
## RouteConfigs
1626

1727

docs/common-mistakes.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,12 @@ In previous version of React Navigation, the library used to dig through your co
114114
## Wrapping AppContainer in a View without flex
115115

116116
If you wrap the `AppContainer` in a `View`, make sure the `View` is using flex.
117+
117118
```javascript
118119
import React from 'react';
119120
import { Text, View } from 'react-native';
120-
import { createBottomTabNavigator, createAppContainer } from 'react-navigation';
121+
import { createAppContainer } from 'react-navigation';
122+
import { createBottomTabNavigator } from 'react-navigation-tabs';
121123

122124
class HomeScreen extends React.Component {
123125
render() {

docs/material-bottom-tab-navigator.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ A material-design themed tab bar on the bottom of the screen that lets you switc
88

99
<img src="/docs/assets/navigators/bottom-navigation.gif" style="width: 420px; max-width: 100%">
1010

11-
To use this navigator, you need to install `react-navigation-material-bottom-tabs`
11+
To use this navigator, you need to install [`react-navigation-material-bottom-tabs`](https://github.com/react-navigation/react-navigation-material-bottom-tabs):
1212

13-
```
13+
14+
```sh
1415
npm install react-navigation-material-bottom-tabs react-native-paper
1516
```
1617

@@ -27,7 +28,7 @@ createMaterialBottomTabNavigator(
2728
);
2829
```
2930

30-
This library uses the [`BottomNavigation` component from `react-native-paper`](https://callstack.github.io/react-native-paper/bottom-navigation.html). It doesn't include the whole `react-native-paper` library in your bundle, so you don't need to worry about it.
31+
This library uses the [`BottomNavigation` component from `react-native-paper`](https://callstack.github.io/react-native-paper/bottom-navigation.html). If you [configure the Babel plugin](https://callstack.github.io/react-native-paper/getting-started.html), it won't include the whole `react-native-paper` library in your bundle.
3132

3233
## RouteConfigs
3334

docs/material-top-tab-navigator.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,27 @@ sidebar_label: createMaterialTopTabNavigator
66

77
A material-design themed tab bar on the top of the screen that lets you switch between different routes by tapping the route or swiping horizontally. Transitions are animated by default. Screen components for each route are mounted immediately.
88

9+
To use this navigator, you need to install [`react-navigation-tabs`](https://github.com/react-navigation/react-navigation-tabs):
10+
11+
```sh
12+
npm install react-navigation-tabs
13+
```
14+
15+
If you are not using Expo, you also need to install and link [`react-native-gesture-handler`](https://github.com/kmagiera/react-native-gesture-handler) and [`react-native-reanimated`](https://github.com/kmagiera/react-native-reanimated). To install and link them, run:
16+
17+
```sh
18+
npm install react-native-reanimated react-native-gesture-handler
19+
react-native link react-native-reanimated
20+
react-native link react-native-gesture-handler
21+
```
22+
23+
**IMPORTANT:** There are additional steps required for `react-native-gesture-handler` on Android after running `react-native link react-native-gesture-handler`. Check the [this guide](https://kmagiera.github.io/react-native-gesture-handler/docs/getting-started.html) to complete the installation.
24+
25+
To use this tab navigator, import it from `react-navigation-tabs`:
26+
927
```js
28+
import { createMaterialTopTabNavigator } from 'react-navigation-tabs';
29+
1030
createMaterialTopTabNavigator(RouteConfigs, TabNavigatorConfig);
1131
```
1232

@@ -24,9 +44,8 @@ The route configs object is a mapping from route name to a route config.
2444
* `backBehavior` - `initialRoute` to return to initial tab, `order` to return to previous tab, `history` to return to last visited tab, or `none`.
2545
* `tabBarPosition` - Position of the tab bar, can be `'top'` or `'bottom'`, default is `top`.
2646
* `swipeEnabled` - Whether to allow swiping between tabs.
27-
* `animationEnabled` - Whether to animate when changing tabs.
2847
* `lazy` - Defaults to `false`. If `true`, tabs are rendered only when they are made active or on peek swipe. When `false`, all tabs are rendered immediately.
29-
* `optimizationsEnabled` - Whether to wrap scenes into [`<ResourceSavingScene />`](https://github.com/react-navigation/react-navigation-tabs/blob/master/src/views/ResourceSavingScene.js) to move the scene out of the screen once it's unfocused, it improves memory usage.
48+
* `lazyPlaceholderComponent` - React component to render for routes that haven't been rendered yet. Receives an object containing the route as the argument. The `lazy` prop also needs to be enabled.
3049
* `initialLayout` - Optional object containing the initial `height` and `width`, can be passed to prevent the one frame delay in [react-native-tab-view](https://github.com/react-native-community/react-native-tab-view#avoid-one-frame-delay) rendering.
3150
* `tabBarComponent` - Optional, override the component to use as the tab bar.
3251
* `tabBarOptions` - An object with the following properties:

docs/scrollables.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ sidebar_label: Scrollables
77
React Navigation exports its own `ScrollView`, `FlatList`, and `SectionList`. The built-in components are wrapped in order to respond to events from navigation that will scroll to top when tapping on the active tab as you would expect from native tab bars.
88

99
Example
10+
1011
```jsx harmony
1112
import React from 'react';
1213
import { Text, View } from 'react-native';
13-
import { createBottomTabNavigator, createAppContainer, FlatList } from 'react-navigation';
14+
import { createAppContainer, FlatList } from 'react-navigation';
15+
import { createBottomTabNavigator } from 'react-navigation-tabs';
1416

1517
const data = new Array(150).fill(0);
1618

docs/tab-based-navigation.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ This guide covers [createBottomTabNavigator](bottom-tab-navigator.html). You may
1313
```js
1414
import React from 'react';
1515
import { Text, View } from 'react-native';
16-
import { createBottomTabNavigator, createAppContainer } from 'react-navigation';
16+
import { createAppContainer } from 'react-navigation';
17+
import { createBottomTabNavigator } from 'react-navigation-tabs';
1718

1819
class HomeScreen extends React.Component {
1920
render() {
@@ -53,7 +54,8 @@ This is similar to how you would customize a stack navigator &mdash; there are s
5354
// You can import Ionicons from @expo/vector-icons if you use Expo or
5455
// react-native-vector-icons/Ionicons otherwise.
5556
import Ionicons from 'react-native-vector-icons/Ionicons';
56-
import { createBottomTabNavigator, createAppContainer } from 'react-navigation';
57+
import { createAppContainer } from 'react-navigation';
58+
import { createBottomTabNavigator } from 'react-navigation-tabs';
5759

5860
export default createBottomTabNavigator(
5961
{
@@ -183,10 +185,10 @@ Usually tabs don't just display one screen &mdash; for example, on your Twitter
183185

184186
```js
185187
import {
186-
createBottomTabNavigator,
187188
createStackNavigator,
188189
createAppContainer,
189190
} from 'react-navigation';
191+
import { createBottomTabNavigator } from 'react-navigation-tabs';
190192

191193
class DetailsScreen extends React.Component {
192194
render() {

docs/themes.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,11 @@ Some navigators may have their styles configured in the navigator configuration
171171
import {
172172
createAppContainer,
173173
createStackNavigator,
174+
} from 'react-navigation';
175+
import {
174176
createBottomTabNavigator,
175177
BottomTabBar,
176-
} from 'react-navigation';
178+
} from 'react-navigation-tabs';
177179

178180
const ThemeConstants = {
179181
light: {

0 commit comments

Comments
 (0)