如何将UINavigationController与React-Native组件集成

时间:2022-02-16 15:07:05

In my recent work, I use React-Native component as the view part of an iOS app. When I write "full native app", let's say I have button on the view, I click it and the UINavigationController would push in a new ViewController:

在我最近的工作中,我使用React-Native组件作为iOS应用程序的视图部分。当我写“完全本机应用程序”时,假设我在视图上有按钮,我点击它,UINavigationController将推入一个新的ViewController:

 UIButton *btn=[[UIButton alloc]initWithFrame:CGRectMake(60, 60, 200, 60)];    
 btn.backgroundColor=[UIColor greenColor];    
 [btn setTitle:@"btn" forState:UIControlStateNormal];    
 [btn addTarget:self action:@selector(clickme:) forControlEvents:UIControlEventTouchUpInside];    
 ...

 - (void) clickme: (UIButton*) sender{
   [self.navController pushViewController:ANOTHER_VIEW_CONTROLLER animated:YES];
 }

so my question is: how can I do this in a React-Native Component?

所以我的问题是:如何在React-Native组件中执行此操作?

2 个解决方案

#1


0  

this.props.navigator.push({...});

See NavigatorIOS and Navigator for more details.

有关更多详细信息,请参阅NavigatorIOS和Navigator。

#2


0  

I solve this problem and solution is in this issue:https://github.com/facebook/react-native/issues/3324

我解决了这个问题,解决方法就是这个问题:https://github.com/facebook/react-native/issues/3324

lol~

#1


0  

this.props.navigator.push({...});

See NavigatorIOS and Navigator for more details.

有关更多详细信息,请参阅NavigatorIOS和Navigator。

#2


0  

I solve this problem and solution is in this issue:https://github.com/facebook/react-native/issues/3324

我解决了这个问题,解决方法就是这个问题:https://github.com/facebook/react-native/issues/3324

lol~