forked from calebnance/expo-spotify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScreenHeader.js
More file actions
69 lines (60 loc) · 1.55 KB
/
Copy pathScreenHeader.js
File metadata and controls
69 lines (60 loc) · 1.55 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { BlurView } from 'expo';
import PropTypes from 'prop-types';
import { Feather } from '@expo/vector-icons';
import { colors, device, fonts, gStyle } from '../api';
// components
import TouchIcon from './TouchIcon';
const ScreenHeader = ({ navigation, showBack, title }) => (
<BlurView tint="dark" intensity={96} style={styles.container}>
{showBack && (
<View style={styles.left}>
<TouchIcon
icon={<Feather color={colors.white} name="chevron-left" />}
onPress={() => navigation.goBack(null)}
/>
</View>
)}
<View style={styles.containerText}>
<Text style={styles.text}>{title}</Text>
</View>
{showBack && <View style={gStyle.flex1} />}
</BlurView>
);
ScreenHeader.defaultProps = {
showBack: false
};
ScreenHeader.propTypes = {
// required
navigation: PropTypes.object.isRequired,
title: PropTypes.string.isRequired,
// optional
showBack: PropTypes.bool
};
const styles = StyleSheet.create({
container: {
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'space-between',
paddingBottom: 16,
paddingHorizontal: 24,
paddingTop: device.iPhoneX ? 48 : 24
},
containerText: {
...gStyle.flex5,
alignItems: 'center',
justifyContent: 'center'
},
text: {
color: colors.white,
fontFamily: fonts.spotifyBold,
fontSize: 16,
textAlign: 'center'
},
left: {
...gStyle.flex1,
alignItems: 'flex-start'
}
});
export default ScreenHeader;