-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCustomViewTabLayout.js
71 lines (69 loc) · 1.85 KB
/
CustomViewTabLayout.js
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import React, {
Component,
} from 'react';
import {
Image,
StyleSheet,
Text,
View
} from 'react-native';
import { Tab, TabLayout } from 'react-native-android-tablayout';
import Icon from 'react-native-vector-icons/FontAwesome';
import Labels from './Labels';
export default class CustomViewTabLayout extends Component {
render() {
return (
<View>
<TabLayout style={styles.tabLayout}>
<Tab
accessibilityLabel={Labels.CustomView.tab1}
onTabSelected={()=>{ this.setState({tabSelected: 1}) }}
style={styles.tab1}>
<Text style={{fontWeight: 'bold', fontSize: 30}}>Big size</Text>
</Tab>
<Tab
accessibilityLabel={Labels.CustomView.tab2}
onTabSelected={()=>{ this.setState({tabSelected: 2}) }}
style={styles.tab2}>
<Icon name="rocket" size={30} color="#6c1d5f" style={{marginRight: 10}}/>
<Text>Fly!</Text>
</Tab>
<Tab
accessibilityLabel={Labels.CustomView.tab3}
onTabSelected={()=>{ this.setState({tabSelected: 3}) }}
style={styles.tab3}>
<Image
source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}}
style={{width: 48, height: 48, marginRight: 10}}/>
<Text style={{width: 40}}>React Native</Text>
</Tab>
</TabLayout>
</View>
);
}
}
const styles = StyleSheet.create({
tabLayout: {
backgroundColor: '#ddd'
},
tab1: {
width: 110,
height: 48,
alignItems: 'center',
justifyContent: 'center'
},
tab2: {
width: 110,
height: 48,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center'
},
tab3: {
width: 110,
height: 48,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center'
},
});