-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathscrolltabbar.tsx
More file actions
47 lines (44 loc) · 1.21 KB
/
scrolltabbar.tsx
File metadata and controls
47 lines (44 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* eslint-disable no-console */
/* tslint:disable:no-console */
import { View, ScrollView, Text } from 'react-native';
import { Tabs, Models } from '../../src';
import * as React from 'react';
const renderContent = (tab: Models.TabData, index: number) =>
<ScrollView style={{ backgroundColor: '#fff' }}>
{
[1, 2, 3, 4, 5, 6, 7, 8].map(i => <View key={`${index}_${i}`}
style={{
paddingVertical: 40,
justifyContent: 'center',
alignItems: 'center',
margin: 10,
backgroundColor: '#ddd',
}}>
<Text>
{tab.title} - {i}
</Text>
</View>)
}
</ScrollView>
;
const TabsExample = () => (
<View style={{ flex: 1 }}>
<Tabs tabs={[
{ title: '1st Tab' },
{ title: '2nd Tab' },
{ title: '3rd Tab' },
{ title: '4th Tab' },
{ title: '5th Tab' },
{ title: '6th Tab' },
{ title: '7th Tab' },
{ title: '8th Tab' },
{ title: '9th Tab' },
]} initialPage={1} tabBarPosition="top"
renderTabBar={(props) => <Tabs.DefaultTabBar {...props} page={4} />}
>
{renderContent}
</Tabs>
</View>
);
export const Demo = TabsExample;
export const title = 'Scroll TabBar';