Skip to content

Commit 2c0fab7

Browse files
committed
Update tab view example and video
1 parent 99d5798 commit 2c0fab7

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

static/assets/7.x/tab-view.mp4

667 KB
Binary file not shown.

versioned_docs/version-7.x/tab-view.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ React Native Tab View is a cross-platform Tab View component for React Native im
88

99
It follows material design guidelines by default, but you can also use your own custom tab bar or position the tab bar at the bottom.
1010

11-
<div style={{ display: 'flex', margin: '16px 0' }}>
12-
<img src="/assets/libraries/tab-view.gif" width="360px" alt="React Native Tab View Demo" />
13-
</div>
11+
<video playsInline autoPlay muted loop>
12+
<source src="/assets/7.x/tab-view.mp4" />
13+
</video>
1414

1515
This package doesn't integrate with React Navigation. If you want to integrate the tab view with React Navigation's navigation system, e.g. want to show screens in the tab bar and be able to navigate between them using `navigation.navigate` etc, use [Material Top Tab Navigator](material-top-tab-navigator.md) instead.
1616

@@ -40,11 +40,13 @@ We're done! Now you can build and run the app on your device/simulator.
4040

4141
## Quick start
4242

43-
```js
43+
```js name="React Native Tab View" snack version=7
44+
// codeblock-focus-start
4445
import * as React from 'react';
4546
import { View, useWindowDimensions } from 'react-native';
4647
import { TabView, SceneMap } from 'react-native-tab-view';
4748

49+
// codeblock-focus-end
4850
const FirstRoute = () => (
4951
<View style={{ flex: 1, backgroundColor: '#ff4081' }} />
5052
);
@@ -53,19 +55,20 @@ const SecondRoute = () => (
5355
<View style={{ flex: 1, backgroundColor: '#673ab7' }} />
5456
);
5557

58+
// codeblock-focus-start
5659
const renderScene = SceneMap({
5760
first: FirstRoute,
5861
second: SecondRoute,
5962
});
6063

64+
const routes = [
65+
{ key: 'first', title: 'First' },
66+
{ key: 'second', title: 'Second' },
67+
];
68+
6169
export default function TabViewExample() {
6270
const layout = useWindowDimensions();
63-
6471
const [index, setIndex] = React.useState(0);
65-
const [routes] = React.useState([
66-
{ key: 'first', title: 'First' },
67-
{ key: 'second', title: 'Second' },
68-
]);
6972

7073
return (
7174
<TabView
@@ -76,10 +79,9 @@ export default function TabViewExample() {
7679
/>
7780
);
7881
}
82+
// codeblock-focus-end
7983
```
8084

81-
[Try this example on Snack](https://snack.expo.io/@satya164/react-native-tab-view-quick-start)
82-
8385
## More examples on Snack
8486

8587
- [Custom Tab Bar](https://snack.expo.io/@satya164/react-native-tab-view-custom-tabbar)

0 commit comments

Comments
 (0)