-
Notifications
You must be signed in to change notification settings - Fork 2
/
CustomHeader.js
63 lines (59 loc) · 1.32 KB
/
CustomHeader.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
import React from 'react';
import {
StyleSheet,
TouchableOpacity,
View,
Text,
SafeAreaView,
} from 'react-native';
import {DrawerActions} from '@react-navigation/native';
function CustomHeader(props) {
const toggleDrawer = () =>
props.navigation.dispatch(DrawerActions.toggleDrawer());
return (
<SafeAreaView>
<View style={styles.headerContainer}>
<View style={styles.headerLeft}>
<TouchableOpacity
onPress={toggleDrawer}
style={styles.leftButton}
testID="CustomHeader-toggleDrawer">
<Text style={styles.buttonTxt}>MENU</Text>
</TouchableOpacity>
</View>
<View style={styles.header}>
<Text style={styles.headerTxt}>HEADER</Text>
</View>
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
headerContainer: {
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
backgroundColor: '#222222',
minHeight: 40,
},
headerLeft: {
flexDirection: 'row',
},
leftButton: {
marginLeft: 10,
},
header: {
flex: 1,
flexDirection: 'row',
justifyContent: 'center',
paddingRight: 40,
},
buttonTxt: {
color: '#ddd',
fontWeight: 'bold',
},
headerTxt: {
color: '#ddd',
},
});
export default CustomHeader;