import React from 'react'; import { Lifecycle } from '../containers/layout/Lifecycle'; import { LifecyclePhase } from '@workbench-stack/core'; import Animated from 'react-native-reanimated'; import { useAfterInteractions } from '../hooks/use-after-interactions'; import { Spinner, Center } from '@gluestack-ui/themed'; import { Platform } from 'react-native'; import { WithPermissionContainer } from './WithPermission'; import { isUserAuthenticated } from '@adminide-stack/user-auth0-client'; const LoadingComponent = () => (
{}
); const LifecycleComponent = ({ children }: { children?: any }) => { const { authenticated } = isUserAuthenticated(); if (authenticated) { return ( {children} ); } else { return <>{children}; } }; const IntractionComponent = ({ children, interationTime }: { children?: any; interationTime: number }) => { const { interactionsComplete, opacity, setInteractionsTimeOut } = useAfterInteractions(); React.useEffect(() => { if (interationTime) setInteractionsTimeOut(interationTime); }, [interationTime]); return ( <> {interactionsComplete ? ( children ) : ( )} ); }; const IntractionWithLifeCycleComponent = ({ children, interationTime }: { children?: any; interationTime: number }) => { const { interactionsComplete, opacity, setInteractionsTimeOut } = useAfterInteractions(); React.useEffect(() => { if (interationTime) setInteractionsTimeOut(interationTime); }, [interationTime]); return ( <> {interactionsComplete ? ( {children} ) : ( )} ); }; export function withInteractionsManaged(component: any, interationTime?: number, permissionKeys = null) { return ( <> {Platform.OS === 'ios' ? ( <> <>{component} {/* {permissionKeys ? ( {component} ) : ( <>{component} )} */} ) : ( <>{component} {/* {permissionKeys ? ( {component} ) : ( <>{component} )} */} )} ); } export function withLifeCycleInteractionsManaged(component: any, interationTime?: number, permissionKeys = null) { return ( <> {Platform.OS === 'ios' ? ( <>{component} {/* {permissionKeys ? ( {component} ) : ( <>{component} )} */} ) : ( <>{component} {/* {permissionKeys ? ( {component} ) : ( <>{component} )} */} )} ); } export function withLifeCycleManaged(component: any, permissionKeys = null) { return ( <>{component} {/* {permissionKeys ? ( {component} ) : ( <>{component} )} */} ); }