Reputation: 520
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. 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
Upvotes: 1
Views: 56
Reputation: 361
if you have your screen in stack navigator or other react-navigation stacks,you should access navigation like this.props.navigation.navigate()
in your components
Upvotes: 1