Expo Native Views should implement methods for interacting with react native child views #27846
Closed
denisloch
started this conversation in
Proposals and Ideas
Replies: 2 comments 3 replies
-
Hey @denisloch, thank you for reaching out! |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hey, @tsapeta. I also have a similar question. I'm using |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Expo Native Views are really great because they allow developers to create custom native modules where more performance or more customizations are required than what react native has to offer while still utilizing familiar languages such as Swift and Kotlin.
Recently, I came up on a situation where the native views still lack features and so I would like to make a suggestion.
When adding a custom native view which has a react native child, for example:
While the child gets inserted, there is no way of interacting with it on the expo side. In React Native itself,
insertReactSubview
,removeReactSubview
as well asreactSubviews
(for getting all subviews) are called. Unfortunately, this behavior cannot be overwritten in a native expo view. My guess is that expo simply doesn't implement these methods.I would love if these behaviors would exist so we can interact with react native children inside of a native expo view.
In my use case (only tested on iOS), I wanted to create a native scrollview component, as the react native one is lacking in some areas for me. I did that by adding the native scrollview as a subView inside ExpoView's
init
method. The react native children seem to be added on top of the scrollview and when scrolling, they obviously stay fixed in space. If the aforementioned methods were to be implemented, I would be able to overwriteinsertReactSubview
so any time the method is called, the children will instead be added as children to the scrollview instead of some superview.Thank you very much for reading. If any more examples are required, feel free to ask.
Beta Was this translation helpful? Give feedback.
All reactions