我是 React-Native 的新手,我试图在单击按钮后从一个屏幕移动到另一个屏幕

I'm new to React-Native and i was trying to move from one screen to another after a button is clicked

当我尝试导航到另一个屏幕时收到错误

undefined 不是对象(正在评估“_this.props.navigation.navigate”)

您可以在这里找到整个项目:

https://snack.expo.io/@nadamabrouk/mobile-flash-cards

在DeckList.js中,您需要将导航传递给子道具

{Object.values(entries).map((entry, index) => {
          return (
            <DeckDetail
              navigation={this.props.navigation}
              key={index}
              entry={entry}
            />
          );
})}

并且在 onPress 处理程序中它应该是 DeckView 而不是 Deckview

onPress={() => this.props.navigation.navigate("DeckView")}