LandingPageNavigator.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. const Drawer = createDrawerNavigator();
  9. const LandingPageNavigator = () => {
  10. const isLargeScreen = metrics.screenWidth >= 768;
  11. if (
  12. Platform.OS === 'android' &&
  13. UIManager.setLayoutAnimationEnabledExperimental
  14. ) {
  15. UIManager.setLayoutAnimationEnabledExperimental(true);
  16. }
  17. return (
  18. <Drawer.Navigator
  19. initialRouteName="LandingPage"
  20. screenOptions={{
  21. drawerType: 'front',
  22. drawerStyle: isLargeScreen ? null : {width: '100%'},
  23. }}
  24. drawerContent={({navigation}) => <SidebarPage navigation={navigation} />}>
  25. <Drawer.Screen
  26. name="LandingPage"
  27. component={LandingPage}
  28. options={({navigation}) => ({
  29. headerShown: true,
  30. header: () => (
  31. <NewscoutHomeHeader onPress={() => navigation.toggleDrawer()} />
  32. ),
  33. })}
  34. />
  35. </Drawer.Navigator>
  36. );
  37. };
  38. export default LandingPageNavigator;