Skip to content

Commit 44a492d

Browse files
authored
Merge pull request #316 from SoyDiego/fix-modal-jump-on-open
Fixed Datepicker modal jump when is opened
2 parents 0432a88 + ebcb53e commit 44a492d

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/Date/DatePickerModal.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import DatePickerModalContent, {
1414
DatePickerModalContentRangeProps,
1515
DatePickerModalContentSingleProps,
1616
} from './DatePickerModalContent'
17-
import { useHeaderBackgroundColor, useHeaderColorIsLight } from '../utils'
1817
import { useSafeAreaInsets } from 'react-native-safe-area-context'
18+
import { useHeaderBackgroundColor } from '../utils'
1919

2020
interface DatePickerModalProps {
2121
visible: boolean
@@ -66,10 +66,10 @@ export function DatePickerModal(
6666
default: 'slide',
6767
})
6868

69-
const isLight = useHeaderColorIsLight()
69+
const isTransparent = presentationStyle === 'pageSheet' ? false : true
7070
const headerBackgroundColor = useHeaderBackgroundColor()
7171
const insets = useSafeAreaInsets()
72-
const isTransparent = presentationStyle === 'pageSheet' ? false : true
72+
7373
return (
7474
<View style={[StyleSheet.absoluteFill]} pointerEvents="box-none">
7575
<Modal
@@ -103,18 +103,20 @@ export function DatePickerModal(
103103
dimensions.width > 650 ? styles.modalContentBig : null,
104104
]}
105105
>
106-
{disableStatusBar ? null : (
107-
<StatusBar
108-
translucent={true}
109-
barStyle={isLight ? 'dark-content' : 'light-content'}
110-
/>
111-
)}
112106
{disableStatusBarPadding ? null : (
113107
<View
114108
style={[
115109
{
116-
height: insets.top,
117-
backgroundColor: headerBackgroundColor,
110+
height: Platform.select({
111+
ios: StatusBar.currentHeight,
112+
android: StatusBar.currentHeight,
113+
web: insets.top,
114+
}),
115+
backgroundColor: Platform.select({
116+
ios: theme.colors.primary,
117+
android: theme.colors.primary,
118+
web: headerBackgroundColor,
119+
}),
118120
},
119121
]}
120122
/>

0 commit comments

Comments
 (0)