11import * as React from 'react'
2- import { Animated , StyleSheet , SafeAreaView } from 'react-native'
2+ import { Animated , StyleSheet } from 'react-native'
33import { Appbar , Button } from 'react-native-paper'
44
55import { useHeaderTextColor } from '../utils'
66import { getTranslation } from '../translations/utils'
7+ import { useSafeAreaInsets } from 'react-native-safe-area-context'
78
89export interface DatePickerModalHeaderProps {
910 disableSafeTop ?: boolean
@@ -22,38 +23,47 @@ export default function DatePickerModalHeader(
2223 const { disableSafeTop, locale, closeIcon = 'close' } = props
2324 const saveLabel = props . saveLabel || getTranslation ( locale , 'save' )
2425 const color = useHeaderTextColor ( )
26+ const insets = useSafeAreaInsets ( )
27+
28+ // safeContent: {
29+ // paddingBottom: 0,
30+ // },
31+ // safeContentNoTop: {
32+ // paddingTop: 0,
33+ // },
34+
2535 return (
26- < >
27- < Animated . View style = { styles . animated } >
28- < SafeAreaView
29- style = { [
30- styles . safeContent ,
31- disableSafeTop && styles . safeContentNoTop ,
32- ] }
36+ < Animated . View
37+ style = { [
38+ styles . animated ,
39+ {
40+ paddingTop : disableSafeTop ? 0 : insets . top ,
41+ paddingLeft : insets . left ,
42+ paddingRight : insets . right ,
43+ } ,
44+ ] }
45+ >
46+ < Appbar style = { styles . appbarHeader } >
47+ < Appbar . Action
48+ icon = { closeIcon }
49+ accessibilityLabel = { getTranslation ( locale , 'close' ) }
50+ onPress = { props . onDismiss }
51+ color = { color }
52+ testID = "react-native-paper-dates-close"
53+ />
54+ < Appbar . Content title = { '' } />
55+ < Button
56+ color = { color }
57+ textColor = { color }
58+ onPress = { props . onSave }
59+ disabled = { props . saveLabelDisabled || false }
60+ uppercase = { props . uppercase || true }
61+ testID = "react-native-paper-dates-save"
3362 >
34- < Appbar style = { styles . appbarHeader } >
35- < Appbar . Action
36- icon = { closeIcon }
37- accessibilityLabel = { getTranslation ( locale , 'close' ) }
38- onPress = { props . onDismiss }
39- color = { color }
40- testID = "react-native-paper-dates-close"
41- />
42- < Appbar . Content title = { '' } />
43- < Button
44- color = { color }
45- textColor = { color }
46- onPress = { props . onSave }
47- disabled = { props . saveLabelDisabled || false }
48- uppercase = { props . uppercase || true }
49- testID = "react-native-paper-dates-save"
50- >
51- { saveLabel }
52- </ Button >
53- </ Appbar >
54- </ SafeAreaView >
55- </ Animated . View >
56- </ >
63+ { saveLabel }
64+ </ Button >
65+ </ Appbar >
66+ </ Animated . View >
5767 )
5868}
5969
@@ -62,15 +72,9 @@ const styles = StyleSheet.create({
6272 flex : 1 ,
6373 } ,
6474 animated : {
65- paddingBottom : 0 ,
6675 elevation : 4 ,
6776 } ,
68- safeContent : {
69- paddingBottom : 0 ,
70- } ,
71- safeContentNoTop : {
72- paddingTop : 0 ,
73- } ,
77+
7478 header : {
7579 height : 75 ,
7680 alignItems : 'center' ,
0 commit comments