-
-
Notifications
You must be signed in to change notification settings - Fork 835
Expand file tree
/
Copy pathHeaderModal.tsx
More file actions
55 lines (52 loc) · 1.17 KB
/
HeaderModal.tsx
File metadata and controls
55 lines (52 loc) · 1.17 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
import React, { ReactNode } from 'react'
import {
View,
StyleSheet,
ImageSourcePropType,
StyleProp,
ViewStyle,
ImageStyle,
} from 'react-native'
import CloseButton from './CloseButton'
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
alignItems: 'center',
},
})
interface HeaderModalProps {
withFilter?: boolean
withCloseButton?: boolean
closeButtonImage?: ImageSourcePropType
closeButtonStyle?: StyleProp<ViewStyle>
closeButtonImageStyle?: StyleProp<ImageStyle>
onClose: () => void
renderFilter(props: HeaderModalProps): ReactNode
}
export const HeaderModal = (props: HeaderModalProps) => {
const {
withFilter,
withCloseButton,
closeButtonImage,
closeButtonStyle,
closeButtonImageStyle,
onClose,
renderFilter,
} = props
return (
<View style={styles.container}>
{withCloseButton && (
<CloseButton
image={closeButtonImage}
style={closeButtonStyle}
imageStyle={closeButtonImageStyle}
onPress={() => onClose()}
/>
)}
{withFilter && renderFilter(props)}
</View>
)
}
HeaderModal.defaultProps = {
withCloseButton: true,
}