web-ridge / react-native-paper-dates

Smooth and fast cross platform Material Design date and time picker for React Native Paper
https://www.reactnativepaperdates.com
MIT License
637 stars 161 forks source link

iOS statusbar height #354

Closed joeburghard closed 6 months ago

joeburghard commented 7 months ago

Current behaviour

Greetings! I'm seeing an issue within iOS devices for DatePickerModal where the modal is under the statusbar. The view that's styling the top of the modal to provide space is doing the following.

Screenshot 2023-11-15 at 9 52 46 AM

This works all but for ios. Looking further into react native docs the StatusBar.currentHeight is strictly android and returns undefined for iOS.

Expected behaviour

The expected behaviour is the header of DatePickerModal should be directly under statusbar without disabling statusbar padding

How to reproduce?

Using the latest versions of react-native-paper( 5.11.1 ) and react-native-paper-dates( 0.20.04 ) create the react-native-paper-dates-range-picker example from docs and launch through iPhone14 simulator or real device.

Preview

Screenshot 2023-11-15 at 9 49 02 AM

What have you tried so far?

Your Environment

software version
ios x
android x
react-native x.x.x
react-native-paper x.x.x
node x.x.x
npm or yarn x.x.x
expo sdk x.x.x
iM-GeeKy commented 7 months ago

Can you verify if this fixes the problem? https://github.com/web-ridge/react-native-paper-dates/pull/352 I need to review and merge it once the pipeline succeeds.

joeburghard commented 7 months ago

Unfortunately that did not work either. I've found success using StatusBarManager.getHeight(({ height }: { height: number }) => { setIOSHeight(height) });

RichardLindhout commented 6 months ago

I think we need to use react-native-safe-area-context always and not the other solutions. But it looks like some people do not have correctly configured this library.

When it's configured well it looks like it's now applied 2 two times. Scherm­afbeelding 2023-12-07 om 17 47 37

https://snack.expo.dev/@richardlindhout/react-native-paper-dates-ios-statusbar?platform=android

RichardLindhout commented 6 months ago

Also the safe area should be disabled when presentation mode is sheet + color should be better based on same logic as headerBackgroundColor

joeburghard commented 6 months ago

@RichardLindhout Still not getting the desired result. I upgraded my dependencies and tested using the range example in the documentation

 "react-native-paper": "^5.10.0",
 "react-native-paper-dates": "^0.18.12",
 "react-native-safe-area-context": "4.5.0"
Screenshot 2023-12-20 at 10 01 21 AM
RichardLindhout commented 6 months ago

@joeburghard do you have safe-area-context correctly configured?

RichardLindhout commented 6 months ago
Scherm­afbeelding 2023-12-21 om 19 50 08 Scherm­afbeelding 2023-12-21 om 19 50 30 Scherm­afbeelding 2023-12-21 om 19 52 37 Scherm­afbeelding 2023-12-21 om 19 52 44 Scherm­afbeelding 2023-12-21 om 19 52 59
RichardLindhout commented 6 months ago

New release soon avalailable!