@kiosinc/commons-rn 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +31 -0
- package/lib/commonjs/auth/api/authentication.js +20 -0
- package/lib/commonjs/auth/api/authentication.js.map +1 -0
- package/lib/commonjs/auth/appLogo.svg +9 -0
- package/lib/commonjs/auth/hooks/useAuthenticateRequests.js +52 -0
- package/lib/commonjs/auth/hooks/useAuthenticateRequests.js.map +1 -0
- package/lib/commonjs/auth/hooks/useAuthentication.js +89 -0
- package/lib/commonjs/auth/hooks/useAuthentication.js.map +1 -0
- package/lib/commonjs/auth/index.js +33 -0
- package/lib/commonjs/auth/index.js.map +1 -0
- package/lib/commonjs/auth/providers/authentication/AuthenticationProvider.js +57 -0
- package/lib/commonjs/auth/providers/authentication/AuthenticationProvider.js.map +1 -0
- package/lib/commonjs/auth/providers/authentication/actions/authentication.actions.js +13 -0
- package/lib/commonjs/auth/providers/authentication/actions/authentication.actions.js.map +1 -0
- package/lib/commonjs/auth/providers/authentication/index.js +50 -0
- package/lib/commonjs/auth/providers/authentication/index.js.map +1 -0
- package/lib/commonjs/auth/providers/authentication/reducer/authentication.reducer.js +21 -0
- package/lib/commonjs/auth/providers/authentication/reducer/authentication.reducer.js.map +1 -0
- package/lib/commonjs/auth/providers/authentication/types/authentication.types.js +11 -0
- package/lib/commonjs/auth/providers/authentication/types/authentication.types.js.map +1 -0
- package/lib/commonjs/auth/screens/LoginScreen.js +131 -0
- package/lib/commonjs/auth/screens/LoginScreen.js.map +1 -0
- package/lib/commonjs/auth/screens/ResetPassword.js +90 -0
- package/lib/commonjs/auth/screens/ResetPassword.js.map +1 -0
- package/lib/commonjs/auth/screens/ResetPasswordInstructionsSent.js +34 -0
- package/lib/commonjs/auth/screens/ResetPasswordInstructionsSent.js.map +1 -0
- package/lib/commonjs/auth/screens/SignUp.js +176 -0
- package/lib/commonjs/auth/screens/SignUp.js.map +1 -0
- package/lib/commonjs/auth/screens/SignUpPassword.js +103 -0
- package/lib/commonjs/auth/screens/SignUpPassword.js.map +1 -0
- package/lib/commonjs/auth/screens/VerifyPhoneNumber.js +95 -0
- package/lib/commonjs/auth/screens/VerifyPhoneNumber.js.map +1 -0
- package/lib/commonjs/auth/screens/index.js +37 -0
- package/lib/commonjs/auth/screens/index.js.map +1 -0
- package/lib/commonjs/auth/screens/validators.js +39 -0
- package/lib/commonjs/auth/screens/validators.js.map +1 -0
- package/lib/commonjs/components/Alert.js +109 -0
- package/lib/commonjs/components/Alert.js.map +1 -0
- package/lib/commonjs/components/Badge.js +20 -0
- package/lib/commonjs/components/Badge.js.map +1 -0
- package/lib/commonjs/components/BottomSheet.js +60 -0
- package/lib/commonjs/components/BottomSheet.js.map +1 -0
- package/lib/commonjs/components/Button.js +20 -0
- package/lib/commonjs/components/Button.js.map +1 -0
- package/lib/commonjs/components/Card.js +19 -0
- package/lib/commonjs/components/Card.js.map +1 -0
- package/lib/commonjs/components/Divider.js +19 -0
- package/lib/commonjs/components/Divider.js.map +1 -0
- package/lib/commonjs/components/FAB.js +19 -0
- package/lib/commonjs/components/FAB.js.map +1 -0
- package/lib/commonjs/components/Header.js +73 -0
- package/lib/commonjs/components/Header.js.map +1 -0
- package/lib/commonjs/components/IconButton.js +19 -0
- package/lib/commonjs/components/IconButton.js.map +1 -0
- package/lib/commonjs/components/Image.js +45 -0
- package/lib/commonjs/components/Image.js.map +1 -0
- package/lib/commonjs/components/KeyboardAvoidingView.js +23 -0
- package/lib/commonjs/components/KeyboardAvoidingView.js.map +1 -0
- package/lib/commonjs/components/LineLoader.js +61 -0
- package/lib/commonjs/components/LineLoader.js.map +1 -0
- package/lib/commonjs/components/LinkButton.js +32 -0
- package/lib/commonjs/components/LinkButton.js.map +1 -0
- package/lib/commonjs/components/OtpInputs.js +97 -0
- package/lib/commonjs/components/OtpInputs.js.map +1 -0
- package/lib/commonjs/components/ParentView.js +81 -0
- package/lib/commonjs/components/ParentView.js.map +1 -0
- package/lib/commonjs/components/Searchbar.js +22 -0
- package/lib/commonjs/components/Searchbar.js.map +1 -0
- package/lib/commonjs/components/SelectionDialog.js +130 -0
- package/lib/commonjs/components/SelectionDialog.js.map +1 -0
- package/lib/commonjs/components/Snackbar.js +69 -0
- package/lib/commonjs/components/Snackbar.js.map +1 -0
- package/lib/commonjs/components/Surface.js +19 -0
- package/lib/commonjs/components/Surface.js.map +1 -0
- package/lib/commonjs/components/Text.js +20 -0
- package/lib/commonjs/components/Text.js.map +1 -0
- package/lib/commonjs/components/TextInput.js +65 -0
- package/lib/commonjs/components/TextInput.js.map +1 -0
- package/lib/commonjs/components/ToggleButton.js +19 -0
- package/lib/commonjs/components/ToggleButton.js.map +1 -0
- package/lib/commonjs/components/Video.js +42 -0
- package/lib/commonjs/components/Video.js.map +1 -0
- package/lib/commonjs/components/View.js +20 -0
- package/lib/commonjs/components/View.js.map +1 -0
- package/lib/commonjs/components/index.js +174 -0
- package/lib/commonjs/components/index.js.map +1 -0
- package/lib/commonjs/index.js +37 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/theme/index.js +43 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/theme.js +126 -0
- package/lib/commonjs/theme/theme.js.map +1 -0
- package/lib/commonjs/theme/tokens.js +204 -0
- package/lib/commonjs/theme/tokens.js.map +1 -0
- package/lib/commonjs/types/index.d.js +2 -0
- package/lib/commonjs/types/index.d.js.map +1 -0
- package/lib/commonjs/types/svg.d.js +2 -0
- package/lib/commonjs/types/svg.d.js.map +1 -0
- package/lib/module/auth/api/authentication.js +11 -0
- package/lib/module/auth/api/authentication.js.map +1 -0
- package/lib/module/auth/appLogo.svg +9 -0
- package/lib/module/auth/hooks/useAuthenticateRequests.js +44 -0
- package/lib/module/auth/hooks/useAuthenticateRequests.js.map +1 -0
- package/lib/module/auth/hooks/useAuthentication.js +81 -0
- package/lib/module/auth/hooks/useAuthentication.js.map +1 -0
- package/lib/module/auth/index.js +5 -0
- package/lib/module/auth/index.js.map +1 -0
- package/lib/module/auth/providers/authentication/AuthenticationProvider.js +45 -0
- package/lib/module/auth/providers/authentication/AuthenticationProvider.js.map +1 -0
- package/lib/module/auth/providers/authentication/actions/authentication.actions.js +6 -0
- package/lib/module/auth/providers/authentication/actions/authentication.actions.js.map +1 -0
- package/lib/module/auth/providers/authentication/index.js +5 -0
- package/lib/module/auth/providers/authentication/index.js.map +1 -0
- package/lib/module/auth/providers/authentication/reducer/authentication.reducer.js +14 -0
- package/lib/module/auth/providers/authentication/reducer/authentication.reducer.js.map +1 -0
- package/lib/module/auth/providers/authentication/types/authentication.types.js +5 -0
- package/lib/module/auth/providers/authentication/types/authentication.types.js.map +1 -0
- package/lib/module/auth/screens/LoginScreen.js +121 -0
- package/lib/module/auth/screens/LoginScreen.js.map +1 -0
- package/lib/module/auth/screens/ResetPassword.js +82 -0
- package/lib/module/auth/screens/ResetPassword.js.map +1 -0
- package/lib/module/auth/screens/ResetPasswordInstructionsSent.js +26 -0
- package/lib/module/auth/screens/ResetPasswordInstructionsSent.js.map +1 -0
- package/lib/module/auth/screens/SignUp.js +168 -0
- package/lib/module/auth/screens/SignUp.js.map +1 -0
- package/lib/module/auth/screens/SignUpPassword.js +95 -0
- package/lib/module/auth/screens/SignUpPassword.js.map +1 -0
- package/lib/module/auth/screens/VerifyPhoneNumber.js +87 -0
- package/lib/module/auth/screens/VerifyPhoneNumber.js.map +1 -0
- package/lib/module/auth/screens/index.js +29 -0
- package/lib/module/auth/screens/index.js.map +1 -0
- package/lib/module/auth/screens/validators.js +31 -0
- package/lib/module/auth/screens/validators.js.map +1 -0
- package/lib/module/components/Alert.js +100 -0
- package/lib/module/components/Alert.js.map +1 -0
- package/lib/module/components/Badge.js +12 -0
- package/lib/module/components/Badge.js.map +1 -0
- package/lib/module/components/BottomSheet.js +52 -0
- package/lib/module/components/BottomSheet.js.map +1 -0
- package/lib/module/components/Button.js +12 -0
- package/lib/module/components/Button.js.map +1 -0
- package/lib/module/components/Card.js +11 -0
- package/lib/module/components/Card.js.map +1 -0
- package/lib/module/components/Divider.js +11 -0
- package/lib/module/components/Divider.js.map +1 -0
- package/lib/module/components/FAB.js +11 -0
- package/lib/module/components/FAB.js.map +1 -0
- package/lib/module/components/Header.js +66 -0
- package/lib/module/components/Header.js.map +1 -0
- package/lib/module/components/IconButton.js +11 -0
- package/lib/module/components/IconButton.js.map +1 -0
- package/lib/module/components/Image.js +35 -0
- package/lib/module/components/Image.js.map +1 -0
- package/lib/module/components/KeyboardAvoidingView.js +15 -0
- package/lib/module/components/KeyboardAvoidingView.js.map +1 -0
- package/lib/module/components/LineLoader.js +52 -0
- package/lib/module/components/LineLoader.js.map +1 -0
- package/lib/module/components/LinkButton.js +24 -0
- package/lib/module/components/LinkButton.js.map +1 -0
- package/lib/module/components/OtpInputs.js +87 -0
- package/lib/module/components/OtpInputs.js.map +1 -0
- package/lib/module/components/ParentView.js +72 -0
- package/lib/module/components/ParentView.js.map +1 -0
- package/lib/module/components/Searchbar.js +14 -0
- package/lib/module/components/Searchbar.js.map +1 -0
- package/lib/module/components/SelectionDialog.js +121 -0
- package/lib/module/components/SelectionDialog.js.map +1 -0
- package/lib/module/components/Snackbar.js +60 -0
- package/lib/module/components/Snackbar.js.map +1 -0
- package/lib/module/components/Surface.js +11 -0
- package/lib/module/components/Surface.js.map +1 -0
- package/lib/module/components/Text.js +12 -0
- package/lib/module/components/Text.js.map +1 -0
- package/lib/module/components/TextInput.js +56 -0
- package/lib/module/components/TextInput.js.map +1 -0
- package/lib/module/components/ToggleButton.js +11 -0
- package/lib/module/components/ToggleButton.js.map +1 -0
- package/lib/module/components/Video.js +32 -0
- package/lib/module/components/Video.js.map +1 -0
- package/lib/module/components/View.js +12 -0
- package/lib/module/components/View.js.map +1 -0
- package/lib/module/components/index.js +25 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/theme/index.js +36 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/theme.js +119 -0
- package/lib/module/theme/theme.js.map +1 -0
- package/lib/module/theme/tokens.js +198 -0
- package/lib/module/theme/tokens.js.map +1 -0
- package/lib/module/types/index.d.js +2 -0
- package/lib/module/types/index.d.js.map +1 -0
- package/lib/module/types/svg.d.js +2 -0
- package/lib/module/types/svg.d.js.map +1 -0
- package/lib/typescript/src/auth/api/authentication.d.ts +4 -0
- package/lib/typescript/src/auth/api/authentication.d.ts.map +1 -0
- package/lib/typescript/src/auth/hooks/useAuthenticateRequests.d.ts +2 -0
- package/lib/typescript/src/auth/hooks/useAuthenticateRequests.d.ts.map +1 -0
- package/lib/typescript/src/auth/hooks/useAuthentication.d.ts +19 -0
- package/lib/typescript/src/auth/hooks/useAuthentication.d.ts.map +1 -0
- package/lib/typescript/src/auth/index.d.ts +5 -0
- package/lib/typescript/src/auth/index.d.ts.map +1 -0
- package/lib/typescript/src/auth/providers/authentication/AuthenticationProvider.d.ts +8 -0
- package/lib/typescript/src/auth/providers/authentication/AuthenticationProvider.d.ts.map +1 -0
- package/lib/typescript/src/auth/providers/authentication/actions/authentication.actions.d.ts +3 -0
- package/lib/typescript/src/auth/providers/authentication/actions/authentication.actions.d.ts.map +1 -0
- package/lib/typescript/src/auth/providers/authentication/index.d.ts +5 -0
- package/lib/typescript/src/auth/providers/authentication/index.d.ts.map +1 -0
- package/lib/typescript/src/auth/providers/authentication/reducer/authentication.reducer.d.ts +3 -0
- package/lib/typescript/src/auth/providers/authentication/reducer/authentication.reducer.d.ts.map +1 -0
- package/lib/typescript/src/auth/providers/authentication/types/authentication.types.d.ts +15 -0
- package/lib/typescript/src/auth/providers/authentication/types/authentication.types.d.ts.map +1 -0
- package/lib/typescript/src/auth/screens/LoginScreen.d.ts +3 -0
- package/lib/typescript/src/auth/screens/LoginScreen.d.ts.map +1 -0
- package/lib/typescript/src/auth/screens/ResetPassword.d.ts +3 -0
- package/lib/typescript/src/auth/screens/ResetPassword.d.ts.map +1 -0
- package/lib/typescript/src/auth/screens/ResetPasswordInstructionsSent.d.ts +8 -0
- package/lib/typescript/src/auth/screens/ResetPasswordInstructionsSent.d.ts.map +1 -0
- package/lib/typescript/src/auth/screens/SignUp.d.ts +9 -0
- package/lib/typescript/src/auth/screens/SignUp.d.ts.map +1 -0
- package/lib/typescript/src/auth/screens/SignUpPassword.d.ts +8 -0
- package/lib/typescript/src/auth/screens/SignUpPassword.d.ts.map +1 -0
- package/lib/typescript/src/auth/screens/VerifyPhoneNumber.d.ts +8 -0
- package/lib/typescript/src/auth/screens/VerifyPhoneNumber.d.ts.map +1 -0
- package/lib/typescript/src/auth/screens/index.d.ts +3 -0
- package/lib/typescript/src/auth/screens/index.d.ts.map +1 -0
- package/lib/typescript/src/auth/screens/validators.d.ts +36 -0
- package/lib/typescript/src/auth/screens/validators.d.ts.map +1 -0
- package/lib/typescript/src/components/Alert.d.ts +19 -0
- package/lib/typescript/src/components/Alert.d.ts.map +1 -0
- package/lib/typescript/src/components/Badge.d.ts +9 -0
- package/lib/typescript/src/components/Badge.d.ts.map +1 -0
- package/lib/typescript/src/components/BottomSheet.d.ts +7 -0
- package/lib/typescript/src/components/BottomSheet.d.ts.map +1 -0
- package/lib/typescript/src/components/Button.d.ts +9 -0
- package/lib/typescript/src/components/Button.d.ts.map +1 -0
- package/lib/typescript/src/components/Card.d.ts +9 -0
- package/lib/typescript/src/components/Card.d.ts.map +1 -0
- package/lib/typescript/src/components/Divider.d.ts +9 -0
- package/lib/typescript/src/components/Divider.d.ts.map +1 -0
- package/lib/typescript/src/components/FAB.d.ts +9 -0
- package/lib/typescript/src/components/FAB.d.ts.map +1 -0
- package/lib/typescript/src/components/Header.d.ts +18 -0
- package/lib/typescript/src/components/Header.d.ts.map +1 -0
- package/lib/typescript/src/components/IconButton.d.ts +9 -0
- package/lib/typescript/src/components/IconButton.d.ts.map +1 -0
- package/lib/typescript/src/components/Image.d.ts +9 -0
- package/lib/typescript/src/components/Image.d.ts.map +1 -0
- package/lib/typescript/src/components/KeyboardAvoidingView.d.ts +9 -0
- package/lib/typescript/src/components/KeyboardAvoidingView.d.ts.map +1 -0
- package/lib/typescript/src/components/LineLoader.d.ts +10 -0
- package/lib/typescript/src/components/LineLoader.d.ts.map +1 -0
- package/lib/typescript/src/components/LinkButton.d.ts +9 -0
- package/lib/typescript/src/components/LinkButton.d.ts.map +1 -0
- package/lib/typescript/src/components/OtpInputs.d.ts +18 -0
- package/lib/typescript/src/components/OtpInputs.d.ts.map +1 -0
- package/lib/typescript/src/components/ParentView.d.ts +19 -0
- package/lib/typescript/src/components/ParentView.d.ts.map +1 -0
- package/lib/typescript/src/components/Searchbar.d.ts +9 -0
- package/lib/typescript/src/components/Searchbar.d.ts.map +1 -0
- package/lib/typescript/src/components/SelectionDialog.d.ts +20 -0
- package/lib/typescript/src/components/SelectionDialog.d.ts.map +1 -0
- package/lib/typescript/src/components/Snackbar.d.ts +15 -0
- package/lib/typescript/src/components/Snackbar.d.ts.map +1 -0
- package/lib/typescript/src/components/Surface.d.ts +9 -0
- package/lib/typescript/src/components/Surface.d.ts.map +1 -0
- package/lib/typescript/src/components/Text.d.ts +13 -0
- package/lib/typescript/src/components/Text.d.ts.map +1 -0
- package/lib/typescript/src/components/TextInput.d.ts +12 -0
- package/lib/typescript/src/components/TextInput.d.ts.map +1 -0
- package/lib/typescript/src/components/ToggleButton.d.ts +9 -0
- package/lib/typescript/src/components/ToggleButton.d.ts.map +1 -0
- package/lib/typescript/src/components/Video.d.ts +4 -0
- package/lib/typescript/src/components/Video.d.ts.map +1 -0
- package/lib/typescript/src/components/View.d.ts +9 -0
- package/lib/typescript/src/components/View.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +25 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/theme/index.d.ts +284 -0
- package/lib/typescript/src/theme/index.d.ts.map +1 -0
- package/lib/typescript/src/theme/theme.d.ts +4 -0
- package/lib/typescript/src/theme/theme.d.ts.map +1 -0
- package/lib/typescript/src/theme/tokens.d.ts +371 -0
- package/lib/typescript/src/theme/tokens.d.ts.map +1 -0
- package/package.json +191 -0
- package/src/auth/api/authentication.ts +13 -0
- package/src/auth/appLogo.svg +9 -0
- package/src/auth/hooks/useAuthenticateRequests.ts +56 -0
- package/src/auth/hooks/useAuthentication.ts +106 -0
- package/src/auth/index.ts +4 -0
- package/src/auth/providers/authentication/AuthenticationProvider.tsx +68 -0
- package/src/auth/providers/authentication/actions/authentication.actions.ts +10 -0
- package/src/auth/providers/authentication/index.ts +4 -0
- package/src/auth/providers/authentication/reducer/authentication.reducer.ts +21 -0
- package/src/auth/providers/authentication/types/authentication.types.ts +17 -0
- package/src/auth/screens/LoginScreen.tsx +140 -0
- package/src/auth/screens/ResetPassword.tsx +85 -0
- package/src/auth/screens/ResetPasswordInstructionsSent.tsx +32 -0
- package/src/auth/screens/SignUp.tsx +176 -0
- package/src/auth/screens/SignUpPassword.tsx +124 -0
- package/src/auth/screens/VerifyPhoneNumber.tsx +100 -0
- package/src/auth/screens/index.tsx +26 -0
- package/src/auth/screens/validators.ts +73 -0
- package/src/components/Alert.tsx +157 -0
- package/src/components/Badge.tsx +50 -0
- package/src/components/BottomSheet.tsx +72 -0
- package/src/components/Button.tsx +47 -0
- package/src/components/Card.tsx +47 -0
- package/src/components/Divider.tsx +47 -0
- package/src/components/FAB.tsx +47 -0
- package/src/components/Header.tsx +123 -0
- package/src/components/IconButton.tsx +47 -0
- package/src/components/Image.tsx +78 -0
- package/src/components/KeyboardAvoidingView.tsx +55 -0
- package/src/components/LineLoader.tsx +70 -0
- package/src/components/LinkButton.tsx +64 -0
- package/src/components/OtpInputs.tsx +149 -0
- package/src/components/ParentView.tsx +164 -0
- package/src/components/Searchbar.tsx +47 -0
- package/src/components/SelectionDialog.tsx +191 -0
- package/src/components/Snackbar.tsx +83 -0
- package/src/components/Surface.tsx +47 -0
- package/src/components/Text.tsx +70 -0
- package/src/components/TextInput.tsx +116 -0
- package/src/components/ToggleButton.tsx +47 -0
- package/src/components/Video.tsx +37 -0
- package/src/components/View.tsx +55 -0
- package/src/components/index.ts +24 -0
- package/src/index.tsx +5 -0
- package/src/theme/index.ts +37 -0
- package/src/theme/theme.ts +125 -0
- package/src/theme/tokens.ts +209 -0
- package/src/types/index.d.ts +1 -0
- package/src/types/svg.d.ts +4 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import React, { useState, useCallback, useEffect } from 'react';
|
|
2
|
+
import { Dialog, RadioButton, Text, useTheme } from 'react-native-paper';
|
|
3
|
+
import { t } from 'i18next';
|
|
4
|
+
import { Button } from './Button';
|
|
5
|
+
import { View } from './View';
|
|
6
|
+
|
|
7
|
+
interface ButtonProps {
|
|
8
|
+
label: string;
|
|
9
|
+
onPress?: (number: number) => void;
|
|
10
|
+
mode?: 'text' | 'outlined' | 'contained' | 'elevated' | 'contained-tonal';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface SelectionDialogParams {
|
|
14
|
+
title?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
isDismissable?: boolean;
|
|
17
|
+
buttons?: ButtonProps[];
|
|
18
|
+
selectionOptions?: Array<string>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface SelectionDialogHandle {
|
|
22
|
+
show: (params: SelectionDialogParams) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const useSelectionDialogHook = () => {
|
|
26
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
27
|
+
const [params, setParams] = useState<SelectionDialogParams>({});
|
|
28
|
+
const {
|
|
29
|
+
title = '',
|
|
30
|
+
description = '',
|
|
31
|
+
isDismissable = true,
|
|
32
|
+
buttons = [],
|
|
33
|
+
selectionOptions = [],
|
|
34
|
+
} = params;
|
|
35
|
+
|
|
36
|
+
const show = useCallback((parameters: SelectionDialogParams) => {
|
|
37
|
+
setParams(parameters);
|
|
38
|
+
setIsVisible(true);
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
const hide = useCallback(() => {
|
|
42
|
+
setIsVisible(false);
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
isVisible,
|
|
47
|
+
show,
|
|
48
|
+
hide,
|
|
49
|
+
title,
|
|
50
|
+
description,
|
|
51
|
+
isDismissable,
|
|
52
|
+
buttons,
|
|
53
|
+
selectionOptions,
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
let rootLevelRef: SelectionDialogHandle | null = null;
|
|
58
|
+
|
|
59
|
+
export const SelectionDialog = () => {
|
|
60
|
+
const {
|
|
61
|
+
isVisible,
|
|
62
|
+
show,
|
|
63
|
+
hide,
|
|
64
|
+
buttons,
|
|
65
|
+
isDismissable,
|
|
66
|
+
selectionOptions,
|
|
67
|
+
title,
|
|
68
|
+
description,
|
|
69
|
+
} = useSelectionDialogHook();
|
|
70
|
+
const theme = useTheme();
|
|
71
|
+
|
|
72
|
+
const [selectedOptionIndex, setSelectedOptionIndex] = useState(0);
|
|
73
|
+
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (isVisible) {
|
|
76
|
+
setSelectedOptionIndex(0);
|
|
77
|
+
}
|
|
78
|
+
}, [isVisible]);
|
|
79
|
+
|
|
80
|
+
const [
|
|
81
|
+
button1 = {
|
|
82
|
+
label: t('ok'),
|
|
83
|
+
onPress: () => {},
|
|
84
|
+
mode: 'text',
|
|
85
|
+
},
|
|
86
|
+
button2,
|
|
87
|
+
button3,
|
|
88
|
+
] = buttons;
|
|
89
|
+
|
|
90
|
+
const ref: any = React.useRef(null);
|
|
91
|
+
|
|
92
|
+
React.useImperativeHandle(
|
|
93
|
+
ref,
|
|
94
|
+
React.useCallback(
|
|
95
|
+
() => ({
|
|
96
|
+
show,
|
|
97
|
+
}),
|
|
98
|
+
[show]
|
|
99
|
+
)
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
React.useEffect(() => {
|
|
103
|
+
rootLevelRef = ref.current;
|
|
104
|
+
}, [ref]);
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<Dialog
|
|
108
|
+
style={{
|
|
109
|
+
backgroundColor: theme.colors.background,
|
|
110
|
+
}}
|
|
111
|
+
dismissable={isDismissable}
|
|
112
|
+
dismissableBackButton={isDismissable}
|
|
113
|
+
onDismiss={() => {
|
|
114
|
+
if (isVisible) {
|
|
115
|
+
hide();
|
|
116
|
+
}
|
|
117
|
+
}}
|
|
118
|
+
visible={isVisible}
|
|
119
|
+
>
|
|
120
|
+
{Boolean(title) && (
|
|
121
|
+
<Dialog.Content>
|
|
122
|
+
<Text variant="titleMedium">{title}</Text>
|
|
123
|
+
</Dialog.Content>
|
|
124
|
+
)}
|
|
125
|
+
{Boolean(description) && (
|
|
126
|
+
<Dialog.Content>
|
|
127
|
+
<Text variant="bodyMedium">{description}</Text>
|
|
128
|
+
</Dialog.Content>
|
|
129
|
+
)}
|
|
130
|
+
<Dialog.Content>
|
|
131
|
+
{selectionOptions.map((option: string, index) => {
|
|
132
|
+
return (
|
|
133
|
+
<View flexDirection="row" alignItems="center">
|
|
134
|
+
<RadioButton.Android
|
|
135
|
+
value=""
|
|
136
|
+
status={selectedOptionIndex === index ? 'checked' : 'unchecked'}
|
|
137
|
+
onPress={() => setSelectedOptionIndex(index)}
|
|
138
|
+
/>
|
|
139
|
+
<Text variant="bodyMedium">{option}</Text>
|
|
140
|
+
</View>
|
|
141
|
+
);
|
|
142
|
+
})}
|
|
143
|
+
</Dialog.Content>
|
|
144
|
+
<Dialog.Actions>
|
|
145
|
+
{button3 && (
|
|
146
|
+
<Button
|
|
147
|
+
mx="8"
|
|
148
|
+
mode={button3?.mode || 'text'}
|
|
149
|
+
onPress={() => {
|
|
150
|
+
hide();
|
|
151
|
+
button3?.onPress?.(selectedOptionIndex);
|
|
152
|
+
}}
|
|
153
|
+
>
|
|
154
|
+
{button3.label}
|
|
155
|
+
</Button>
|
|
156
|
+
)}
|
|
157
|
+
{button2 && (
|
|
158
|
+
<Button
|
|
159
|
+
ml="2"
|
|
160
|
+
mode={button2?.mode || 'text'}
|
|
161
|
+
onPress={() => {
|
|
162
|
+
hide();
|
|
163
|
+
button2?.onPress?.(selectedOptionIndex);
|
|
164
|
+
}}
|
|
165
|
+
>
|
|
166
|
+
{button2?.label}
|
|
167
|
+
</Button>
|
|
168
|
+
)}
|
|
169
|
+
{button1 && (
|
|
170
|
+
<Button
|
|
171
|
+
ml="2"
|
|
172
|
+
mode={button1?.mode || 'text'}
|
|
173
|
+
onPress={() => {
|
|
174
|
+
hide();
|
|
175
|
+
button1?.onPress?.(selectedOptionIndex);
|
|
176
|
+
}}
|
|
177
|
+
>
|
|
178
|
+
{button1.label}
|
|
179
|
+
</Button>
|
|
180
|
+
)}
|
|
181
|
+
</Dialog.Actions>
|
|
182
|
+
</Dialog>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
SelectionDialog.displayName = 'SelectionDialog';
|
|
187
|
+
|
|
188
|
+
//@ts-ignore
|
|
189
|
+
SelectionDialog.show = (params: SelectionDialogParams) => {
|
|
190
|
+
rootLevelRef?.show(params);
|
|
191
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React, { useState, useCallback } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Snackbar as PSnackbar } from 'react-native-paper';
|
|
4
|
+
|
|
5
|
+
interface SnackbarParams {
|
|
6
|
+
title?: string;
|
|
7
|
+
action?: {
|
|
8
|
+
label: string;
|
|
9
|
+
onPress?: () => void;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface AlertHandle {
|
|
14
|
+
show: (params: SnackbarParams) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const useAlertHook = () => {
|
|
18
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
19
|
+
const [params, setParams] = useState<SnackbarParams>({});
|
|
20
|
+
const { title = '', action } = params;
|
|
21
|
+
|
|
22
|
+
const show = useCallback((parameters: SnackbarParams) => {
|
|
23
|
+
setParams(parameters);
|
|
24
|
+
setIsVisible(true);
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
27
|
+
const hide = useCallback(() => {
|
|
28
|
+
setIsVisible(false);
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
isVisible,
|
|
33
|
+
show,
|
|
34
|
+
hide,
|
|
35
|
+
title,
|
|
36
|
+
action,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
let rootLevelRef: AlertHandle | null = null;
|
|
41
|
+
|
|
42
|
+
export const Snackbar = () => {
|
|
43
|
+
const { t } = useTranslation();
|
|
44
|
+
const { isVisible, show, hide, title, action } = useAlertHook();
|
|
45
|
+
|
|
46
|
+
const ref: any = React.useRef(null);
|
|
47
|
+
|
|
48
|
+
React.useImperativeHandle(
|
|
49
|
+
ref,
|
|
50
|
+
React.useCallback(
|
|
51
|
+
() => ({
|
|
52
|
+
show,
|
|
53
|
+
}),
|
|
54
|
+
[show]
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
rootLevelRef = ref.current;
|
|
60
|
+
}, [ref]);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<PSnackbar
|
|
64
|
+
visible={isVisible}
|
|
65
|
+
onDismiss={hide}
|
|
66
|
+
action={
|
|
67
|
+
action ?? {
|
|
68
|
+
label: t('close'),
|
|
69
|
+
onPress: hide,
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
>
|
|
73
|
+
{title}
|
|
74
|
+
</PSnackbar>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
Snackbar.displayName = 'Snackbar';
|
|
79
|
+
|
|
80
|
+
//@ts-ignore
|
|
81
|
+
Snackbar.show = (params: SnackbarParams) => {
|
|
82
|
+
rootLevelRef?.show(params);
|
|
83
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Surface as S, type SurfaceProps } from 'react-native-paper';
|
|
3
|
+
import {
|
|
4
|
+
useRestyle,
|
|
5
|
+
spacing,
|
|
6
|
+
border,
|
|
7
|
+
backgroundColor,
|
|
8
|
+
backgroundColorShorthand,
|
|
9
|
+
type SpacingProps,
|
|
10
|
+
type BorderProps,
|
|
11
|
+
type BackgroundColorProps,
|
|
12
|
+
composeRestyleFunctions,
|
|
13
|
+
type SpacingShorthandProps,
|
|
14
|
+
type LayoutProps,
|
|
15
|
+
type PositionProps,
|
|
16
|
+
spacingShorthand,
|
|
17
|
+
layout,
|
|
18
|
+
position,
|
|
19
|
+
type BackgroundColorShorthandProps,
|
|
20
|
+
} from '@shopify/restyle';
|
|
21
|
+
import { type ThemeType } from '../theme';
|
|
22
|
+
|
|
23
|
+
type RestyleProps = SpacingProps<ThemeType> &
|
|
24
|
+
SpacingShorthandProps<ThemeType> &
|
|
25
|
+
LayoutProps<ThemeType> &
|
|
26
|
+
PositionProps<ThemeType> &
|
|
27
|
+
BorderProps<ThemeType> &
|
|
28
|
+
BackgroundColorProps<ThemeType> &
|
|
29
|
+
BackgroundColorShorthandProps<ThemeType>;
|
|
30
|
+
|
|
31
|
+
const restyleFunctions = composeRestyleFunctions<ThemeType, RestyleProps>([
|
|
32
|
+
spacing,
|
|
33
|
+
spacingShorthand,
|
|
34
|
+
layout,
|
|
35
|
+
position,
|
|
36
|
+
border,
|
|
37
|
+
backgroundColor,
|
|
38
|
+
backgroundColorShorthand,
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
type Props = RestyleProps & SurfaceProps;
|
|
42
|
+
|
|
43
|
+
export const Surface = ({ ...rest }: Props) => {
|
|
44
|
+
const props = useRestyle(restyleFunctions as any, rest);
|
|
45
|
+
|
|
46
|
+
return <S {...props} />;
|
|
47
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text as T, type TextProps } from 'react-native-paper';
|
|
3
|
+
import {
|
|
4
|
+
useRestyle,
|
|
5
|
+
spacing,
|
|
6
|
+
border,
|
|
7
|
+
composeRestyleFunctions,
|
|
8
|
+
type SpacingProps,
|
|
9
|
+
type BorderProps,
|
|
10
|
+
type BackgroundColorProps,
|
|
11
|
+
backgroundColor,
|
|
12
|
+
backgroundColorShorthand,
|
|
13
|
+
color,
|
|
14
|
+
layout,
|
|
15
|
+
position,
|
|
16
|
+
typography,
|
|
17
|
+
spacingShorthand,
|
|
18
|
+
type ColorProps,
|
|
19
|
+
type SpacingShorthandProps,
|
|
20
|
+
type LayoutProps,
|
|
21
|
+
type PositionProps,
|
|
22
|
+
type TypographyProps,
|
|
23
|
+
type BackgroundColorShorthandProps,
|
|
24
|
+
opacity,
|
|
25
|
+
type OpacityProps,
|
|
26
|
+
} from '@shopify/restyle';
|
|
27
|
+
import { type ThemeType } from '../theme';
|
|
28
|
+
import { typescale } from '../theme/tokens';
|
|
29
|
+
|
|
30
|
+
type RestyleProps = ColorProps<ThemeType> &
|
|
31
|
+
SpacingProps<ThemeType> &
|
|
32
|
+
SpacingShorthandProps<ThemeType> &
|
|
33
|
+
LayoutProps<ThemeType> &
|
|
34
|
+
PositionProps<ThemeType> &
|
|
35
|
+
OpacityProps<ThemeType> &
|
|
36
|
+
TypographyProps<ThemeType> &
|
|
37
|
+
BorderProps<ThemeType> &
|
|
38
|
+
BackgroundColorProps<ThemeType> &
|
|
39
|
+
BackgroundColorShorthandProps<ThemeType>;
|
|
40
|
+
|
|
41
|
+
const restyleFunctions = composeRestyleFunctions<ThemeType, RestyleProps>([
|
|
42
|
+
color,
|
|
43
|
+
spacing,
|
|
44
|
+
spacingShorthand,
|
|
45
|
+
layout,
|
|
46
|
+
position,
|
|
47
|
+
opacity,
|
|
48
|
+
typography,
|
|
49
|
+
border,
|
|
50
|
+
backgroundColor,
|
|
51
|
+
backgroundColorShorthand,
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
interface Props extends Omit<RestyleProps & TextProps<any>, 'variant'> {
|
|
55
|
+
variant?: keyof typeof typescale;
|
|
56
|
+
children: React.ReactNode;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const Text: React.FC<Props & TextProps<any>> = ({
|
|
60
|
+
children,
|
|
61
|
+
...rest
|
|
62
|
+
}) => {
|
|
63
|
+
const restyleProps = useRestyle(restyleFunctions, rest);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<T {...(restyleProps as Omit<typeof restyleProps, 'variant'>)}>
|
|
67
|
+
{children}
|
|
68
|
+
</T>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
TextInput as T,
|
|
4
|
+
type TextInputProps,
|
|
5
|
+
ToggleButton,
|
|
6
|
+
useTheme,
|
|
7
|
+
} from 'react-native-paper';
|
|
8
|
+
import { View } from './View';
|
|
9
|
+
import { IconButton } from './IconButton';
|
|
10
|
+
import { Text } from './Text';
|
|
11
|
+
import {
|
|
12
|
+
useRestyle,
|
|
13
|
+
spacing,
|
|
14
|
+
border,
|
|
15
|
+
backgroundColor,
|
|
16
|
+
backgroundColorShorthand,
|
|
17
|
+
type SpacingProps,
|
|
18
|
+
type BorderProps,
|
|
19
|
+
type BackgroundColorProps,
|
|
20
|
+
composeRestyleFunctions,
|
|
21
|
+
type SpacingShorthandProps,
|
|
22
|
+
type LayoutProps,
|
|
23
|
+
type PositionProps,
|
|
24
|
+
spacingShorthand,
|
|
25
|
+
layout,
|
|
26
|
+
position,
|
|
27
|
+
type BackgroundColorShorthandProps,
|
|
28
|
+
} from '@shopify/restyle';
|
|
29
|
+
import { type ThemeType } from '../theme';
|
|
30
|
+
|
|
31
|
+
type RestyleProps = SpacingProps<ThemeType> &
|
|
32
|
+
SpacingShorthandProps<ThemeType> &
|
|
33
|
+
LayoutProps<ThemeType> &
|
|
34
|
+
PositionProps<ThemeType> &
|
|
35
|
+
BorderProps<ThemeType> &
|
|
36
|
+
BackgroundColorProps<ThemeType> &
|
|
37
|
+
BackgroundColorShorthandProps<ThemeType>;
|
|
38
|
+
|
|
39
|
+
const restyleFunctions = composeRestyleFunctions<ThemeType, RestyleProps>([
|
|
40
|
+
spacing,
|
|
41
|
+
spacingShorthand,
|
|
42
|
+
layout,
|
|
43
|
+
position,
|
|
44
|
+
border,
|
|
45
|
+
backgroundColor,
|
|
46
|
+
backgroundColorShorthand,
|
|
47
|
+
]);
|
|
48
|
+
|
|
49
|
+
type Props = RestyleProps &
|
|
50
|
+
TextInputProps & {
|
|
51
|
+
errorMessage?: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const TextInputStyled = ({ ...rest }: Props) => {
|
|
55
|
+
const props = useRestyle(restyleFunctions as any, rest);
|
|
56
|
+
|
|
57
|
+
return <T {...props} />;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const TextInput: React.FC<Props> = ({
|
|
61
|
+
errorMessage,
|
|
62
|
+
secureTextEntry,
|
|
63
|
+
...rest
|
|
64
|
+
}) => {
|
|
65
|
+
const [status, setStatus] = React.useState('checked');
|
|
66
|
+
|
|
67
|
+
const onButtonToggle = () => {
|
|
68
|
+
setStatus(status === 'checked' ? 'unchecked' : 'checked');
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const shouldShowPassword = status === 'checked';
|
|
72
|
+
const theme = useTheme();
|
|
73
|
+
return (
|
|
74
|
+
<View>
|
|
75
|
+
<View justifyContent="center">
|
|
76
|
+
<TextInputStyled
|
|
77
|
+
width="100%"
|
|
78
|
+
secureTextEntry={shouldShowPassword && secureTextEntry}
|
|
79
|
+
{...rest}
|
|
80
|
+
/>
|
|
81
|
+
{secureTextEntry && (
|
|
82
|
+
<View
|
|
83
|
+
pt="4"
|
|
84
|
+
justifyContent="center"
|
|
85
|
+
alignSelf="flex-end"
|
|
86
|
+
position="absolute"
|
|
87
|
+
width={48}
|
|
88
|
+
>
|
|
89
|
+
<ToggleButton
|
|
90
|
+
icon={shouldShowPassword ? 'eye' : 'eye-off'}
|
|
91
|
+
size={20}
|
|
92
|
+
onPress={onButtonToggle}
|
|
93
|
+
/>
|
|
94
|
+
</View>
|
|
95
|
+
)}
|
|
96
|
+
</View>
|
|
97
|
+
|
|
98
|
+
{!!errorMessage && (
|
|
99
|
+
<>
|
|
100
|
+
<View flexDirection="row" alignItems="center" pb="2">
|
|
101
|
+
<IconButton
|
|
102
|
+
icon="alert-circle-outline"
|
|
103
|
+
size={14}
|
|
104
|
+
width={20}
|
|
105
|
+
margin="0"
|
|
106
|
+
iconColor={theme.colors.error}
|
|
107
|
+
/>
|
|
108
|
+
<Text variant="bodySmall" color="error">
|
|
109
|
+
{errorMessage}
|
|
110
|
+
</Text>
|
|
111
|
+
</View>
|
|
112
|
+
</>
|
|
113
|
+
)}
|
|
114
|
+
</View>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ToggleButton as TB, type ToggleButtonProps } from 'react-native-paper';
|
|
3
|
+
import {
|
|
4
|
+
useRestyle,
|
|
5
|
+
spacing,
|
|
6
|
+
border,
|
|
7
|
+
backgroundColor,
|
|
8
|
+
backgroundColorShorthand,
|
|
9
|
+
type SpacingProps,
|
|
10
|
+
type BorderProps,
|
|
11
|
+
type BackgroundColorProps,
|
|
12
|
+
composeRestyleFunctions,
|
|
13
|
+
type SpacingShorthandProps,
|
|
14
|
+
type LayoutProps,
|
|
15
|
+
type PositionProps,
|
|
16
|
+
spacingShorthand,
|
|
17
|
+
layout,
|
|
18
|
+
position,
|
|
19
|
+
type BackgroundColorShorthandProps,
|
|
20
|
+
} from '@shopify/restyle';
|
|
21
|
+
import { type ThemeType } from '../theme';
|
|
22
|
+
|
|
23
|
+
type RestyleProps = SpacingProps<ThemeType> &
|
|
24
|
+
SpacingShorthandProps<ThemeType> &
|
|
25
|
+
LayoutProps<ThemeType> &
|
|
26
|
+
PositionProps<ThemeType> &
|
|
27
|
+
BorderProps<ThemeType> &
|
|
28
|
+
BackgroundColorProps<ThemeType> &
|
|
29
|
+
BackgroundColorShorthandProps<ThemeType>;
|
|
30
|
+
|
|
31
|
+
const restyleFunctions = composeRestyleFunctions<ThemeType, RestyleProps>([
|
|
32
|
+
spacing,
|
|
33
|
+
spacingShorthand,
|
|
34
|
+
layout,
|
|
35
|
+
position,
|
|
36
|
+
border,
|
|
37
|
+
backgroundColor,
|
|
38
|
+
backgroundColorShorthand,
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
type Props = RestyleProps & ToggleButtonProps;
|
|
42
|
+
|
|
43
|
+
export const ToggleButton = ({ ...rest }: Props) => {
|
|
44
|
+
const props = useRestyle(restyleFunctions as any, rest as any);
|
|
45
|
+
|
|
46
|
+
return <TB {...(props as Props)} />;
|
|
47
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { View } from './View';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { ActivityIndicator } from 'react-native-paper';
|
|
4
|
+
import { IconButton } from './IconButton';
|
|
5
|
+
|
|
6
|
+
import VideoOriginal, { type VideoProperties } from 'react-native-video';
|
|
7
|
+
|
|
8
|
+
export const Video = ({ ...rest }: VideoProperties) => {
|
|
9
|
+
const [status, setStatus] = useState<'loading' | 'failed' | 'success'>(
|
|
10
|
+
'loading'
|
|
11
|
+
);
|
|
12
|
+
return (
|
|
13
|
+
<View flex={1}>
|
|
14
|
+
<VideoOriginal
|
|
15
|
+
{...rest}
|
|
16
|
+
onLoad={() => {
|
|
17
|
+
setStatus('success');
|
|
18
|
+
}}
|
|
19
|
+
onError={() => {
|
|
20
|
+
setStatus('failed');
|
|
21
|
+
}}
|
|
22
|
+
/>
|
|
23
|
+
<View
|
|
24
|
+
top={0}
|
|
25
|
+
bottom={0}
|
|
26
|
+
right={0}
|
|
27
|
+
left={0}
|
|
28
|
+
position="absolute"
|
|
29
|
+
alignItems="center"
|
|
30
|
+
justifyContent="center"
|
|
31
|
+
>
|
|
32
|
+
{status === 'loading' && <ActivityIndicator />}
|
|
33
|
+
{status === 'failed' && <IconButton icon="image-broken-variant" />}
|
|
34
|
+
</View>
|
|
35
|
+
</View>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View as V, type ViewProps } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
useRestyle,
|
|
5
|
+
spacing,
|
|
6
|
+
border,
|
|
7
|
+
backgroundColor,
|
|
8
|
+
backgroundColorShorthand,
|
|
9
|
+
type SpacingProps,
|
|
10
|
+
type BorderProps,
|
|
11
|
+
type BackgroundColorProps,
|
|
12
|
+
composeRestyleFunctions,
|
|
13
|
+
type SpacingShorthandProps,
|
|
14
|
+
type LayoutProps,
|
|
15
|
+
type PositionProps,
|
|
16
|
+
spacingShorthand,
|
|
17
|
+
layout,
|
|
18
|
+
position,
|
|
19
|
+
type BackgroundColorShorthandProps,
|
|
20
|
+
type ShadowProps,
|
|
21
|
+
shadow,
|
|
22
|
+
opacity,
|
|
23
|
+
type OpacityProps,
|
|
24
|
+
} from '@shopify/restyle';
|
|
25
|
+
import { type ThemeType } from '../theme';
|
|
26
|
+
|
|
27
|
+
type RestyleProps = SpacingProps<ThemeType> &
|
|
28
|
+
SpacingShorthandProps<ThemeType> &
|
|
29
|
+
LayoutProps<ThemeType> &
|
|
30
|
+
PositionProps<ThemeType> &
|
|
31
|
+
ShadowProps<ThemeType> &
|
|
32
|
+
OpacityProps<ThemeType> &
|
|
33
|
+
BorderProps<ThemeType> &
|
|
34
|
+
BackgroundColorProps<ThemeType> &
|
|
35
|
+
BackgroundColorShorthandProps<ThemeType>;
|
|
36
|
+
|
|
37
|
+
const restyleFunctions = composeRestyleFunctions<ThemeType, RestyleProps>([
|
|
38
|
+
spacing,
|
|
39
|
+
spacingShorthand,
|
|
40
|
+
layout,
|
|
41
|
+
position,
|
|
42
|
+
shadow,
|
|
43
|
+
opacity,
|
|
44
|
+
border,
|
|
45
|
+
backgroundColor,
|
|
46
|
+
backgroundColorShorthand,
|
|
47
|
+
]);
|
|
48
|
+
|
|
49
|
+
type Props = RestyleProps & ViewProps;
|
|
50
|
+
|
|
51
|
+
export const View = ({ children, ...rest }: Props) => {
|
|
52
|
+
const props = useRestyle(restyleFunctions, rest);
|
|
53
|
+
|
|
54
|
+
return <V {...props}>{children}</V>;
|
|
55
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { Alert } from './Alert';
|
|
2
|
+
export { Badge } from './Badge';
|
|
3
|
+
export { BottomSheet } from './BottomSheet';
|
|
4
|
+
export { Button } from './Button';
|
|
5
|
+
export { Card } from './Card';
|
|
6
|
+
export { Divider } from './Divider';
|
|
7
|
+
export { FAB } from './FAB';
|
|
8
|
+
export { Header } from './Header';
|
|
9
|
+
export { IconButton } from './IconButton';
|
|
10
|
+
export { Image } from './Image';
|
|
11
|
+
export { KeyboardAvoidingView } from './KeyboardAvoidingView';
|
|
12
|
+
export { LineLoader } from './LineLoader';
|
|
13
|
+
export { LinkButton } from './LinkButton';
|
|
14
|
+
export { OtpInputs } from './OtpInputs';
|
|
15
|
+
export { ParentView } from './ParentView';
|
|
16
|
+
export { Searchbar } from './Searchbar';
|
|
17
|
+
export { SelectionDialog } from './SelectionDialog';
|
|
18
|
+
export { Snackbar } from './Snackbar';
|
|
19
|
+
export { Surface } from './Surface';
|
|
20
|
+
export { Text } from './Text';
|
|
21
|
+
export { TextInput } from './TextInput';
|
|
22
|
+
export { ToggleButton } from './ToggleButton';
|
|
23
|
+
export { Video } from './Video';
|
|
24
|
+
export { View } from './View';
|