-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.js
More file actions
43 lines (38 loc) · 1.01 KB
/
App.js
File metadata and controls
43 lines (38 loc) · 1.01 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
import * as React from "react";
import {SafeAreaView, View, StyleSheet, Dimensions} from "react-native";
import {TabView, SceneMap} from "react-native-tab-view";
const FirstRoute = () => (
<View style={[styles.scene, {backgroundColor: "#ff4081"}]} />
);
const SecondRoute = () => (
<View style={[styles.scene, {backgroundColor: "#673ab7"}]} />
);
export default class TabViewExample extends React.Component {
state = {
index: 0,
routes: [{key: "first", title: "First"}, {key: "second", title: "Second"}]
};
render() {
return (
<SafeAreaView style={styles.container}>
<TabView
navigationState={this.state}
renderScene={SceneMap({
first: FirstRoute,
second: SecondRoute
})}
onIndexChange={index => this.setState({index})}
initialLayout={{width: Dimensions.get("window").width}}
/>
</SafeAreaView>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1
},
scene: {
flex: 1
}
});