Skip to content

Commit 2bf54bb

Browse files
committed
Update tab navigator reference
1 parent 7f1a91e commit 2bf54bb

File tree

1 file changed

+48
-50
lines changed

1 file changed

+48
-50
lines changed

docs/tab-navigator.md

Lines changed: 48 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ title: createTabNavigator
44
sidebar_label: createTabNavigator
55
---
66

7-
> Note: `createTabNavigator` is deprecated. Please use `createBottomTabNavigator` and/or `createTopTabNavigator` instead.
7+
> Note: `createTabNavigator` is deprecated. Please use `createBottomTabNavigator` and/or `createMaterialTopTabNavigator` instead.
88
99
```js
10-
createTabNavigator(RouteConfigs, TabNavigatorConfig)
10+
createTabNavigator(RouteConfigs, TabNavigatorConfig);
1111
```
1212

1313
## RouteConfigs
@@ -16,36 +16,34 @@ The route configs object is a mapping from route name to a route config, which t
1616

1717
## TabNavigatorConfig
1818

19-
- `tabBarComponent` - Component to use as the tab bar, e.g. `TabBarBottom`
20-
(this is the default on iOS), `TabBarTop`
21-
(this is the default on Android).
22-
- `tabBarPosition` - Position of the tab bar, can be `'top'` or `'bottom'`.
23-
- `swipeEnabled` - Whether to allow swiping between tabs.
24-
- `animationEnabled` - Whether to animate when changing tabs.
25-
- `lazy` - Defaults to `true`. If `false`, all tabs are rendered immediately. When `true`, tabs are rendered only when they are made active.
26-
- `removeClippedSubviews` - Defaults to `true`. An optimization to reduce memory usage by freeing resources used by inactive tabs.
27-
- `configureTransition` - a function that, given `currentTransitionProps` and `nextTransitionProps`, returns a configuration object that describes the animation between tabs.
28-
- `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.
29-
- `tabBarOptions` - Configure the tab bar, see below.
19+
* `tabBarComponent` - Component to use as the tab bar, e.g. `TabBarBottom` (this is the default on iOS), `TabBarTop` (this is the default on Android).
20+
* `tabBarPosition` - Position of the tab bar, can be `'top'` or `'bottom'`.
21+
* `swipeEnabled` - Whether to allow swiping between tabs.
22+
* `animationEnabled` - Whether to animate when changing tabs.
23+
* `lazy` - Defaults to `true`. If `false`, all tabs are rendered immediately. When `true`, tabs are rendered only when they are made active.
24+
* `removeClippedSubviews` - Defaults to `true`. An optimization to reduce memory usage by freeing resources used by inactive tabs.
25+
* `configureTransition` - a function that, given `currentTransitionProps` and `nextTransitionProps`, returns a configuration object that describes the animation between tabs.
26+
* `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.
27+
* `tabBarOptions` - Configure the tab bar, see below.
3028

3129
Several options get passed to the underlying router to modify navigation logic:
3230

33-
- `initialRouteName` - The routeName for the initial tab route when first loading.
34-
- `order` - Array of routeNames which defines the order of the tabs.
35-
- `paths` - Provide a mapping of routeName to path config, which overrides the paths set in the routeConfigs.
36-
- `backBehavior` - Should the back button cause a tab switch to the initial tab? If yes, set to `initialRoute`, otherwise `none`. Defaults to `initialRoute` behavior.
31+
* `initialRouteName` - The routeName for the initial tab route when first loading.
32+
* `order` - Array of routeNames which defines the order of the tabs.
33+
* `paths` - Provide a mapping of routeName to path config, which overrides the paths set in the routeConfigs.
34+
* `backBehavior` - Should the back button cause a tab switch to the initial tab? If yes, set to `initialRoute`, otherwise `none`. Defaults to `initialRoute` behavior.
3735

3836
### `tabBarOptions` for `TabBarBottom` (default tab bar on iOS)
3937

