-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The library doesn't support edge-to-edge #97
Comments
Did a quick check, the issue exists because you have to handle insets Here, it's super buggy and all and I harcoded the value, but the tab bar has (I think) the correct height: The react-native-safe-area-context codebase could probably help you. |
@zoontek Thanks for your investigation! I will handle it in the library 🙌 |
I got this to work! @zoontek As you are more familiar with the topic, what's a reliable way of checking if edge to edge is enabled? It's the last thing Im struggling with |
@okwasniewski That's the tricky part. As I mentionned in this message, there's no way to properly detect edge-to-edge (see this tweet too). That's why we went for a common library, because at least this is something that could be detected. Are you performing different computation if it's enabled or not (maybe you can inset in all cases, as it's 0 when disabled)? If yes, add import { controlEdgeToEdgeValues, isEdgeToEdge } from "react-native-is-edge-to-edge";
const EDGE_TO_EDGE = isEdgeToEdge();
function TabBar({ navigationBarTranslucent = false }) {
if (__DEV__) {
controlEdgeToEdgeValues({ navigationBarTranslucent });
}
return (
<NativeTabBar
navigationBarTranslucent={EDGE_TO_EDGE || navigationBarTranslucent}
// …
/>
);
} This way, it will just work out-of-the-box for people using |
Thanks for the tip! Looks like this check on the native side I've tested it with your library (enabled and disabled) and this PR: #101 should address this issue. |
@okwasniewski This is really fragile. On Android < 10, Even on newer versions, buttons based navigation isn't transparent: |
Note that if you don't want an extra JS dependency, you can achieve package detection in Kotlin too ( val isSystemBarTransparent = try {
Class.forName("com.zoontek.rnedgetoedge.EdgeToEdgePackage")
true
} catch (exception: ClassNotFoundException) {
window?.navigationBarColor == Color.TRANSPARENT // fallback to best-effort detection
} EDIT: the class check could be a companion object {
val EDGE_TO_EDGE = try {
Class.forName("com.zoontek.rnedgetoedge.EdgeToEdgePackage")
true
} catch (exception: ClassNotFoundException) {
false
}
}
fun yourFn() {
// fallback to best-effort detection
val isSystemBarTransparent = EDGE_TO_EDGE || window?.navigationBarColor == Color.TRANSPARENT
// … |
Thanks @zoontek this check in Kotlin is perfect! Going to add it 👍🏻 |
Thanks for your support @zoontek I also added page in docs describing to install your library in order to enable the support: https://okwasniewski.github.io/react-native-bottom-tabs/docs/guides/edge-to-edge-support.html |
Hello again! 🏓
I have a bad news,
react-native-edge-to-edge
is not at fault at all 😬Having extra themes will be a nice touch to avoid the initial system bars blink (which is only visible if there's no splash screen, as applyEdgeToEdge will probably be called before you app can switch from your
BootTheme
toAppTheme
)To reproduce, I used a blank app with
[email protected]
, as I was not able to quickly understand where are thestyles.xml
andMainActivity.kt
on this repository example app 😅I didn't installed
react-native-edge-to-edge
as I want to reproduction to be as small as possible.It breaks immediately when I set
WindowCompat.setDecorFitsSystemWindows(window, false)
. That's the first step of how to enable edge-to-edge.This is of course used by
react-native-edge-to-edge
, but also by:And probably a lot of other libs.
The reproduction can be found here. And these changes are enough to recreate the issue.
The text was updated successfully, but these errors were encountered: