刚学react-native好几天了,遇到一个关于NavigatorIOS组件的问题。我想知道是否有可能像在 native objective-c(使用 UINavigationController.viewControllers)中一样在 react-native 中获得 NavigatorIOS 的“子 Controller ”。我想获取引用并调用一些更新方法。
_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;
}
最佳答案
在 NavigatorIOS 中无法获取子 Controller 的引用,但我们可以使用 EventEmitter 库来满足我们的要求。 EventEmitter 类似于 NSNotification。有关更多信息,请查看链接 EventEmitter
关于javascript - 如何在 React-native 中获取 NavigatorIOS 的 'child controllers' 引用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38519331/