react-native-safe-area-context icon indicating copy to clipboard operation
react-native-safe-area-context copied to clipboard

Support "immersive" mode

Open AdamGerthel opened this issue 4 years ago • 8 comments

I'm using react-native-safe-area-context in combination with react-native-android-immersive-mode but the bottom inset value seems to still include the navigation bar height even though it's not there (see official Android docs on "immersive" mode).

Are there plans to support that?

AdamGerthel avatar Mar 14 '20 23:03 AdamGerthel

If you apply the flag LAYOUT_FLAG_NO_LIMITS on top of the other flags it applies, it should no longer read the navbar height, as it moves outside of what the Insets API can read from:

https://developer.android.com/reference/android/view/WindowManager.LayoutParams#FLAG_LAYOUT_NO_LIMITS

crutchcorn avatar Apr 16 '20 18:04 crutchcorn

If someone wants to open a PR to add support I will gladly review it :)

janicduplessis avatar May 26 '20 19:05 janicduplessis

If you apply the flag LAYOUT_FLAG_NO_LIMITS on top of the other flags it applies, it should no longer read the navbar height, as it moves outside of what the Insets API can read from:

https://developer.android.com/reference/android/view/WindowManager.LayoutParams#FLAG_LAYOUT_NO_LIMITS

You saved me, thanks!

Paduado avatar Jun 04 '20 22:06 Paduado

I do not understand the solution from @crutchcorn . Is this fixing the insets when using immersive mode? Where do I have to set the flag?

michaelknoch avatar Mar 10 '22 15:03 michaelknoch

@Paduado I can't figure it out. Where do you add the WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS flag?

niklavsBariss avatar Apr 27 '22 17:04 niklavsBariss

I wrote an article explaining exactly how to do this:

https://unicorn-utterances.com/posts/draw-under-navbar-using-react-native#The-Right-Way

And also a NPM package to handle all of the weird SDK issues that might arise in trying to do this:

https://github.com/oceanbit/react-native-immersive-bars

crutchcorn avatar Apr 28 '22 02:04 crutchcorn

I wrote an article explaining exactly how to do this:

https://unicorn-utterances.com/posts/draw-under-navbar-using-react-native#The-Right-Way

Thank you, but that doesn't seem to be what I am looking for - actually using immersive mode and expecting the inset.bottom (when portrait) to reduce by nav bar height.

niklavsBariss avatar Apr 28 '22 04:04 niklavsBariss

when using immersive mode on android SafeAreaView should apply bottom padding|margin accordingly. ( same behavior as IOS. ).

a-eid avatar May 06 '22 13:05 a-eid