import React from 'react'; import { PlaceholderLine } from 'rn-placeholder'; import { View, ScrollView, Platform } from 'react-native'; import { useTheme } from 'styled-components/native'; import { useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation'; import { BusinessList as BusinessesListingController, useLanguage, useOrder, } from 'ordering-components/native'; import { ListWrapper, CardsContainer, WrapperList } from './styles'; import { NotFoundSource } from '../NotFoundSource'; import { BusinessController } from '../BusinessController'; import { OText } from '../shared'; import { LogoutButton } from '../LogoutButton'; const BusinessesListingUI = (props: any) => { const { navigation, businessesList, paginationProps, handleBusinessClick, } = props; const theme = useTheme(); const [, t] = useLanguage(); const [orderState] = useOrder(); const [orientationState] = useDeviceOrientation(); const WIDTH_SCREEN = orientationState?.dimensions?.width return ( {!businessesList.loading ? ( <> {t('STORES', 'Stores')} {t('SELECT_STORE_MESSAGE', 'Please select the store that do you need')} ) : ( )} {!businessesList.loading && businessesList.businesses?.map( (business: any) => ( ) )} {!businessesList.loading && businessesList.businesses.length === 0 && paginationProps.totalPages !== null && ( )} {businessesList.loading && ( {[...Array(24).keys()].map(i => ( ))} )} ); }; export const BusinessesListing = (props: any) => { const BusinessesListingProps = { ...props, isForceSearch: Platform.OS === 'ios', UIComponent: BusinessesListingUI, }; return ; };