import * as React from 'react'; import { StackActions } from '@react-navigation/native'; import { createStackNavigator } from '@react-navigation/stack'; import get from 'lodash/get'; import { ObservableResource } from 'observable-hooks'; import { from } from 'rxjs'; import ErrorBoundary from '@wcpos/components/src/error-boundary'; import Suspense from '@wcpos/components/src/suspense'; import Text from '@wcpos/components/src/text'; import AddCustomer from './add-customer'; import Customers from './customers'; import EditCustomer from './edit-customer'; import { useT } from '../../../contexts/translations'; import { ModalLayout } from '../../components/modal-layout'; import { useCollection } from '../hooks/use-collection'; import type { NativeStackScreenProps } from '@react-navigation/native-stack'; export type CustomersStackParamList = { Customers: undefined; AddCustomer: undefined; EditCustomer: { customerID: string }; }; const Stack = createStackNavigator(); /** * */ const CustomersWithProviders = () => { return ( ); }; /** * */ const AddCustomerWithProviders = ({ navigation, }: NativeStackScreenProps) => { const t = useT(); return ( navigation.dispatch(StackActions.pop(1)), }, ]} > ); }; /** * */ const EditCustomerWithProviders = ({ route, navigation, }: NativeStackScreenProps) => { const customerID = get(route, ['params', 'customerID']); const { collection } = useCollection('customers'); const t = useT(); const resource = React.useMemo( () => new ObservableResource(from(collection.findOneFix(customerID).exec())), [collection, customerID] ); return ( navigation.dispatch(StackActions.pop(1)), }, ]} > ); }; /** * */ const CustomersNavigator = () => { return ( ); }; export default CustomersNavigator;