40-
- `activeTintColor` - Label and icon color of the active tab.
41-
- `activeBackgroundColor` - Background color of the active tab.
42-
- `inactiveTintColor` - Label and icon color of the inactive tab.
43-
- `inactiveBackgroundColor` - Background color of the inactive tab.
44-
- `showLabel` - Whether to show label for tab, default is true.
45-
- `style` - Style object for the tab bar.
46-
- `labelStyle` - Style object for the tab label.
47-
- `tabStyle` - Style object for the tab.
48-
- `allowFontScaling` - Whether label font should scale to respect Text Size accessibility settings, default is true.
38+
* `activeTintColor` - Label and icon color of the active tab.
39+
* `activeBackgroundColor` - Background color of the active tab.
40+
* `inactiveTintColor` - Label and icon color of the inactive tab.
41+
* `inactiveBackgroundColor` - Background color of the inactive tab.
42+
* `showLabel` - Whether to show label for tab, default is true.
43+
* `style` - Style object for the tab bar.
44+
* `labelStyle` - Style object for the tab label.
45+
* `tabStyle` - Style object for the tab.
46+
* `allowFontScaling` - Whether label font should scale to respect Text Size accessibility settings, default is true.
4947

5048
Example:
5149

@@ -63,20 +61,20 @@ tabBarOptions: {
6361

6462
### `tabBarOptions` for `TabBarTop` (default tab bar on Android)
6563

66-
- `activeTintColor` - Label and icon color of the active tab.
67-
- `inactiveTintColor` - Label and icon color of the inactive tab.
68-
- `showIcon` - Whether to show icon for tab, default is false.
69-
- `showLabel` - Whether to show label for tab, default is true.
70-
- `upperCaseLabel` - Whether to make label uppercase, default is true.
71-
- `pressColor` - Color for material ripple (Android >= 5.0 only).
72-
- `pressOpacity` - Opacity for pressed tab (iOS and Android < 5.0 only).
73-
- `scrollEnabled` - Whether to enable scrollable tabs.
74-
- `tabStyle` - Style object for the tab.
75-
- `indicatorStyle` - Style object for the tab indicator (line at the bottom of the tab).
76-
- `labelStyle` - Style object for the tab label.
77-
- `iconStyle` - Style object for the tab icon.
78-
- `style` - Style object for the tab bar.
79-
- `allowFontScaling` - Whether label font should scale to respect Text Size accessibility settings, default is true.
64+
* `activeTintColor` - Label and icon color of the active tab.
65+
* `inactiveTintColor` - Label and icon color of the inactive tab.
66+
* `showIcon` - Whether to show icon for tab, default is false.
67+
* `showLabel` - Whether to show label for tab, default is true.
68+
* `upperCaseLabel` - Whether to make label uppercase, default is true.
69+
* `pressColor` - Color for material ripple (Android >= 5.0 only).
70+
* `pressOpacity` - Opacity for pressed tab (iOS and Android < 5.0 only).
71+
* `scrollEnabled` - Whether to enable scrollable tabs.
72+
* `tabStyle` - Style object for the tab.
73+
* `indicatorStyle` - Style object for the tab indicator (line at the bottom of the tab).
74+
* `labelStyle` - Style object for the tab label.
75+
* `iconStyle` - Style object for the tab icon.
76+
* `style` - Style object for the tab bar.
77+
* `allowFontScaling` - Whether label font should scale to respect Text Size accessibility settings, default is true.
8078

8179
Example:
8280

@@ -86,7 +84,7 @@ tabBarOptions: {
8684
fontSize: 12,
8785
},
8886
tabStyle: {
89-
width: 100,
87+
width: 100,
9088
},
9189
style: {
9290
backgroundColor: 'blue',
@@ -130,15 +128,15 @@ Useful for adding a custom logic before the transition to the next scene (the ta
130128

131129
The navigator component created by `createTabNavigator(...)` takes the following props:
132130

133-
- `screenProps` - Pass down extra options to child screens and navigation options, for example:
131+
* `screenProps` - Pass down extra options to child screens and navigation options, for example:
134132

135133

136-
```js
137-
const TabNavigator = createTabNavigator({
138-
// config
139-
});
134+
```js
135+
const TabNavigator = createTabNavigator({
136+
// config
137+
});
140138

141-
<TabNavigator
142-
screenProps={/* this prop will get passed to the screen components as this.props.screenProps */}
143-
/>
144-
```
139+
<TabNavigator
140+
screenProps={/* this prop will get passed to the screen components as this.props.screenProps */}
141+
/>
142+
```

0 commit comments

Comments
 (0)