2024-05-12 22:37:30 +02:00
|
|
|
import React, { Suspense, lazy } from 'react';
|
2024-02-24 12:27:17 +01:00
|
|
|
import { NativeStackNavigationOptions, createNativeStackNavigator } from '@react-navigation/native-stack';
|
2024-05-12 22:37:30 +02:00
|
|
|
import { useStorage } from './blue_modules/storage-context';
|
2024-03-11 01:29:37 +01:00
|
|
|
import UnlockWith from './screen/UnlockWith';
|
2024-05-12 22:37:30 +02:00
|
|
|
import { LazyLoadingIndicator } from './navigation/LazyLoadingIndicator';
|
|
|
|
import { isHandset } from './blue_modules/environment';
|
|
|
|
|
|
|
|
const DetailViewScreensStack = lazy(() => import('./navigation/DetailViewScreensStack'));
|
|
|
|
const DrawerRoot = lazy(() => import('./navigation/DrawerRoot'));
|
2024-05-12 17:35:49 +02:00
|
|
|
|
|
|
|
export const NavigationDefaultOptions: NativeStackNavigationOptions = {
|
|
|
|
headerShown: false,
|
|
|
|
presentation: 'modal',
|
|
|
|
headerShadowVisible: false,
|
|
|
|
};
|
|
|
|
export const NavigationFormModalOptions: NativeStackNavigationOptions = {
|
|
|
|
headerShown: false,
|
|
|
|
presentation: 'formSheet',
|
|
|
|
};
|
|
|
|
export const NavigationDefaultOptionsForDesktop: NativeStackNavigationOptions = { headerShown: false, presentation: 'fullScreenModal' };
|
|
|
|
export const StatusBarLightOptions: NativeStackNavigationOptions = { statusBarStyle: 'light' };
|
2020-05-28 10:44:15 +02:00
|
|
|
|
2024-05-12 22:37:30 +02:00
|
|
|
const UnlockStack = createNativeStackNavigator();
|
2020-10-06 12:28:06 +02:00
|
|
|
|
2024-05-12 22:37:30 +02:00
|
|
|
const UnlockRoot = () => {
|
2020-09-08 18:06:41 +02:00
|
|
|
return (
|
2024-05-12 22:37:30 +02:00
|
|
|
<UnlockStack.Navigator screenOptions={{ headerShown: false, animationTypeForReplace: 'push' }}>
|
|
|
|
<UnlockStack.Screen name="UnlockWithScreen" component={UnlockWith} />
|
|
|
|
</UnlockStack.Navigator>
|
2020-09-08 18:06:41 +02:00
|
|
|
);
|
2023-07-25 15:50:04 +02:00
|
|
|
};
|
2024-05-12 22:37:30 +02:00
|
|
|
const MainRoot = () => {
|
|
|
|
const { walletsInitialized } = useStorage();
|
|
|
|
|
|
|
|
const renderRoot = () => {
|
|
|
|
if (!walletsInitialized) {
|
|
|
|
return <UnlockRoot />;
|
|
|
|
} else {
|
|
|
|
// Conditional rendering based on the environment
|
|
|
|
const Component = isHandset ? DetailViewScreensStack : DrawerRoot;
|
|
|
|
return (
|
|
|
|
<Suspense fallback={<LazyLoadingIndicator />}>
|
|
|
|
<Component />
|
|
|
|
</Suspense>
|
|
|
|
);
|
|
|
|
}
|
2024-05-10 03:08:59 +02:00
|
|
|
};
|
2024-05-05 02:14:46 +02:00
|
|
|
|
2024-05-12 22:37:30 +02:00
|
|
|
return renderRoot();
|
2020-12-25 17:09:53 +01:00
|
|
|
};
|
2020-05-27 13:12:17 +02:00
|
|
|
|
2024-05-03 01:05:22 +02:00
|
|
|
export default MainRoot;
|