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

[Integration w/ Existing App] How to pass the native navigation controller into a react-native root view component? #1422

Closed
bakso opened this issue May 27, 2015 · 7 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@bakso
Copy link

bakso commented May 27, 2015

I have a navigation controller already, I want to pass the navigation controller into the react-native root view, how to implement this?

@bakso bakso changed the title How to call a react-native component in a native navigation controller? How to pass the native navigation controller to a react-native component? May 28, 2015
@bakso bakso changed the title How to pass the native navigation controller to a react-native component? How to pass the native navigation controller to a react-native root view component? May 28, 2015
@bakso bakso changed the title How to pass the native navigation controller to a react-native root view component? How to pass the native navigation controller into a react-native root view component? May 28, 2015
@bakso
Copy link
Author

bakso commented May 28, 2015

help! help!

@brentvatne
Copy link
Collaborator

Hi @iostalk! Can you explain the use case and provide some sample code for how you would like to use this from the React Native side?

@brentvatne brentvatne changed the title How to pass the native navigation controller into a react-native root view component? [Integration w/ Existing App] How to pass the native navigation controller into a react-native root view component? May 29, 2015
@bakso
Copy link
Author

bakso commented Jun 1, 2015

In MainController.m, I set a ReactRootView instance as a root view, and I have a navigation Controller already in objective-c side:

UIViewController *myViewController = [[MyViewController alloc] init];
navigationController = [[UINavigationController alloc]
                                initWithRootViewController:myViewController];
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
window.rootViewController = navigationController;
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                    moduleName: @"SimpleApp"
                                                 launchOptions:nil];
myViewController.view = rootView;
[window makeKeyAndVisible];

In jsx:

render: function() {
  return (
    <NavigatorIOS
      initialRoute={{
        component: MyView,
        title: 'My View Title',
        passProps: { myProp: 'foo' },
      }}
    />
  );
},
...
this.props.navigator.push(nextRoute); 

My question is, can I get the navigator in the js side?

@brentvatne
Copy link
Collaborator

@iostalk - I haven't tried that myself, this is probably a better question for StackOverflow now that I see it, could you repost it there? If you don't get an answer, ping me here and I can reopen and see if someone on the team can help you. 😄

@axelg12
Copy link

axelg12 commented Aug 26, 2015

@iostalk Did you find out how to get the navigator in the js side ?

@edo1493
Copy link
Contributor

edo1493 commented Sep 30, 2015

I am wondering the same?

@jabez128
Copy link

I meet the similar problem and my solution is in this issue: #3324

wish could help you :)

@facebook facebook locked as resolved and limited conversation to collaborators Jun 1, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants