onRightButtonPress React Native undefined 不是对象 NavigatorIOS

onRightButtonPress React Native undefined is not an object NavigatorIOS

这里那里

我的 React Native 代码有问题,我是 React 编程的新手,所以无法正确读取错误:-(
希望有人能帮忙

export default class NavigationBar extends Component {

_handleNavigationRequest = () => {
    this.refs.nav.push({
        component: Settings,
        title: 'Genius',
        passProps: { myProp: 'genius' },
    });
}



render() {
    return (
        <NavigatorIOS barTintColor='#50C26B' titleTextColor='#fff' tintColor='#fff'
            initialRoute={{
                component: Genius,
                title: 'Happy Genius',
                rightButtonTitle: 'Add',
                onRightButtonPress: () => this._handleNavigationRequest(),
            }}
            style={style.navBarStyle}
        />
    );
  }
}

收到错误:undefined 不是一个对象(正在计算 'this.refs.nav.push')

您忘记了 NavigatorIOS 中的 ref 参数

render() {
    return (
        <NavigatorIOS ref='nav' 
            barTintColor='#50C26B' titleTextColor='#fff' tintColor='#fff'
            initialRoute={{
                component: Genius,
                title: 'Happy Genius',
                rightButtonTitle: 'Add',
                onRightButtonPress: () => this._handleNavigationRequest(),
            }}
            style={style.navBarStyle}
        />
    );
  }