@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,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconButton as I, type IconButtonProps } 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 & IconButtonProps;
|
|
42
|
+
|
|
43
|
+
export const IconButton = ({ ...rest }: Props) => {
|
|
44
|
+
const props = useRestyle(restyleFunctions as any, rest);
|
|
45
|
+
|
|
46
|
+
return <I {...props} />;
|
|
47
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
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 {
|
|
7
|
+
useRestyle,
|
|
8
|
+
spacing,
|
|
9
|
+
border,
|
|
10
|
+
backgroundColor,
|
|
11
|
+
backgroundColorShorthand,
|
|
12
|
+
type SpacingProps,
|
|
13
|
+
type BorderProps,
|
|
14
|
+
type BackgroundColorProps,
|
|
15
|
+
composeRestyleFunctions,
|
|
16
|
+
type SpacingShorthandProps,
|
|
17
|
+
type LayoutProps,
|
|
18
|
+
type PositionProps,
|
|
19
|
+
spacingShorthand,
|
|
20
|
+
layout,
|
|
21
|
+
position,
|
|
22
|
+
type BackgroundColorShorthandProps,
|
|
23
|
+
} from '@shopify/restyle';
|
|
24
|
+
import { type ThemeType } from '../theme';
|
|
25
|
+
import FastImage, { type FastImageProps } from 'react-native-fast-image';
|
|
26
|
+
|
|
27
|
+
type RestyleProps = SpacingProps<ThemeType> &
|
|
28
|
+
SpacingShorthandProps<ThemeType> &
|
|
29
|
+
LayoutProps<ThemeType> &
|
|
30
|
+
PositionProps<ThemeType> &
|
|
31
|
+
BorderProps<ThemeType> &
|
|
32
|
+
BackgroundColorProps<ThemeType> &
|
|
33
|
+
BackgroundColorShorthandProps<ThemeType>;
|
|
34
|
+
|
|
35
|
+
const restyleFunctions = composeRestyleFunctions<ThemeType, RestyleProps>([
|
|
36
|
+
spacing,
|
|
37
|
+
spacingShorthand,
|
|
38
|
+
layout,
|
|
39
|
+
position,
|
|
40
|
+
border,
|
|
41
|
+
backgroundColor,
|
|
42
|
+
backgroundColorShorthand,
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
type Props = RestyleProps & FastImageProps;
|
|
46
|
+
|
|
47
|
+
export const Image = ({ ...rest }: Props) => {
|
|
48
|
+
const props = useRestyle(restyleFunctions, rest);
|
|
49
|
+
|
|
50
|
+
const [status, setStatus] = useState<'loading' | 'failed' | 'success'>(
|
|
51
|
+
'loading'
|
|
52
|
+
);
|
|
53
|
+
return (
|
|
54
|
+
<View flex={1}>
|
|
55
|
+
<View
|
|
56
|
+
top={0}
|
|
57
|
+
bottom={0}
|
|
58
|
+
right={0}
|
|
59
|
+
left={0}
|
|
60
|
+
position="absolute"
|
|
61
|
+
alignItems="center"
|
|
62
|
+
justifyContent="center"
|
|
63
|
+
>
|
|
64
|
+
{status === 'loading' && <ActivityIndicator />}
|
|
65
|
+
{status === 'failed' && <IconButton icon="image-broken-variant" />}
|
|
66
|
+
</View>
|
|
67
|
+
<FastImage
|
|
68
|
+
{...props}
|
|
69
|
+
onLoad={() => {
|
|
70
|
+
setStatus('success');
|
|
71
|
+
}}
|
|
72
|
+
onError={() => {
|
|
73
|
+
setStatus('failed');
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
</View>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
KeyboardAvoidingView as KV,
|
|
4
|
+
type KeyboardAvoidingViewProps,
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
useRestyle,
|
|
9
|
+
spacing,
|
|
10
|
+
border,
|
|
11
|
+
backgroundColor,
|
|
12
|
+
backgroundColorShorthand,
|
|
13
|
+
type SpacingProps,
|
|
14
|
+
type BorderProps,
|
|
15
|
+
type BackgroundColorProps,
|
|
16
|
+
composeRestyleFunctions,
|
|
17
|
+
type SpacingShorthandProps,
|
|
18
|
+
type LayoutProps,
|
|
19
|
+
type PositionProps,
|
|
20
|
+
spacingShorthand,
|
|
21
|
+
layout,
|
|
22
|
+
position,
|
|
23
|
+
type BackgroundColorShorthandProps,
|
|
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
|
+
BorderProps<ThemeType> &
|
|
32
|
+
BackgroundColorProps<ThemeType> &
|
|
33
|
+
BackgroundColorShorthandProps<ThemeType>;
|
|
34
|
+
|
|
35
|
+
const restyleFunctions = composeRestyleFunctions<ThemeType, RestyleProps>([
|
|
36
|
+
spacing,
|
|
37
|
+
spacingShorthand,
|
|
38
|
+
layout,
|
|
39
|
+
position,
|
|
40
|
+
border,
|
|
41
|
+
backgroundColor,
|
|
42
|
+
backgroundColorShorthand,
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
type Props = RestyleProps & KeyboardAvoidingViewProps;
|
|
46
|
+
|
|
47
|
+
export const KeyboardAvoidingView = ({ children, ...rest }: Props) => {
|
|
48
|
+
const props = useRestyle(restyleFunctions, rest);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<KV behavior="padding" {...props}>
|
|
52
|
+
{children}
|
|
53
|
+
</KV>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { View, StyleSheet } from 'react-native';
|
|
3
|
+
import { useTheme } from 'react-native-paper';
|
|
4
|
+
import Animated, {
|
|
5
|
+
useSharedValue,
|
|
6
|
+
useAnimatedStyle,
|
|
7
|
+
withTiming,
|
|
8
|
+
Easing,
|
|
9
|
+
} from 'react-native-reanimated';
|
|
10
|
+
|
|
11
|
+
type LineLoaderPropsType = {
|
|
12
|
+
backgroundColor?: string;
|
|
13
|
+
foregroundColor?: string;
|
|
14
|
+
height?: number;
|
|
15
|
+
progress: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const LineLoader: React.FC<LineLoaderPropsType> = ({
|
|
19
|
+
backgroundColor,
|
|
20
|
+
foregroundColor,
|
|
21
|
+
height = 4,
|
|
22
|
+
progress = 0,
|
|
23
|
+
}) => {
|
|
24
|
+
const theme = useTheme();
|
|
25
|
+
const animatedProgress = useSharedValue(0);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
animatedProgress.value = withTiming(progress, {
|
|
29
|
+
duration: 500,
|
|
30
|
+
easing: Easing.linear,
|
|
31
|
+
});
|
|
32
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
|
+
}, [progress]);
|
|
34
|
+
|
|
35
|
+
const lineStyle = useAnimatedStyle(() => {
|
|
36
|
+
return {
|
|
37
|
+
width: `${animatedProgress.value * 100}%`,
|
|
38
|
+
backgroundColor: foregroundColor ?? theme.colors.primary,
|
|
39
|
+
height,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<View style={[styles.container, { height }]}>
|
|
45
|
+
<View
|
|
46
|
+
style={[
|
|
47
|
+
styles.background,
|
|
48
|
+
{
|
|
49
|
+
backgroundColor: backgroundColor ?? theme.colors.onSurfaceDisabled,
|
|
50
|
+
},
|
|
51
|
+
]}
|
|
52
|
+
/>
|
|
53
|
+
<Animated.View style={[styles.line, lineStyle]} />
|
|
54
|
+
</View>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const styles = StyleSheet.create({
|
|
59
|
+
container: {
|
|
60
|
+
overflow: 'hidden',
|
|
61
|
+
},
|
|
62
|
+
background: {
|
|
63
|
+
flex: 1,
|
|
64
|
+
},
|
|
65
|
+
line: {
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
top: 0,
|
|
68
|
+
left: 0,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button as B, type ButtonProps } 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
|
+
layout,
|
|
14
|
+
position,
|
|
15
|
+
spacingShorthand,
|
|
16
|
+
type SpacingShorthandProps,
|
|
17
|
+
type LayoutProps,
|
|
18
|
+
type PositionProps,
|
|
19
|
+
type BackgroundColorShorthandProps,
|
|
20
|
+
} from '@shopify/restyle';
|
|
21
|
+
import { type ThemeType } from '../theme';
|
|
22
|
+
import { StyleSheet } from 'react-native';
|
|
23
|
+
|
|
24
|
+
type RestyleProps = SpacingProps<ThemeType> &
|
|
25
|
+
SpacingShorthandProps<ThemeType> &
|
|
26
|
+
LayoutProps<ThemeType> &
|
|
27
|
+
PositionProps<ThemeType> &
|
|
28
|
+
BorderProps<ThemeType> &
|
|
29
|
+
BackgroundColorProps<ThemeType> &
|
|
30
|
+
BackgroundColorShorthandProps<ThemeType>;
|
|
31
|
+
|
|
32
|
+
const restyleFunctions = composeRestyleFunctions<ThemeType, RestyleProps>([
|
|
33
|
+
spacing,
|
|
34
|
+
spacingShorthand,
|
|
35
|
+
layout,
|
|
36
|
+
position,
|
|
37
|
+
border,
|
|
38
|
+
backgroundColor,
|
|
39
|
+
backgroundColorShorthand,
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
type TextProps = Omit<RestyleProps, 'variant'> & ButtonProps;
|
|
43
|
+
|
|
44
|
+
export const LinkButton: React.FC<TextProps> = ({ children, ...rest }) => {
|
|
45
|
+
const restyleProps = useRestyle(restyleFunctions, rest);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<B
|
|
49
|
+
labelStyle={{
|
|
50
|
+
...styles.underline,
|
|
51
|
+
...((restyleProps.labelStyle as object)
|
|
52
|
+
? (restyleProps.labelStyle as object)
|
|
53
|
+
: {}),
|
|
54
|
+
}}
|
|
55
|
+
{...restyleProps}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
</B>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const styles = StyleSheet.create({
|
|
63
|
+
underline: { textDecorationLine: 'underline' },
|
|
64
|
+
});
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { InteractionManager, Keyboard, StyleSheet } from 'react-native';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
TextInput as T,
|
|
5
|
+
type TextInputProps,
|
|
6
|
+
useTheme,
|
|
7
|
+
} from 'react-native-paper';
|
|
8
|
+
import { View, Text } from '../index';
|
|
9
|
+
import {
|
|
10
|
+
useRestyle,
|
|
11
|
+
spacing,
|
|
12
|
+
border,
|
|
13
|
+
backgroundColor,
|
|
14
|
+
backgroundColorShorthand,
|
|
15
|
+
type SpacingProps,
|
|
16
|
+
type BorderProps,
|
|
17
|
+
type BackgroundColorProps,
|
|
18
|
+
composeRestyleFunctions,
|
|
19
|
+
type SpacingShorthandProps,
|
|
20
|
+
type LayoutProps,
|
|
21
|
+
type PositionProps,
|
|
22
|
+
spacingShorthand,
|
|
23
|
+
layout,
|
|
24
|
+
position,
|
|
25
|
+
type BackgroundColorShorthandProps,
|
|
26
|
+
} from '@shopify/restyle';
|
|
27
|
+
import { type ThemeType } from '../theme';
|
|
28
|
+
|
|
29
|
+
type RestyleProps = SpacingProps<ThemeType> &
|
|
30
|
+
SpacingShorthandProps<ThemeType> &
|
|
31
|
+
LayoutProps<ThemeType> &
|
|
32
|
+
PositionProps<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
|
+
border,
|
|
43
|
+
backgroundColor,
|
|
44
|
+
backgroundColorShorthand,
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
type Props = RestyleProps &
|
|
48
|
+
TextInputProps & {
|
|
49
|
+
errorMessage?: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const TextInput = ({ ...rest }: Props) => {
|
|
53
|
+
const props = useRestyle(restyleFunctions as any, rest);
|
|
54
|
+
|
|
55
|
+
return <T {...props} />;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
type OtpInputsPropsType = {
|
|
59
|
+
handleChange?: (value: string) => void;
|
|
60
|
+
numberOfInputs?: number;
|
|
61
|
+
error?: boolean;
|
|
62
|
+
code?: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const OtpInputs = ({
|
|
66
|
+
handleChange = () => {},
|
|
67
|
+
numberOfInputs = 4,
|
|
68
|
+
error = false,
|
|
69
|
+
code = '',
|
|
70
|
+
}: OtpInputsPropsType) => {
|
|
71
|
+
const inputRef = React.useRef<any>();
|
|
72
|
+
const theme = useTheme();
|
|
73
|
+
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
// Must run after animations for keyboard to automatically open
|
|
76
|
+
InteractionManager.runAfterInteractions(() => {
|
|
77
|
+
if (inputRef?.current) {
|
|
78
|
+
inputRef.current.focus();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}, [inputRef]);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<View overflow="hidden">
|
|
85
|
+
<View alignItems="center" flexDirection="row" justifyContent="center">
|
|
86
|
+
{Array(numberOfInputs)
|
|
87
|
+
.fill('')
|
|
88
|
+
.map((_number, index) => (
|
|
89
|
+
<View
|
|
90
|
+
key={index}
|
|
91
|
+
borderColor={code[index] ? 'primary' : 'outline'}
|
|
92
|
+
borderWidth={1}
|
|
93
|
+
margin="2"
|
|
94
|
+
borderRadius="8"
|
|
95
|
+
backgroundColor="background"
|
|
96
|
+
justifyContent="center"
|
|
97
|
+
alignItems="center"
|
|
98
|
+
minHeight={42}
|
|
99
|
+
minWidth={42}
|
|
100
|
+
>
|
|
101
|
+
<Text
|
|
102
|
+
borderColor="primary"
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
accessibilityLabel="otp"
|
|
105
|
+
color={error ? 'error' : 'onBackground'}
|
|
106
|
+
fontSize={20}
|
|
107
|
+
style={theme.fonts.bodyLarge}
|
|
108
|
+
>
|
|
109
|
+
{code[index] || ''}
|
|
110
|
+
</Text>
|
|
111
|
+
</View>
|
|
112
|
+
))}
|
|
113
|
+
<TextInput
|
|
114
|
+
textContentType="oneTimeCode"
|
|
115
|
+
autoFocus
|
|
116
|
+
keyboardType="phone-pad"
|
|
117
|
+
ref={inputRef}
|
|
118
|
+
mode="flat"
|
|
119
|
+
autoComplete="one-time-code"
|
|
120
|
+
selectionColor="transparent"
|
|
121
|
+
value={code || ''}
|
|
122
|
+
onChangeText={(value: string) => {
|
|
123
|
+
if (!isNaN(Number(value))) {
|
|
124
|
+
if (value.length <= numberOfInputs) {
|
|
125
|
+
handleChange && handleChange(value);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (value.length >= numberOfInputs) {
|
|
129
|
+
return Keyboard.dismiss();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return null;
|
|
134
|
+
}}
|
|
135
|
+
style={styles.hiddenFont}
|
|
136
|
+
backgroundColor="transparent"
|
|
137
|
+
bottom={-10}
|
|
138
|
+
width="100%"
|
|
139
|
+
height={60}
|
|
140
|
+
position="absolute"
|
|
141
|
+
/>
|
|
142
|
+
</View>
|
|
143
|
+
</View>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const styles = StyleSheet.create({
|
|
148
|
+
hiddenFont: { fontSize: 0.001 },
|
|
149
|
+
});
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
StatusBar,
|
|
6
|
+
Keyboard,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
type StatusBarStyle,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import {
|
|
11
|
+
type Edges,
|
|
12
|
+
SafeAreaView,
|
|
13
|
+
useSafeAreaInsets,
|
|
14
|
+
} from 'react-native-safe-area-context';
|
|
15
|
+
|
|
16
|
+
import { View } from '../components';
|
|
17
|
+
import { useTheme } from 'react-native-paper';
|
|
18
|
+
|
|
19
|
+
import { type ViewProps } from 'react-native';
|
|
20
|
+
import {
|
|
21
|
+
useRestyle,
|
|
22
|
+
spacing,
|
|
23
|
+
border,
|
|
24
|
+
backgroundColor,
|
|
25
|
+
backgroundColorShorthand,
|
|
26
|
+
type SpacingProps,
|
|
27
|
+
type BorderProps,
|
|
28
|
+
type BackgroundColorProps,
|
|
29
|
+
composeRestyleFunctions,
|
|
30
|
+
type SpacingShorthandProps,
|
|
31
|
+
type LayoutProps,
|
|
32
|
+
type PositionProps,
|
|
33
|
+
spacingShorthand,
|
|
34
|
+
layout,
|
|
35
|
+
position,
|
|
36
|
+
type BackgroundColorShorthandProps,
|
|
37
|
+
} from '@shopify/restyle';
|
|
38
|
+
import { type ThemeType } from '../theme';
|
|
39
|
+
|
|
40
|
+
type RestyleProps = SpacingProps<ThemeType> &
|
|
41
|
+
SpacingShorthandProps<ThemeType> &
|
|
42
|
+
LayoutProps<ThemeType> &
|
|
43
|
+
PositionProps<ThemeType> &
|
|
44
|
+
BorderProps<ThemeType> &
|
|
45
|
+
BackgroundColorProps<ThemeType> &
|
|
46
|
+
BackgroundColorShorthandProps<ThemeType>;
|
|
47
|
+
|
|
48
|
+
const restyleFunctions = composeRestyleFunctions<ThemeType, RestyleProps>([
|
|
49
|
+
spacing,
|
|
50
|
+
spacingShorthand,
|
|
51
|
+
layout,
|
|
52
|
+
position,
|
|
53
|
+
border,
|
|
54
|
+
backgroundColor,
|
|
55
|
+
backgroundColorShorthand,
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
type Props = RestyleProps &
|
|
59
|
+
ViewProps & {
|
|
60
|
+
barStyle?: StatusBarStyle;
|
|
61
|
+
children?: React.ReactNode;
|
|
62
|
+
shouldDismissKeyboardOnTap?: boolean;
|
|
63
|
+
topInset?: boolean;
|
|
64
|
+
rightInset?: boolean;
|
|
65
|
+
leftInset?: boolean;
|
|
66
|
+
bottomInset?: boolean;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export function useKeyboard() {
|
|
70
|
+
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
71
|
+
|
|
72
|
+
function onKeyboardDidShow(e: any) {
|
|
73
|
+
setKeyboardHeight(e.endCoordinates.height);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function onKeyboardDidHide() {
|
|
77
|
+
setKeyboardHeight(0);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
const keyboardDidShowListener = Keyboard.addListener(
|
|
82
|
+
'keyboardDidShow',
|
|
83
|
+
onKeyboardDidShow
|
|
84
|
+
);
|
|
85
|
+
const keyboardDidHideListener = Keyboard.addListener(
|
|
86
|
+
'keyboardDidHide',
|
|
87
|
+
onKeyboardDidHide
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
return () => {
|
|
91
|
+
keyboardDidHideListener.remove();
|
|
92
|
+
keyboardDidShowListener.remove();
|
|
93
|
+
};
|
|
94
|
+
}, []);
|
|
95
|
+
|
|
96
|
+
return keyboardHeight;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export const ParentView = ({
|
|
100
|
+
children,
|
|
101
|
+
bg,
|
|
102
|
+
topInset = true,
|
|
103
|
+
rightInset = true,
|
|
104
|
+
leftInset = true,
|
|
105
|
+
bottomInset = true,
|
|
106
|
+
shouldDismissKeyboardOnTap = true,
|
|
107
|
+
...rest
|
|
108
|
+
}: Props) => {
|
|
109
|
+
const props = useRestyle(restyleFunctions as any, rest);
|
|
110
|
+
|
|
111
|
+
const keyboardHeight = useKeyboard();
|
|
112
|
+
const safeAreaViewProps = {
|
|
113
|
+
edges: [
|
|
114
|
+
...(topInset ? ['top'] : []),
|
|
115
|
+
...(rightInset ? ['right'] : []),
|
|
116
|
+
...(leftInset ? ['left'] : []),
|
|
117
|
+
] as Edges,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const insets = useSafeAreaInsets();
|
|
121
|
+
|
|
122
|
+
const handleOnTouchStart = (e: any) => {
|
|
123
|
+
if (
|
|
124
|
+
keyboardHeight &&
|
|
125
|
+
e?.target?._internalFiberInstanceHandleDEV?.elementType?.indexOf(
|
|
126
|
+
'TextInput'
|
|
127
|
+
) === -1
|
|
128
|
+
) {
|
|
129
|
+
Keyboard.dismiss();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const theme = useTheme();
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<SafeAreaView
|
|
137
|
+
style={[style.safeAreaView, { backgroundColor: theme.colors.background }]}
|
|
138
|
+
{...safeAreaViewProps}
|
|
139
|
+
>
|
|
140
|
+
<StatusBar
|
|
141
|
+
barStyle={theme.dark ? 'light-content' : 'dark-content'}
|
|
142
|
+
translucent
|
|
143
|
+
backgroundColor="transparent"
|
|
144
|
+
/>
|
|
145
|
+
<View
|
|
146
|
+
flex={1}
|
|
147
|
+
bg={bg ?? 'background'}
|
|
148
|
+
{...(props as any)}
|
|
149
|
+
{...(bottomInset && { pb: insets.bottom })}
|
|
150
|
+
{...(shouldDismissKeyboardOnTap
|
|
151
|
+
? { onTouchStart: handleOnTouchStart }
|
|
152
|
+
: {})}
|
|
153
|
+
>
|
|
154
|
+
{children}
|
|
155
|
+
</View>
|
|
156
|
+
</SafeAreaView>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const style = StyleSheet.create({
|
|
161
|
+
safeAreaView: {
|
|
162
|
+
flex: 1,
|
|
163
|
+
},
|
|
164
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Searchbar as S, type SearchbarProps } 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 & SearchbarProps;
|
|
42
|
+
|
|
43
|
+
export const Searchbar = ({ ...rest }: Props) => {
|
|
44
|
+
const props = useRestyle(restyleFunctions as any, rest);
|
|
45
|
+
|
|
46
|
+
return <S {...props} right={null as any} />;
|
|
47
|
+
};
|