Skip to content

feat: expose ref to the underlying View - #775

Merged
janicduplessis merged 1 commit into
appandflow:mainfrom
satya164:@satya164/ref
Sep 16, 2026
Merged

janicduplessis merged 1 commit into
appandflow:mainfrom
satya164:@satya164/ref

Conversation

@satya164

Copy link
Copy Markdown
Collaborator

Summary

Currently the library doesn't expose a ref to the underlying native view. This exposes the ref for React 19+.

In my case, I need to use ref.measure to measure and use layout before paint on the new architecture, which isn't possible with onLayoutEffect. 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

@janicduplessis
janicduplessis merged commit 81e1437 into appandflow:main Sep 16, 2026
2 checks passed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants