Skip to content

Commit a7ba887

Browse files
authored
Merge pull request react-navigation#291 from labcoder/@labcoder/add-scrollables-doc
Adding simple API overview for exported scrollables
2 parents a032f35 + b0d8e87 commit a7ba887

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

docs/scrollables.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
id: scrollables
3+
title: Scrollables
4+
sidebar_label: Scrollables
5+
---
6+
7+
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.
8+
9+
Example
10+
```jsx harmony
11+
import React from 'react';
12+
import { Text, View } from 'react-native';
13+
import { createBottomTabNavigator, createAppContainer, FlatList } from 'react-navigation';
14+
15+
const data = new Array(150).fill(0);
16+
17+
class HomeScreen extends React.Component {
18+
renderItem = ({ index }) => {
19+
return (
20+
<View style={{ height: 50 }}>
21+
<Text style={{ textAlign: 'center' }}>Item {index}</Text>
22+
</View>
23+
);
24+
};
25+
26+
render() {
27+
return (
28+
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
29+
<FlatList
30+
data={data}
31+
renderItem={this.renderItem}
32+
contentContainerStyle={{ padding: 10 }}
33+
/>
34+
</View>
35+
);
36+
}
37+
}
38+
39+
const TabNavigator = createBottomTabNavigator({
40+
Home: { screen: HomeScreen },
41+
});
42+
43+
export default createAppContainer(TabNavigator);
44+
```
45+
<a href="https://snack.expo.io/@react-navigation/basic-scrollables-tab-v3" target="blank" class="run-code-button">&rarr; Run this code</a>

website/i18n/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@
102102
"Routers": "Routers",
103103
"screen-tracking": "Screen tracking",
104104
"Screen tracking": "Screen tracking",
105+
"scrollables": "Scrollables",
106+
"Scrollables": "Scrollables",
105107
"search-screen": "search-screen",
106108
"set-params-on-back": "Update params when navigating back",
107109
"Update params when navigating back": "Update params when navigating back",
@@ -148,7 +150,7 @@
148150
"Stay up to date|no description given": "Stay up to date",
149151
"Need help?|no description given": "Need help?",
150152
"This project is maintained by a dedicated group of people.|statement made to reader": "This project is maintained by a dedicated group of people.",
151-
"Learn more using the [documentation on this site](/docs/en/getting-started.html) and [reading the API reference](/docs/en/api-reference.html).|no description given": "Learn more using the [documentation on this site](getting-started.html) and [reading the API reference](/content/docs/api-reference.html).",
153+
"Learn more using the [documentation on this site](/docs/en/getting-started.html) and [reading the API reference](/docs/en/api-reference.html).|no description given": "Learn more using the [documentation on this site](/docs/en/getting-started.html) and [reading the API reference](/docs/en/api-reference.html).",
152154
"Browse Docs and API|no description given": "Browse Docs and API",
153155
"Ask questions about the documentation and project in the `#react-navigation` channel on the [Reactiflux Discord](https://discord.gg/4xEK3nD).|no description given": "Ask questions about the documentation and project in the `#react-navigation` channel on the [Reactiflux Discord](https://discord.gg/4xEK3nD).",
154156
"Read the release notes for new versions of React Navigation in the [releases tab on the Github repository](https://github.com/react-navigation/react-navigation/releases).|no description given": "Read the release notes for new versions of React Navigation in the [releases tab on the Github repository](https://github.com/react-navigation/react-navigation/releases).",

website/sidebars.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
"material-top-tab-navigator",
6363
"with-navigation",
6464
"with-navigation-focus",
65-
"navigation-events"
65+
"navigation-events",
66+
"scrollables"
6667
]
6768
}
6869
}

0 commit comments

Comments
 (0)