import React from 'react' import { View, ScrollView, useWindowDimensions } from 'react-native'; import { PromotionsController, useLanguage } from 'ordering-components/native'; import { useTheme } from 'styled-components/native'; import { OText, OButton } from '../shared' import { NotFoundSource } from '../NotFoundSource' import { PromotionCard } from '../PromotionCard' import { Container } from './styles' const PromotionsUI = (props: any) => { const { offersState, loadMoreOffers } = props const [, t] = useLanguage(); const theme = useTheme(); const { height } = useWindowDimensions(); return ( {t('PROMOTIONS', 'Promotions')} {!offersState?.error && ( <> {offersState?.offers?.length > 0 && offersState?.offers?.map((offer: any) => ( ))} {offersState?.loading && ( {[...Array(8)].map((_, i) => ( ))} )} {offersState?.pagination?.totalPages && offersState?.pagination?.currentPage < offersState?.pagination?.totalPages && ( )} )} {(offersState?.error || offersState?.offers?.length === 0) && !offersState?.loading && ( )} ) } export const Promotions = (props: any) => { const promotionsProps = { ...props, UIComponent: PromotionsUI, }; return ; };