-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
integrate react-native component with UINavigationController did not work #3324
Comments
It's cool |
I solve this problem by run viewcontroller switch operation on main thread: @implementation POM
RCT_EXPORT_MODULE();
- (dispatch_queue_t)methodQueue
{
return dispatch_get_main_queue();
}
RCT_EXPORT_METHOD(gopagetwo: (NSString *) gopagetwo) {
NSLog(@"123");
AppDelegate *share = (AppDelegate *)[UIApplication sharedApplication].delegate;
UINavigationController *nav = (UINavigationController *) share.window.rootViewController;
PageTwo *pagetwo = [[PageTwo alloc] init];
[nav pushViewController:pagetwo animated:TRUE];
//[share.emitter emit:@"gopagetwo"];
}
@end lol ! |
still not work in my app :( react was error display ... // #import "PrinterManager.h" @implementation PrinterManager RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(gotoPrinterSetting:(RCTResponseSenderBlock)callback) RCTLogInfo(@"gotoPringer");
} 2016-01-16 16:08:34.315 [trace][tid:main][PrinterManager.m:33] gotoPringer |
@jabez128 Answer will work to push to next view controller. And we have to do the operation on the main queue otherwise, it will show some error. |
@jabez128 Just wanted to let you know that I was stuck on this for more than a week and your answer saved my sanity. Thanks! I owe you 20+ beers |
I want combine react-native component with an existing app, and use an react-native component as a view of a viewcontroller. one problem I met is that how to integrate react-native component with UINavigationController. In react-native, I can use the NavigatorIOS or Navigator component, but now that I use react-native component as the view part, I don't want mixin a navigator in the component. so I think if I can solve the problem.
In
AppDelegate.m
file:and then I write a custom module to let js call objective-c method:
and in my react-native component, I require this module and call the
gopagetwo
method.When I run the app, there is no error or warning, and the gopagetwo method is called indeed because the NSLog method did work, but the UINavigationController's pushViewController method doesn't work.
did I do something wrong? any suggestion could help. thx.
The text was updated successfully, but these errors were encountered: