-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayground.js
96 lines (89 loc) · 2.99 KB
/
Playground.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import * as React from 'react';
import {View, StyleSheet, Dimensions, StatusBar, Text} from 'react-native';
import {TabView, SceneMap} from 'react-native-tab-view';
import TabBar from "react-native-tab-view/src/TabBar";
import { SearchBar } from 'react-native-elements';
const FirstRoute = () => (
<View style={[styles.scene, {backgroundColor: '#ff4081'}]}/>
);
const SecondRoute = () => (
<View style={[styles.scene, {backgroundColor: '#673ab7'}]}/>
);
export default class Playground extends React.Component {
state = {
index: 0,
routes: [
{key: 'first', title: 'First'},
{key: 'second', title: 'Second'},
],
search: '',
};
updateSearch = search => {
this.setState({ search });
};
render() {
const { search } = this.state;
return (
<View style ={styles.pageContainer}>
<TabView
navigationState={this.state}
renderScene={SceneMap({
first: FirstRoute,
second: SecondRoute,
})}
renderTabBar={props =>
<View style ={{flexDirection :'row', backgroundColor: '#02450D',
}}>
<View style ={{flex: 1, alignItems:'flex-start'}}>
<TabBar
{...props}
indicatorStyle={{backgroundColor: 'white',}}
style={styles.tabBarHeader}
renderLabel={({route, focused}) => (
<View>
<Text
style={styles.tabLabelText}> {route.title} </Text>
</View>
)}
/>
</View>
<View style ={{width: 220}}>
<SearchBar
containerStyle
= {{flex: 1}}
clearIcon
placeholder="Type Here..."
onChangeText={this.updateSearch}
value={search}
cancelButtonTitle = 'Cancel'
/>
</View>
<View/>
</View>
}
onIndexChange={index => this.setState({index})}
initialLayout={{width: Dimensions.get('window').width}}
/>
</View>
);
}
}
const styles = StyleSheet.create({
pageContainer: {
flex: 1,
paddingTop: StatusBar.currentHeight
},
scene: {
flex: 1,
},
tabBarHeader: {
backgroundColor: '#02450D',
paddingVertical: 7,
marginTop: 0.5,
width: Dimensions.get('window').width * 0.3
},
tabLabelText: {
fontSize: 24,
color: 'white'
},
});