首页 > 解决方案 > RNRF - Actions.popTo 失败:“使用未知的 routeName 调用”

问题描述

库版本

"react-native-router-flux": 4.1.0-beta.4  
"react": "16.8.3",  
"react-native": "^0.59.9"

我试图打电话Actions.popTo(sceneKey),但它给了popTo called with an unknown routeName: pulsaScreen。我想要弹出的愿望屏幕是pulsaScreen

当我登录Actions.prevState.routes并给出结果时:

[ { params: 
     { error: '',
       navigationBarStyle: { backgroundColor: '#FD6542', borderBottomWidth: 0 },
       leftButtonType: 'GO_TO_HOME_BUTTON',
       rightButtonType: 'CHAT_BUTTON_WITHOUT_LABEL',
       title: 'Beli Pulsa',
       navTransparent: false,
       titleStyle: 
        { .... },
       renderBackButton: null,
       renderLeftButton: 
        { '$$typeof': {},
          ... },
       renderRightButton: 
        { '$$typeof': {},
          ... },
       init: true,
       product_type: 1,
       type: 'reset',
       routeName: 'pulsaScreen' },
    routeName: 'pulsaScreen',
    key: 'id-1572259438287-3' },
  { params: 
     { error: '',
       navigationBarStyle: { backgroundColor: '#FD6542', borderBottomWidth: 0 },
       leftButtonType: 'BACK_BUTTON',
       rightButtonType: 'CHAT_BUTTON_WITHOUT_LABEL',
       title: 'Review',
       navTransparent: false,
       titleStyle: 
        { ... },
       renderBackButton: null,
       renderLeftButton: 
        { '$$typeof': {},
          .... },
       renderRightButton: 
        { '$$typeof': {},
          ... },
       init: true,
       routeName: 'reviewPulsaScreen' },
    routeName: 'reviewPulsaScreen',
    key: 'id-1572259438287-4' },
  { params: 
     { error: '',
       navigationBarStyle: { backgroundColor: '#FD6542', borderBottomWidth: 0 },
       title: 'Masukkan Pin',
       leftButtonType: 'BACK_BUTTON',
       rightButtonType: 'CHAT_BUTTON_WITHOUT_LABEL',
       navTransparent: false,
       titleStyle: 
        { .... },
       renderBackButton: null,
       renderLeftButton: 
        { '$$typeof': {},
          ... },
       renderRightButton: 
        { '$$typeof': {},
          ... },
       init: true,
       routeName: 'pinInputScene' },
    routeName: 'pinInputScene',
   ...
    key: 'id-1572259438287-5' 

pulsaScreen存在于我记录的路由堆栈上。

任何想法?

标签: react-nativerouterflux

解决方案


直到现在,我都不知道答案。但是,我不小心使用Actions.jump()了它,它按我的预期工作。

虽然,在文档中,Actions.jump()只能用于Tab


推荐阅读