nativescript-community / ui-drawer

NativeScript plugin that allows you to easily add a side drawer (side menu) to your projects.
https://nativescript-community.github.io/ui-drawer/
Apache License 2.0
24 stars 12 forks source link

iOS Safe Area Bottom Drawer Fix #10

Closed keerl closed 3 years ago

keerl commented 3 years ago

Attempted to fix this issue: https://github.com/nativescript-community/ui-drawer/issues/9 and updated the Vue demo.

Not sure how proper this fix is.

I created an additional height offset that is Application.ios.window.safeAreaInsets.bottom that adds to the height if it is iOS. Also forced rounding up with ceil because if it rounds down you will see a little bit of the view.

farfromrefug commented 3 years ago

@keerl that actually sounds really nice! could you try in landscape before i merge and release this?

keerl commented 3 years ago

Good call, the same issue happens in landscape mode but now with right/left drawers not bottom. The interesting thing is that there are 2 different landscape modes (top of left side and top on right side) and the safe area offset will be different depending on the way the device is being held. I'll have to experiment with this and figure out the best solution.

keerl commented 3 years ago

That turned out to be easier than I thought. The left/right safe area size are the same when in landscape mode which isn't obvious to see visually with a notch on the phone. Anyways, used the left offset value in landscape mode. Let me know if that works for you.

keerl commented 3 years ago

@farfromrefug you good with merging this?

farfromrefug commented 3 years ago

I was just wondering if it would be best to check for device orientation to apply the "right" value. don't think left and right will alwaya be the same

keerl commented 3 years ago

Looks like there is a UIDeviceOrientation.LandscapeLeft and UIDeviceOrientation.LandscapeRight so it should be straightforward to check actually. How do I actually get what the orientation value is though?

farfromrefug commented 3 years ago

@keerl ios:

const deviceOrientation = UIDevice.currentDevice.orientation;
keerl commented 3 years ago

okay how does that look? checking the orientation now

farfromrefug commented 3 years ago

seems good !