简体   繁体   English

如何使用反应导航?

[英]How to use react-navigation?

I have a typescript code.我有一个打字稿代码。 When I pressed to button of Transportations, navigation is not working.当我按下交通按钮时,导航不起作用。 How to use react-navigation?如何使用反应导航?

In the same directory, I have 'Transportations' folder with index.tsx file.在同一目录中,我有带有 index.tsx 文件的“Transportations”文件夹。 In the index file, I exported by default some View's在索引文件中,我默认导出了一些视图的

<Content padder>
    <HomeItem
      onPress={() => navigation.navigate("Transportations")}
      icon="repeat"
      title={t("routes_transportations")}
    />
    <HomeItem
      onPress={() => navigation.navigate("Vaccination")}
      icon="medkit"
      title={t("routes_vacination")}
    />
    <HomeItem
      onPress={() => navigation.navigate("Sampling")}
      icon="color-filter"
      title={t("routes_sampling")}
    />
</Content>

Nothing will happened什么都不会发生

如果您的屏幕在堆栈导航器或其他反应导航堆栈中,您应该在组件中访问类似this.props.navigation.navigate()导航

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM