Tôi có một ứng dụng hiện có mà tôi đang làm việc để tích hợp React-Native cho một phần của nó. Tôi là không hiểu được cách 'thoát' phản ứng gốc và quay lại chế độ xem gốc.React-Native: Loại bỏ/Thoát chế độ xem gốc tự nhiên về Native
Dưới đây là một số mã:
// Main objective-c code that bootstraps the react-native view. This view is loaded as a modal view.
MainViewController.m:
- (void)viewDidLoad {
[super viewDidLoad];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"IndexApp" initialProperties:props launchOptions:nil];
rootView.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height-49);
[self.view addSubview:rootView];
}
tôi ban đầu phản ứng quan điểm là như vậy:
render() {
return (
<Navigator
style={styles.container}
...
Tôi có một nút chuột phải nav trên Navigator mà tôi muốn "giải tán" những phản ứng xem và chế độ xem gốc cơ bản của MainViewController.
Tôi đã thử một callback để MainViewController từ quan điểm phản ứng như vậy, nhưng không có avail:
RCT_EXPORT_METHOD(dismiss:(NSString *)name location:(NSString *)location)
{
NSLog(@"dismiss...");
// these don't do anything
//[self dismissViewControllerAnimated:YES completion:nil];
//[self.navigationController popViewControllerAnimated:YES];
// anything with _rootView doesn't do anything, i.e. _rootView removeFromSuperview];
}
Bất kỳ sự giúp đỡ với một cách tiếp cận để 'thoát' quan điểm phản ứng bản địa và trở lại vào quan điểm bản địa sẽ được đánh giá cao.
Xin lỗi, đó dường như không làm việc . – dnstevenson
Có thể Xác nhận điều này không hoạt động, xin lỗi – Tejas