forked from calebnance/expo-spotify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModalHeader.js
More file actions
80 lines (72 loc) · 1.73 KB
/
ModalHeader.js
File metadata and controls
80 lines (72 loc) · 1.73 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
70
71
72
73
74
75
76
77
78
79
80
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import PropTypes from 'prop-types';
import { colors, device, fonts } from '../api';
// components
import TouchIcon from './TouchIcon';
const ModalHeader = ({ left, leftPress, right, rightPress, style, text }) => (
<View style={[styles.container, style]}>
{left && <TouchIcon icon={left} onPress={leftPress} style={styles.left} />}
{!left && <View style={styles.left} />}
{text && (
<View style={styles.containerText}>
<Text style={styles.text}>{text}</Text>
</View>
)}
{right && (
<TouchIcon icon={right} onPress={rightPress} style={styles.right} />
)}
{!right && <View style={styles.right} />}
</View>
);
ModalHeader.defaultProps = {
left: null,
leftPress: () => null,
right: null,
rightPress: () => null,
style: {},
text: null
};
ModalHeader.propTypes = {
// optional
left: PropTypes.element,
leftPress: PropTypes.func,
right: PropTypes.element,
rightPress: PropTypes.func,
style: PropTypes.oneOfType([
PropTypes.array,
PropTypes.number,
PropTypes.object
]),
text: PropTypes.string
};
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
justifyContent: 'space-between',
paddingHorizontal: 24,
paddingTop: device.iPhoneX ? 48 : 24
},
containerText: {
alignItems: 'center',
flex: 5,
justifyContent: 'center'
},
text: {
color: colors.white,
fontFamily: fonts.spotifyBold,
fontSize: 16,
textAlign: 'center'
},
left: {
alignItems: 'flex-start',
flex: 1,
justifyContent: 'center'
},
right: {
alignItems: 'flex-end',
flex: 1,
justifyContent: 'center'
}
});
export default ModalHeader;