feat: expose ref to the underlying View - #775
Merged
Merged
Conversation
janicduplessis
approved these changes
Sep 16, 2026
giaBaoJS
added a commit
to giaBaoJS/react-native-safe-area-context
that referenced
this pull request
Sep 17, 2026
On web the provider always renders a wrapping View, which is not always wanted, for example when the provider is mounted at the root of an app by ExpoRoot. Add an undocumented, unstable opt out that renders children directly instead. Since there is no view to measure when the wrapper is gone, insets and frame fall back to window values, which is the existing behaviour of the branch that runs when the provider element cannot be measured. For the same reason style and the ref added in appandflow#775 have no element to apply to, so ref stays null while the prop is set. The prop is web only. The default path and every other platform are unchanged.
This was referenced Sep 17, 2026
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
Currently the library doesn't expose a
refto the underlying native view. This exposes thereffor React 19+.In my case, I need to use
ref.measureto measure and use layout before paint on the new architecture, which isn't possible withonLayoutEffect. Currently passing the ref technically works on native, but results in a type error.Test Plan
The change is straightforward. I also tested in react-navigation/react-navigation#13251