LandingPageNavigator.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { View, Text, UIManager, Platform } from 'react-native';
  2. import React from 'react';
  3. import { createDrawerNavigator } from '@react-navigation/drawer';
  4. import LandingPage from '../screens/LandingPage';
  5. import NewscoutHomeHeader from '../components/organisms/Headers/NewscoutHomeHeader';
  6. import metrics from '../theme/metrics';
  7. import SidebarPage from '../screens/SidebarPage';
  8. import { TouchableWithoutFeedback } from 'react-native-gesture-handler';
  9. import MaterialIcon from "react-native-vector-icons/dist/MaterialIcons";
  10. import colors from '../theme/colors';
  11. import NewsDetailPage from '../screens/NewsDetailPage';
  12. import NotificationsPage from '../screens/NotificationsPage';
  13. const Drawer = createDrawerNavigator();
  14. const LandingPageNavigator = () => {
  15. const isLargeScreen = metrics.screenWidth >= 768;
  16. if (
  17. Platform.OS === 'android' &&
  18. UIManager.setLayoutAnimationEnabledExperimental
  19. ) {
  20. UIManager.setLayoutAnimationEnabledExperimental(true);
  21. }
  22. return (
  23. <Drawer.Navigator
  24. initialRouteName="LandingPage"
  25. screenOptions={{
  26. drawerType: 'front',
  27. drawerStyle: isLargeScreen ? null : { width: '100%' },
  28. }}
  29. drawerContent={({ navigation }) => <SidebarPage navigation={navigation} />}>
  30. <Drawer.Screen
  31. name="LandingPage"
  32. component={LandingPage}
  33. options={({ navigation }) => ({
  34. headerShown: true,
  35. header: () => (
  36. <NewscoutHomeHeader>
  37. <View style={{alignItems:'center',flexDirection: 'row',gap: 16}}>
  38. <TouchableWithoutFeedback onPress={() => navigation.navigate('Notifications')}>
  39. <MaterialIcon name='notifications-none' color={colors.tertiaryColor} size={30} />
  40. </TouchableWithoutFeedback>
  41. <TouchableWithoutFeedback onPress={() => navigation.toggleDrawer()}>
  42. <MaterialIcon name='list' color={colors.topColor} size={30} />
  43. </TouchableWithoutFeedback>
  44. </View>
  45. </NewscoutHomeHeader>
  46. ),
  47. })}
  48. />
  49. <Drawer.Screen
  50. name="NewsDetailPage"
  51. component={NewsDetailPage}
  52. options={() =>({
  53. headerShown: false
  54. })}
  55. />
  56. <Drawer.Screen
  57. name="Notifications"
  58. component={NotificationsPage}
  59. options={() =>({
  60. headerShown: false
  61. })}
  62. />
  63. </Drawer.Navigator>
  64. );
  65. };
  66. export default LandingPageNavigator;