import React from 'react';
import { View, ActivityIndicator } from 'react-native';
import { Slot } from 'expo-router';
import { trpc } from '@/src/trpc-client';
import { MyText, MyTouchableOpacity, tw, AppContainer } from 'common-ui';
import { useRouter } from 'expo-router';
import MaterialIcons from '@expo/vector-icons/MaterialIcons';
import { useGetEssentialConsts } from '@/src/api-hooks/essential-consts.api';
export default function FlashDeliveryBaseLayout() {
const router = useRouter();
const { data: essentialConsts, isLoading } = useGetEssentialConsts();
if (isLoading) {
return (
Loading...
);
}
const isFlashDeliveryEnabled = essentialConsts?.isFlashDeliveryEnabled ?? true;
if (!isFlashDeliveryEnabled) {
return (
Flash Delivery Unavailable
Flash Delivery is not available at the moment. Please opt for a scheduled delivery.
router.replace('/(drawer)/(tabs)/home')}
style={tw`bg-green-500 px-8 py-4 rounded-lg`}
>
Go to Scheduled Delivery
);
}
return ;
}