React-Native-Navigation [V3],返回上一页

时间:2019-10-23 11:45:38

标签: react-native react-native-navigation

请帮助,我将首先通过显示代码进行解释:

home.js

onHelpPagePress() {
    Promise.all([
      AntDesign.getImageSource('arrowleft', 25)
    ]).then((sources) => {
      Navigation.setRoot({
        root: {
          stack: {
            children: [{
              component: {
                name: 'projectName.HelpPage',
                options: {
                  topBar: {
                    title: {
                      text: 'Screen Name 1',
                    },
                    drawBehind: false,
                    leftButtons: [
                      {
                        id: 'backButton',
                        enabled: true,
                        showAsAction: 'ifRoom',
                        component: {
                          name: 'projectName.Home',
                          passProps: {
                            color: 'white',
                            // pass event here
                          }
                        },
                        icon: sources[0],
                        color: 'white',
                      },
                    ],
                  }
                }
              },
            }]
          }
        }
      });
    });
  }

它看起来像这样:

------------------------------------
<- Screen Name 1
------------------------------------

如何访问新屏幕中的后退按钮?
有人可以帮我转到上一个屏幕吗?

谢谢

1 个答案:

答案 0 :(得分:0)

使用navigation.showmodal修复此问题