Advertisement
Badal_hs_shah

Untitled

Jan 12th, 2023
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* eslint-disable prettier/prettier */
  2. import React from 'react';
  3. import {createStackNavigator} from '@react-navigation/stack';
  4. import Login from '@src/screens/LoginScreen';
  5. import StoreList from '@src/screens/StoreListScreen';
  6. import PricecheckList from '@src/screens/PricecheckListScreen';
  7. import {Image, StyleSheet, TouchableOpacity, View} from 'react-native';
  8. import {color} from '../themes/color';
  9. import {useTranslation} from 'react-i18next';
  10.  
  11. const Stack = createStackNavigator();
  12.  
  13. const StoreListScreenOptions = ({title, showBackButton, navigation}) => {
  14.   return {
  15.     headerShown: true,
  16.     headerLeft: () =>
  17.       showBackButton ? (
  18.         <TouchableOpacity onPress={() => navigation.goBack()}>
  19.           <Image
  20.             style={styles.backArrowHeader}
  21.             resizeMode="contain"
  22.             source={require('../../assets/images/Back.png')}
  23.           />
  24.         </TouchableOpacity>
  25.       ) : (
  26.         <View style={styles.storeListLeftHeader}>
  27.           <TouchableOpacity
  28.             style={styles.storeListLeftHeader}
  29.             onPress={() => console.log('Logout button pressed')}>
  30.             <Image
  31.               style={styles.storeListLeftHeader}
  32.               resizeMode="center"
  33.               source={require('../../assets/images/logout.png')}
  34.             />
  35.           </TouchableOpacity>
  36.         </View>
  37.       ),
  38.     headerRight: () => (
  39.       <Image
  40.         style={styles.storeListRightHeader}
  41.         resizeMode="center"
  42.         source={require('../../assets/images/settings.png')}
  43.       />
  44.     ),
  45.     title: title,
  46.   };
  47. };
  48.  
  49. const AppScreens = () => {
  50.   //const showBackButton = useNavigationParam('showBackButton');
  51.   const {t} = useTranslation();
  52.   return (
  53.     <Stack.Navigator>
  54.       <Stack.Screen
  55.         name={'storelist'}
  56.         component={StoreList}
  57.         options={({navigation}) =>
  58.           StoreListScreenOptions({
  59.             title: `${t('PRICECHECK')}`,
  60.             showBackButton: false,
  61.             navigation, //
  62.           })
  63.         }
  64.       />
  65.  
  66.       <Stack.Screen
  67.         name={'pricechecklist'}
  68.         component={PricecheckList}
  69.         options={({navigation}) =>
  70.           StoreListScreenOptions({
  71.             title: `${t('PRICECHECK')}`,
  72.             showBackButton: true,
  73.             navigation, //
  74.           })
  75.         }
  76.       />
  77.     </Stack.Navigator>
  78.   );
  79. };
  80.  
  81. const AuthScreens = () => (
  82.   <Stack.Navigator>
  83.     <Stack.Screen
  84.       name={'Login'}
  85.       component={Login}
  86.       options={{headerShown: false}}
  87.     />
  88.   </Stack.Navigator>
  89. );
  90.  
  91. export {AppScreens, AuthScreens};
  92.  
  93. const styles = StyleSheet.create({
  94.   storeListLeftHeader: {
  95.     alignSelf: 'flex-start',
  96.     tintColor: color.lightTheme.palette.appthemecolor,
  97.   },
  98.   storeListRightHeader: {
  99.     alignSelf: 'flex-end',
  100.     tintColor: color.lightTheme.palette.appthemecolor,
  101.   },
  102.   backArrowHeader: {
  103.     tintColor: color.lightTheme.palette.appthemecolor,
  104.   },
  105. });
  106.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement