import React, { Suspense } from 'react'; import { Text } from 'react-native'; import { ConsoleLogger as Logger } from '@aws-amplify/core'; import { LaunchArguments } from 'react-native-launch-arguments'; import { EXAMPLE_APP_NAME } from '@env'; /** * `Authenticator` Example and Demo Apps */ const DemoExample = React.lazy( () => import('../features/Authenticator/Demo/Example') ); const BasicExample = React.lazy( () => import('../features/Authenticator/Basic/Example') ); const ComponentExample = React.lazy( () => import('../features/Authenticator/Component/Example') ); const ComponentSlotsExample = React.lazy( () => import('../features/Authenticator/ComponentSlots/Example') ); const FieldsExample = React.lazy( () => import('../features/Authenticator/Fields/Example') ); const LabelHiddenExample = React.lazy( () => import('../features/Authenticator/LabelHidden/Example') ); const SlotsExample = React.lazy( () => import('../features/Authenticator/Slots/Example') ); const StylesExample = React.lazy( () => import('../features/Authenticator/Styles/Example') ); /** * `InAppMessaging` Example and Demo Apps */ const InAppMessaging = React.lazy( () => import('../features/InAppMessaging/Demo/Example') ); /** * `Theming` Example and Demo Apps */ const ThemingExample = React.lazy( () => import('../features/Theming/Basic/Example') ); const DarkModeExample = React.lazy( () => import('../features/Theming/DarkMode/Example') ); /** * `Authenticator` e2e Apps */ const SignInWithEmail = React.lazy( () => import('../ui/components/authenticator/sign-in-with-email/Example') ); const SignInWithPhone = React.lazy( () => import('../ui/components/authenticator/sign-in-with-phone/Example') ); const SignInWithUsername = React.lazy( () => import('../ui/components/authenticator/sign-in-with-username/Example') ); const SignUpWithAttributes = React.lazy( () => import('../ui/components/authenticator/sign-up-with-attributes/Example') ); const SignUpWithEmail = React.lazy( () => import('../ui/components/authenticator/sign-up-with-email/Example') ); const SignUpWithPhone = React.lazy( () => import('../ui/components/authenticator/sign-up-with-phone/Example') ); const SignUpWithUsername = React.lazy( () => import('../ui/components/authenticator/sign-up-with-username/Example') ); const ResetPassword = React.lazy( () => import('../ui/components/authenticator/reset-password/Example') ); const WithAuthenticator = React.lazy( () => import('../ui/components/authenticator/with-authenticator/Example') ); const logger = new Logger('RNExample-logger'); export const ExampleComponent = () => { // .env file or launch argument passed from Detox const APP = EXAMPLE_APP_NAME ?? LaunchArguments.value().EXAMPLE_APP_NAME; switch (APP) { case 'DemoExample': return ; case 'BasicExample': return ; case 'ComponentExample': return ; case 'ComponentSlotsExample': return ; case 'FieldsExample': return ; case 'LabelHiddenExample': return ; case 'SlotsExample': return ; case 'StylesExample': return ; case 'InAppMessaging': return ; case 'ThemingExample': return ; case 'DarkModeExample': return ; // Detox-Cucumber e2e tests // below apps are not meant to be run as example apps, they are part of integration testing in CI case '/ui/components/authenticator/sign-in-with-email': return ; case '/ui/components/authenticator/sign-in-with-username': return ; case 'ui/components/authenticator/sign-in-with-phone': return ; case 'ui/components/authenticator/sign-up-with-email': return ; case 'ui/components/authenticator/sign-up-with-phone/': return ; case 'ui/components/authenticator/sign-up-with-username': return ; case 'ui/components/authenticator/sign-up-with-attributes': return ; case 'ui/components/authenticator/reset-password': return ; case '/ui/components/authenticator/withAuthenticator': return ; case 'ui/components/in-app-messaging/demo': return ; default: logger.warn( 'EXAMPLE_APP_NAME environment variable not configured correctly, running default example app' ); return null; } }; function Example() { return ( Loading...}> ); } export default Example;