Skip to content

Will it be Possible to Load RCTRootView Content Synchronously in Fabric? #130

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

Closed
grahammendick opened this issue May 30, 2019 · 4 comments
Closed

Comments

@grahammendick
Copy link

There’s a technical issue with React Native that affects navigation libraries using the underlying native API on iOS. I’m hoping that Fabric will solve the problem.

The problem arises when you try to write React components that change the appearance of the navigation bar. For example, I’m writing a component that adds a search bar to the navigation bar. In the native view I create a UISearchController and assign it to the navigationItem of the new UIViewController. But when I add the component to a scene, the search bar doesn’t show up.

//SearchBarView.m

- (void)didMoveToWindow
{
    [super didMoveToWindow];
    ...
    [self.reactViewController.navigationItem setSearchController:...];
}

iOS expects all changes to the navigation bar to be made during the view-loading phase. Changes made after this (while animating to the new UIViewController) don’t appear. Because of React Native’s asynchronous nature, the view content isn’t created in the view-loading phase and so the didMoveToWindow of the SearchBarView fires too late to make changes to the navigation bar.

Will it be possible in React Native Fabric to load the initial rendered content synchronously, i.e., will the init of the RCTRootView include the rendered content?

- (void)loadView
{
    …
    RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:...];
    self.view = rootView;
}
@grahammendick
Copy link
Author

@thymikee suggested cc'ing @shergin @ericlewis

@kelset
Copy link
Member

kelset commented May 30, 2019

yeah actually, can you close this issue and post your question as a comment here? #4

It will help keeping all the info about Fabric in the same place.

@thymikee
Copy link
Member

Ah we're so bad at moving the issues where they belong, sorry about it!

@grahammendick
Copy link
Author

No worries, thanks all for pointing me in the right direction

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

No branches or pull requests

3 participants