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

ios self.navigationController is nil #17095

Closed
plimerence opened this issue Dec 6, 2017 · 2 comments
Closed

ios self.navigationController is nil #17095

plimerence opened this issue Dec 6, 2017 · 2 comments
Labels
Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@plimerence
Copy link

Is this a bug report?

(write your answer here)
Yes

Have you read the Contributing Guidelines?

(Write your answer here.)
NO

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 8.5.0
Yarn: 1.1.0
npm: 5.5.1
Watchman: 4.9.0
Xcode: Xcode 9.1 Build version 9B55
Android Studio: Not Found

Packages: (wanted => installed)
react: 16.0.0-beta.5 => 16.0.0-beta.5
react-native: 0.49.3 => 0.49.3

Steps to Reproduce

(Write your steps here:)

1.i put a rootView in a ios ViewController
2. i push Viewcontroller ,and RCT_EXPORT_MODULE()
3.but i can't pop back because self.navigationController is nil
RNViewController *webVC = [[RNViewController alloc] init]; NSURL *jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.bundle?platform=ios"]; RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL : jsCodeLocation moduleName : @"root" initialProperties : @{@"scores" : @[@{@"name" : @"Alex",@"value": @"42"},@{@"name" : @"Joel",@"value": @"10"}]} launchOptions: nil]; webVC.view = rootView; [self.navigationController pushViewController:webVC animated:YES];

RCT_EXPORT_MODULE() RCT_EXPORT_METHOD(pop) { dispatch_async(dispatch_get_main_queue(), ^{ // JFNavigationController *nav = [UIApplication sharedApplication].keyWindow.rootViewController.childViewControllers[4]; // [nav popViewControllerAnimated:YES]; [self.navigationController popViewControllerAnimated:YES]; }); }

Expected Behavior

i can pop back

(Write what you thought would happen.)

Actual Behavior

it can't pop back

(Write what happened. Add screenshots!)

i create a pure ViewController with of RCT_EXPORT_MODULE() and RCT_EXPORT_METHOD(pop),and i can get self.navigationController,it make me confuse ,what the RCT_EXPORT_MODULE() do ? where i can get my navigationController.

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

@jain-a
Copy link

jain-a commented Jan 19, 2018

same behavior on my side.

@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?

I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.

How to ContributeWhat to Expect from Maintainers

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon. labels Feb 24, 2018
@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

3 participants