I have my initial screen which works as expected:
function MyTabs() {
return (
<Tab.Navigator>
<Tab.Screen name="Schools" component={MainScreen} />
<Tab.Screen name="Other" component={OtherScreen} />
</Tab.Navigator>
);
}
const Tab = createBottomTabNavigator();
function App() {
return (
<NavigationContainer>
<MyTabs />
</NavigationContainer>
);
}
export default App;
It shows 3 option for screens on the bottom. When I am on the Main
screen I see list of objects, I call them schools. Each school, I render inside a <TouchableOpacity>
tag. Every time I click on this <TouchableOpacity>
tag I want to navigate to a third screen called SchoolDetails.js
. I have the following function, inside a component which I render from the MainScreen
. I call this component SchoolsList
:
const SchoolsList = ({ item, navigation }) => {
...
...
renderItem={({ item }) => {
return (
<TouchableOpacity
onPress={() => navigation.navigate('Details')}
>
<Detail result={item} />
</TouchableOpacity>
);
}}
My question is, how do I tell react that Details
corresponds to SchoolDetails.js
page? I tried to put it inside stacknavigator in the App.js
page but it complained that I already have registered one bottomTabNavigator
inside?
Right now, if I press on the <TouchableOpacity>
tag I get the following error:
The action 'NAVIGATE' with payload {"name":"Details"} was not handled by any navigator.
Do you have a screen named 'Details'?