-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Add view getter on RCTRootView / RCTFabricSurfaceHostingProxyRootView #37310
Conversation
Base commit: 17f8c2d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zoontek Thank you for opening the PR. I'm going to import it and to tag the proper person to review this.
Rather then exposing the whole view, could we perhaps:
- add a Splashscreen property which behaves similarly to the loading View
- Implement it correctly in both the RCTRootView and ProxyView?
Ideally, we would hve the loading view behaves the same, but I can see that in the New Architecture it is used in a completely different way. I think that it would make sense to create a specific property with its own semantic in this case. What do you think?
Plus, could you update the changelog as it is failing in CI?
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@cipolleschi This is an option, but keeping the For old arch, I used: [[NSNotificationCenter defaultCenter] removeObserver:rootView
name:RCTContentDidAppearNotification
object:rootView]; But I think this is kinda fragile (could break with internal changes) and it doesn't exists on new arch. As the goal of An alternative that could be flexible enough without exposing the whole view could be to add |
I understand. It has also been approved internally. So, let's go with this approach! 😉 |
@cipolleschi merged this pull request in 33e0521. |
Summary:
Hi 👋
During the react-native-bootsplash implementation of the new architecture, I noticed a few thing regarding
RCTRootView
/RCTFabricSurfaceHostingProxyRootView
compat.Currently
RCTRootView
inherits fromUIView
, butRCTFabricSurfaceHostingProxyRootView
does not, which this works:But this doesn't:
Because
RCTFabricSurfaceHostingProxyRootView
is an imperfect proxy as it doesn't give access to the underlayingUIView *
. As a solution, I added a prop on both:UIView *view
PS: I'm well aware that
setLoadingView
also exists in both files, but it's currently not usable as the currentisActivityIndicatorViewVisible
/isSurfaceViewVisible
/_activityIndicatorViewFactory
logic inRCTSurfaceHostingView.mm
doesn't work: a situation whereisActivityIndicatorViewVisible == true && isSurfaceViewVisible == false && _activityIndicatorViewFactory != nil
never happen:Changelog:
[iOS] [Added] - Expose a
view
property onRCTRootView
andRCTFabricSurfaceHostingProxyRootView
for splash screen libraries usageTest Plan:
Add this block of code in
AppDelegate.mm
:It should persist the splash screen on both old and new architecture.