Commit d2b67e99 authored by Neosoulink's avatar Neosoulink
Browse files

feat: link search screens with mechant screen

parent 6ff9e3ce
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ import React from 'react';
import { View, ActivityIndicator, StyleSheet, ScrollView } from 'react-native';
import { Button, TextInput, Title, Text } from 'react-native-paper';
import { useLazyQuery } from '@apollo/client';
import { useNavigation } from '@react-navigation/native';
// tslint:disable-next-line: no-implicit-dependencies no-submodule-imports
import MaterialIcon from '@expo/vector-icons/MaterialCommunityIcons';
import { debounce } from 'lodash';
@@ -38,6 +39,9 @@ import {
} from '../../assets/ts/styles';

function MerchantsSearch({}) {
	// NAVIGATION
	const NAVIGATION = useNavigation();

	// SELECTORS
	const LANGUAGE = useAppSelector(getLanguage);
	const USER_DATA = useAppSelector(getUserData);
@@ -106,6 +110,18 @@ function MerchantsSearch({}) {
		[],
	);

	const onPressMerchant = (warehouseId: string) => {
		if (!isEmpty(warehouseId)) {
			const ROUTE_WAREHOUSE_ID = {
				warehouseId,
			};
			NAVIGATION.navigate(
				'DRAWER/IN_STORE' as never,
				ROUTE_WAREHOUSE_ID as never,
			);
		}
	};

	// EFFECTS
	React.useEffect(() => {
		debouncedFetchData(searchedValue);
@@ -200,7 +216,7 @@ function MerchantsSearch({}) {
							indicatorIconProps={{ name: 'chevron-right' }}
							height={65}
							style={GS.mb2}
							onPress={() => {}}
							onPress={() => onPressMerchant(_item.id)}
						/>
					))}
				</ScrollView>
+20 −1
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ import { View, ActivityIndicator, StyleSheet, ScrollView } from 'react-native';
import { TextInput, Title, Text } from 'react-native-paper';
import { useLazyQuery } from '@apollo/client';
import { debounce } from 'lodash';
import { useNavigation } from '@react-navigation/native';

// TYPES/INTERFACES
import type {
@@ -14,6 +15,9 @@ import type {
	ProductInfoInterface,
} from '../../client/products/argumentInterfaces';

// HELPERS
import { isEmpty } from '../../helpers/utils';

// STORE
import { useAppSelector } from '../../store/hooks';
import { getUserData } from '../../store/features/user';
@@ -39,6 +43,9 @@ import {
} from '../../assets/ts/styles';

function SearchScreen({}) {
	// NAVIGATION
	const NAVIGATION = useNavigation();

	// SELECTORS
	const LANGUAGE = useAppSelector(getLanguage);
	const USER_DATA = useAppSelector(getUserData);
@@ -126,6 +133,18 @@ function SearchScreen({}) {
		[],
	);

	const onPressMerchant = (warehouseId: string) => {
		if (!isEmpty(warehouseId)) {
			const ROUTE_WAREHOUSE_ID = {
				warehouseId,
			};
			NAVIGATION.navigate(
				'DRAWER/IN_STORE' as never,
				ROUTE_WAREHOUSE_ID as never,
			);
		}
	};

	// EFFECTS
	React.useEffect(() => {
		debouncedFetchData(searchedValue);
@@ -217,7 +236,7 @@ function SearchScreen({}) {
								indicatorTextSize={CS.FONT_SIZE}
								height={65}
								style={GS.mb2}
								onPress={() => {}}
								onPress={() => onPressMerchant(_item?.id)}
							/>
						))}
					</View>