-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathPresHeaderIcon.js
More file actions
58 lines (53 loc) · 1.48 KB
/
Copy pathPresHeaderIcon.js
File metadata and controls
58 lines (53 loc) · 1.48 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
import React from 'react'
import { Text, View, StyleSheet } from 'react-native'
import Icon from 'react-native-vector-icons/FontAwesome'
import { ThemeContext } from '~/contexts/theme'
import { useSafeAreaInsets } from 'react-native-safe-area-context'
import BackButton from '~/components/button/BackButton'
import IconButton from '~/components/button/IconButton'
import presStyles from '~/styles/pres'
const PresHeaderIcon = ({ title, subTitle, icon, onPressOption = null, children = null }) => {
const theme = React.useContext(ThemeContext)
const insets = useSafeAreaInsets()
return (
<>
<BackButton />
{
onPressOption ?
<IconButton
icon="ellipsis-h"
onPress={onPressOption}
color={'white'}
style={{
position: 'absolute',
padding: 20,
top: insets.top,
right: insets.left,
zIndex: 1
}}
/> : null
}
<View style={styles.cover}>
<Icon name={icon} size={100} color={'#cd1921'} />
</View>
<View style={presStyles.headerContainer}>
<View style={{ flex: 1 }}>
<Text style={presStyles.title(theme)}>{title}</Text>
<Text style={presStyles.subTitle(theme)}>{subTitle}</Text>
</View>
{children}
</View>
</>
)
}
const styles = StyleSheet.create({
cover: {
width: "100%",
height: 300,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#c68588',
},
})
export default PresHeaderIcon