LandingPageNavigator.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. const Drawer = createDrawerNavigator();
  13. const LandingPageNavigator = () => {
  14. const isLargeScreen = metrics.screenWidth >= 768;
  15. if (
  16. Platform.OS === 'android' &&
  17. UIManager.setLayoutAnimationEnabledExperimental
  18. ) {
  19. UIManager.setLayoutAnimationEnabledExperimental(true);
  20. }
  21. return (
  22. <Drawer.Navigator
  23. initialRouteName="LandingPage"
  24. screenOptions={{
  25. drawerType: 'front',
  26. drawerStyle: isLargeScreen ? null : { width: '100%' },
  27. }}
  28. drawerContent={({ navigation }) => <SidebarPage navigation={navigation} />}>
  29. <Drawer.Screen
  30. name="LandingPage"
  31. component={LandingPage}
  32. options={({ navigation }) => ({
  33. headerShown: true,
  34. header: () => (
  35. <NewscoutHomeHeader>
  36. <View style={{alignItems:'center',flexDirection: 'row',gap: 16}}>
  37. <TouchableWithoutFeedback onPress={null}>
  38. <MaterialIcon name='notifications-none' color={colors.tertiaryColor} size={30} />
  39. </TouchableWithoutFeedback>
  40. <TouchableWithoutFeedback onPress={() => navigation.toggleDrawer()}>
  41. <MaterialIcon name='list' color={colors.topColor} size={30} />
  42. </TouchableWithoutFeedback>
  43. </View>
  44. </NewscoutHomeHeader>
  45. ),
  46. })}
  47. />
  48. <Drawer.Screen
  49. name="NewsDetailPage"
  50. component={NewsDetailPage}
  51. options={() =>({
  52. headerShown: false
  53. })}
  54. />
  55. </Drawer.Navigator>
  56. );
  57. };
  58. export default LandingPageNavigator;