Fix issues with inset calculation for apps targeting Android SDK 35+#590
Closed
clangen wants to merge 1 commit intoAppAndFlow:v4-stablefrom
Closed
Fix issues with inset calculation for apps targeting Android SDK 35+#590clangen wants to merge 1 commit intoAppAndFlow:v4-stablefrom
clangen wants to merge 1 commit intoAppAndFlow:v4-stablefrom
Conversation
…Listener instead of onPreDraw() to detect inset values more reliably in SDK35.
Collaborator
|
Hello @clangen, thanks for the PR! I will have a look next week. In the meantime could you just remove any leftover debug logs. |
Author
|
After testing across a wider range of devices this patch does not appear to work comprehensively. I'm going to close the MR for now to avoid confusion. If/when we can figure out a better patch I'll update the code (and remove debugging) then re-open the PR. |
Collaborator
|
Thanks, I will also try to investigate on my end next week. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
We recently ran into an issue with
react-native-safe-area-contextreturning0for top and bottom insets after upgrading our project to Android SDK 35. Turns out others have experienced this issue as well:We addressed this issue by changing the strategy used to resolve the insets; instead of using
ViewTreeObserver.OnPreDrawListenerto detect changes, this commit migrates to usingViewCompat.setOnApplyWindowInsets, which seems to be the preferred way to calculate insets anyway.Note: this is against the 4.x branch, as we are not able to use 5.x yet, although the changes should still be applicable.
Test Plan
N/A