Skip to content
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

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

Closed
grahammendick opened this issue May 30, 2019 · 3 comments
Closed
Labels
Bug Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@grahammendick
Copy link
Contributor

grahammendick commented May 30, 2019

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;
}

React Native version:
N/A

Steps To Reproduce

  1. Add a navigation library that uses the underlying native API
  2. Write a component that adds a UISearchController to the navigation bar
  3. You expect the search bar to appear in the navigation bar, but it doesn't
@react-native-bot
Copy link
Collaborator

Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

👉 Click here if you want to take another look at the Bug Report issue template.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Resolution: Needs More Information labels May 30, 2019
@thymikee
Copy link
Contributor

Thanks for raising this question. I think Discussions & Proposals repo is a better place to ask and discuss Fabric related stuff: https://github.com/react-native-community/discussions-and-proposals/issues/.

Can you move it there and cc shergin and ericlewis? These are their github handles, I'm not directly calling them on purpose but you can once this is in a correct place.

@grahammendick
Copy link
Contributor Author

grahammendick commented May 30, 2019

@facebook facebook locked as resolved and limited conversation to collaborators May 30, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label May 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants