I am currently using React-Native-Paper
bottomNavigation. It is working great. However, the next requirement was to add Stack Navigator to individual screens. I have this working on regular bottom-Bar navigation but not able to get it working with React-Native-Paper library.
const SubjectNavigator = createStackNavigator({
Subjects: SubjectScreen,
Topics: TopicListScreen
}, {
navigationOptions: {}
});
const NavigationController = () => {
const [index, setIndex] = React.useState(0);
const [routes] = React.useState([
{ key: 'home', title: 'Home', icon: 'home', color: '#3F51B5' },
{ key: 'subjects', title: 'Subjects', icon: 'book-open', color: '#009688' },
{ key: 'tournaments', title: 'Tournaments', icon: 'trophy', color: '#795548' },
{ key: 'videos', title: 'Video Feeds', icon: 'video', color: '#607D8B' }
]);
const renderScene = BottomNavigation.SceneMap({
home: HomeScreen,
subjects: SubjectScreen,
tournaments: TournamentScreen,
videos: VideoScreen
});
return (
<BottomNavigation
navigationState={{ index, routes }}
onIndexChange={setIndex}
renderScene={renderScene}
/>
);
};
export default NavigationController;
Doing this would give me an error like ---- Can't Find Variable: navigation
when trying to move from one screen to another in the subjectNavigator stack.
Please HELP!!
You could create a stack navigator component that will be used for each of your routes. Then, pass in an
initialRouteName
prop.Then in your
BottomNavigation