2016-07-22 50 views
2

我刚学了几天的react-native。现在我遇到了关于NavigatorIOS组件的问题。我想知道是否有可能在native-objective-c(使用UINavigationController.viewControllers)中获取NavigatorIOS的“子控制器”。我想获得参考并调用一些更新方法。如何让React-native中的'NavigatorIOS'的子控制器参考?

_addNavigator: function (component, title) { 
 

 
    var data = null; 
 

 
    var temp = <NavigatorIOS 
 
     style={{ flex: 1 }} 
 
     barTintColor='#007AFF' 
 
     titleTextColor="#fff" 
 
     tintColor="#fff" 
 
     translucent={false} 
 
     initialRoute={{ 
 
     component: component, 
 
     title: title, 
 
     passProps: { 
 
      data: data 
 
     } 
 
     }}/>; 
 

 
    componentArray.push(temp); 
 

 
    return temp; 
 
    }

回答

0

这是不可能得到在NavigatorIOS子控制器的参考,但我们可以用EventEmitter LIB来满足我们的要求。 EventEmitter类似于NSNotification。欲了解更多信息,请查看链接EventEmitter