import React, { useState } from 'react' import { Dimensions, View, StyleSheet } from 'react-native' import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder' import { OButton } from '../shared' import { useTheme } from 'styled-components/native' import { useLanguage } from 'ordering-components/native' export const FooterComponent = (props : any) => { const { loading, reload, pagination, tabsFilter, tabs, loadMore } = props const theme = useTheme() const [, t] = useLanguage() const [orientation, setOrientation] = useState( Dimensions.get('window').width < Dimensions.get('window').height ? 'Portrait' : 'Landscape', ); Dimensions.addEventListener('change', ({ window: { width, height } }) => { if (width < height) { setOrientation('Portrait'); } else { setOrientation('Landscape'); } }); const styles = StyleSheet.create({ loadButton: { borderRadius: 7.6, height: 44, marginRight: 10, marginBottom: 10, marginTop: 5, }, loadButtonText: { color: theme.colors.white, fontFamily: 'Poppins', fontStyle: 'normal', fontWeight: 'normal', fontSize: 18, }, }) return ( <> {(loading || reload) && ( <> {[...Array(5)].map((item, i) => ( ))} )} {pagination?.totalPages && !loading && !reload && JSON.stringify(tabsFilter) === JSON.stringify(tabs[0].tags) && pagination?.currentPage < pagination?.totalPages && ( loadMore && loadMore()} text={t('LOAD_MORE_ORDERS', 'Load more orders')} imgRightSrc={null} textStyle={styles.loadButtonText} style={styles.loadButton} bgColor={theme.colors.primary} borderColor={theme.colors.primary} /> )} ) }