facebook/react-native

[NavigatorIOS] integration with navigator in existing native app

axelg12 opened this issue · 5 comments

I been integrating React Native into my exiting application and everything has been going well.
By far my biggest problem is combining the exiting Obj-c navigator with React-Native NavigatorIOS.

Is there any way to combine the two, allowing people to navigate from the Obj-C part of the application to the new React-Native part and then back? Something like initializing the NavigatorIOS with routes from the Obj-C part.

Hope this makes a little sense

Regards

You may find the NavigatorIOS's backing viewcontroller and use it in your native code.

Hmm I don't quite understand. Can you give some more details ?

@axelg12 - you'll have a hard time getting support for NavigatorIOS because most React Native developers only use the Navigator component (read about the differences here). @ssssssssssss suggestion seems to be on track, but I'm not sure that I'd recommend using this, it seems like a potentially brittle solution - I think you're better off just using a native obj-c navigator and rendering React Native views in the different routes.

 - (RCTRootView *)sceneReactNavigator {
    UIView *parent = (UIView *)self.reactSuperview;
    while(parent != nil) {
        if([parent.nextResponder isKindOfClass:[UINavigationController class]]) {
            return (RCTRootView *)parent.nextResponder;
        }
        parent = (UIView *)parent.reactSuperview;
    }
    return nil;
}

Find view's backing navigation controller.

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out it's new home: https://productpains.com/post/react-native/navigatorios-integration-with-navigator-in-existing-native-app