javascript - 如何在 React-native 中获取 NavigatorIOS 的 'child controllers' 引用?

标签 javascript ios navigation react-native

刚学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/

相关文章:

php - 使用 javascript 或一些外部网络编码语言运行 apt-get

javascript - 模糊 Angular JS 上的异步验证指令

wpf - 绑定(bind)到使用 ContentPresenter 和 DataTemplates 显示的 ViewModel?

jquery - OnClick 垂直导航

javascript - SnapJS 移动菜单定位

javascript - this.dataset 现在可以在 Chrome 下运行,FF 也会支持它吗?

iphone - 如何在iphone中获取pinchgesture的坐标

ios - uitextview 字体不随 fontWIthName 改变

ios - 是否可以在 Swift 3 中没有自动布局的情况下降低键盘的高度?

react-native - 从导航堆栈中 react native 路由器通量重置场景