@kiosinc/commons-rn 0.1.14 → 0.1.16
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/lib/commonjs/auth/screens/LoginScreen.js +14 -3
- package/lib/commonjs/auth/screens/LoginScreen.js.map +1 -1
- package/lib/commonjs/auth/screens/ResetPassword.js +8 -1
- package/lib/commonjs/auth/screens/ResetPassword.js.map +1 -1
- package/lib/commonjs/auth/screens/ResetPasswordInstructionsSent.js +6 -1
- package/lib/commonjs/auth/screens/ResetPasswordInstructionsSent.js.map +1 -1
- package/lib/commonjs/auth/screens/SignUp.js +12 -5
- package/lib/commonjs/auth/screens/SignUp.js.map +1 -1
- package/lib/commonjs/auth/screens/SignUpPassword.js +8 -1
- package/lib/commonjs/auth/screens/SignUpPassword.js.map +1 -1
- package/lib/commonjs/auth/screens/VerifyPhoneNumber.js +8 -1
- package/lib/commonjs/auth/screens/VerifyPhoneNumber.js.map +1 -1
- package/lib/commonjs/auth/screens/validators.js +7 -2
- package/lib/commonjs/auth/screens/validators.js.map +1 -1
- package/lib/commonjs/components/Switch.js +19 -0
- package/lib/commonjs/components/Switch.js.map +1 -0
- package/lib/commonjs/components/TouchableRipple.js +23 -0
- package/lib/commonjs/components/TouchableRipple.js.map +1 -0
- package/lib/commonjs/components/index.js +14 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/theme/index.js +2 -1
- package/lib/commonjs/theme/index.js.map +1 -1
- package/lib/module/auth/screens/LoginScreen.js +14 -3
- package/lib/module/auth/screens/LoginScreen.js.map +1 -1
- package/lib/module/auth/screens/ResetPassword.js +8 -1
- package/lib/module/auth/screens/ResetPassword.js.map +1 -1
- package/lib/module/auth/screens/ResetPasswordInstructionsSent.js +6 -1
- package/lib/module/auth/screens/ResetPasswordInstructionsSent.js.map +1 -1
- package/lib/module/auth/screens/SignUp.js +13 -6
- package/lib/module/auth/screens/SignUp.js.map +1 -1
- package/lib/module/auth/screens/SignUpPassword.js +8 -1
- package/lib/module/auth/screens/SignUpPassword.js.map +1 -1
- package/lib/module/auth/screens/VerifyPhoneNumber.js +8 -1
- package/lib/module/auth/screens/VerifyPhoneNumber.js.map +1 -1
- package/lib/module/auth/screens/validators.js +6 -1
- package/lib/module/auth/screens/validators.js.map +1 -1
- package/lib/module/components/Switch.js +11 -0
- package/lib/module/components/Switch.js.map +1 -0
- package/lib/module/components/TouchableRipple.js +15 -0
- package/lib/module/components/TouchableRipple.js.map +1 -0
- package/lib/module/components/index.js +2 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/theme/index.js +2 -1
- package/lib/module/theme/index.js.map +1 -1
- package/lib/typescript/src/auth/screens/LoginScreen.d.ts.map +1 -1
- package/lib/typescript/src/auth/screens/ResetPassword.d.ts.map +1 -1
- package/lib/typescript/src/auth/screens/ResetPasswordInstructionsSent.d.ts.map +1 -1
- package/lib/typescript/src/auth/screens/SignUp.d.ts +1 -1
- package/lib/typescript/src/auth/screens/SignUp.d.ts.map +1 -1
- package/lib/typescript/src/auth/screens/SignUpPassword.d.ts.map +1 -1
- package/lib/typescript/src/auth/screens/VerifyPhoneNumber.d.ts.map +1 -1
- package/lib/typescript/src/auth/screens/validators.d.ts +10 -1
- package/lib/typescript/src/auth/screens/validators.d.ts.map +1 -1
- package/lib/typescript/src/components/Switch.d.ts +9 -0
- package/lib/typescript/src/components/Switch.d.ts.map +1 -0
- package/lib/typescript/src/components/TouchableRipple.d.ts +9 -0
- package/lib/typescript/src/components/TouchableRipple.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +2 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/theme/index.d.ts +2 -0
- package/lib/typescript/src/theme/index.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/auth/screens/LoginScreen.tsx +16 -2
- package/src/auth/screens/ResetPassword.tsx +5 -1
- package/src/auth/screens/ResetPasswordInstructionsSent.tsx +6 -1
- package/src/auth/screens/SignUp.tsx +39 -23
- package/src/auth/screens/SignUpPassword.tsx +5 -1
- package/src/auth/screens/VerifyPhoneNumber.tsx +5 -1
- package/src/auth/screens/validators.ts +7 -1
- package/src/components/Switch.tsx +47 -0
- package/src/components/TouchableRipple.tsx +62 -0
- package/src/components/index.ts +2 -0
- package/src/theme/index.ts +1 -0
|
@@ -12,16 +12,20 @@ import { useTranslation } from 'react-i18next';
|
|
|
12
12
|
import { StyleSheet } from 'react-native';
|
|
13
13
|
import { Controller, useForm } from 'react-hook-form';
|
|
14
14
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
signUpValidationSchemaWithBusinessName,
|
|
17
|
+
signUpValidationSchemaWithoutBusinessName,
|
|
18
|
+
} from './validators';
|
|
16
19
|
import { useAuthentication } from '../hooks/useAuthentication';
|
|
17
20
|
import { Linking } from 'react-native';
|
|
18
21
|
import { PRIVACY_POLICY, TERMS_OF_SERVICE } from '../../constants';
|
|
22
|
+
import Config from 'react-native-config';
|
|
19
23
|
|
|
20
24
|
export type TUserForm = {
|
|
21
25
|
displayName: string;
|
|
22
26
|
email: string;
|
|
23
27
|
phoneNumber: string;
|
|
24
|
-
name
|
|
28
|
+
name?: string;
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
export const SignUpScreen = () => {
|
|
@@ -36,7 +40,11 @@ export const SignUpScreen = () => {
|
|
|
36
40
|
formState: { errors },
|
|
37
41
|
} = useForm<TUserForm>({
|
|
38
42
|
criteriaMode: 'all',
|
|
39
|
-
resolver: yupResolver(
|
|
43
|
+
resolver: yupResolver(
|
|
44
|
+
Config.APP_NAME === 'gusteau'
|
|
45
|
+
? signUpValidationSchemaWithoutBusinessName
|
|
46
|
+
: signUpValidationSchemaWithBusinessName
|
|
47
|
+
),
|
|
40
48
|
defaultValues: {
|
|
41
49
|
email: '',
|
|
42
50
|
name: '',
|
|
@@ -45,13 +53,19 @@ export const SignUpScreen = () => {
|
|
|
45
53
|
},
|
|
46
54
|
});
|
|
47
55
|
|
|
56
|
+
console.log('Config.APP_NAME', Config.APP_NAME);
|
|
57
|
+
|
|
48
58
|
const onSubmit = (data: TUserForm) => {
|
|
49
59
|
checkRegistration(data);
|
|
50
60
|
};
|
|
51
61
|
|
|
52
62
|
return (
|
|
53
|
-
<ParentView px="16">
|
|
54
|
-
<KeyboardAvoidingView
|
|
63
|
+
<ParentView px="16" justifyContent="center">
|
|
64
|
+
<KeyboardAvoidingView
|
|
65
|
+
alignSelf="center"
|
|
66
|
+
justifyContent={'center'}
|
|
67
|
+
width={{ phone: '100%', tablet: 372 }}
|
|
68
|
+
>
|
|
55
69
|
<View alignItems="center">
|
|
56
70
|
<Text pb="40" variant="titleLarge">
|
|
57
71
|
{t('authentication.createAccountTitle')}
|
|
@@ -76,24 +90,26 @@ export const SignUpScreen = () => {
|
|
|
76
90
|
}}
|
|
77
91
|
name="displayName"
|
|
78
92
|
/>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
{Config.APP_NAME !== 'gusteau' && (
|
|
94
|
+
<Controller
|
|
95
|
+
control={control}
|
|
96
|
+
render={({ field: { onChange, onBlur, value } }) => {
|
|
97
|
+
return (
|
|
98
|
+
<TextInput
|
|
99
|
+
my="5"
|
|
100
|
+
mode="outlined"
|
|
101
|
+
error={!!errors.name?.message}
|
|
102
|
+
errorMessage={errors.name?.message}
|
|
103
|
+
onBlur={onBlur}
|
|
104
|
+
onChangeText={onChange}
|
|
105
|
+
value={value}
|
|
106
|
+
label={t('authentication.businessName')}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
}}
|
|
110
|
+
name="name"
|
|
111
|
+
/>
|
|
112
|
+
)}
|
|
97
113
|
<Controller
|
|
98
114
|
control={control}
|
|
99
115
|
render={({ field: { onChange, onBlur, value } }) => {
|
|
@@ -57,7 +57,11 @@ export const SignUpPassword: React.FC<SignUpPasswordProps> = ({ route }) => {
|
|
|
57
57
|
|
|
58
58
|
return (
|
|
59
59
|
<ParentView justifyContent="center" px="16">
|
|
60
|
-
<KeyboardAvoidingView
|
|
60
|
+
<KeyboardAvoidingView
|
|
61
|
+
alignSelf="center"
|
|
62
|
+
justifyContent={'center'}
|
|
63
|
+
width={{ phone: '100%', tablet: 372 }}
|
|
64
|
+
>
|
|
61
65
|
<View alignItems="center">
|
|
62
66
|
<Text textAlign="center" variant="titleLarge">
|
|
63
67
|
{t('authentication.createPassword')}
|
|
@@ -47,7 +47,11 @@ export const VerifyPhoneNumberScreen: React.FC<
|
|
|
47
47
|
|
|
48
48
|
return (
|
|
49
49
|
<ParentView justifyContent="center" px="16">
|
|
50
|
-
<KeyboardAvoidingView
|
|
50
|
+
<KeyboardAvoidingView
|
|
51
|
+
alignSelf="center"
|
|
52
|
+
justifyContent={'center'}
|
|
53
|
+
width={{ phone: '100%', tablet: 372 }}
|
|
54
|
+
>
|
|
51
55
|
<View alignItems="center">
|
|
52
56
|
<Text pb="8" textAlign="center" variant="titleLarge">
|
|
53
57
|
{t('authentication.verifyYourNumber')}
|
|
@@ -46,13 +46,19 @@ const newPassword = yup
|
|
|
46
46
|
|
|
47
47
|
const code = yup.string().required().min(6);
|
|
48
48
|
|
|
49
|
-
export const
|
|
49
|
+
export const signUpValidationSchemaWithBusinessName = yup.object().shape({
|
|
50
50
|
displayName,
|
|
51
51
|
email: emailForSignup,
|
|
52
52
|
phoneNumber,
|
|
53
53
|
name: businessName,
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
+
export const signUpValidationSchemaWithoutBusinessName = yup.object().shape({
|
|
57
|
+
displayName,
|
|
58
|
+
email: emailForSignup,
|
|
59
|
+
phoneNumber,
|
|
60
|
+
});
|
|
61
|
+
|
|
56
62
|
export const loginValidationSchema = yup.object().shape({
|
|
57
63
|
email: emailForLogin,
|
|
58
64
|
password,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Switch as S, type SwitchProps } 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 & SwitchProps;
|
|
42
|
+
|
|
43
|
+
export const Switch = ({ ...rest }: Props) => {
|
|
44
|
+
const props = useRestyle(restyleFunctions as any, rest as any);
|
|
45
|
+
|
|
46
|
+
return <S {...(props as Props)} />;
|
|
47
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
TouchableRipple as TR,
|
|
4
|
+
type TouchableRippleProps,
|
|
5
|
+
} from 'react-native-paper';
|
|
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
|
+
type ShadowProps,
|
|
24
|
+
shadow,
|
|
25
|
+
opacity,
|
|
26
|
+
type OpacityProps,
|
|
27
|
+
} from '@shopify/restyle';
|
|
28
|
+
import { type ThemeType } from '../theme';
|
|
29
|
+
|
|
30
|
+
type RestyleProps = SpacingProps<ThemeType> &
|
|
31
|
+
SpacingShorthandProps<ThemeType> &
|
|
32
|
+
LayoutProps<ThemeType> &
|
|
33
|
+
PositionProps<ThemeType> &
|
|
34
|
+
ShadowProps<ThemeType> &
|
|
35
|
+
OpacityProps<ThemeType> &
|
|
36
|
+
BorderProps<ThemeType> &
|
|
37
|
+
BackgroundColorProps<ThemeType> &
|
|
38
|
+
BackgroundColorShorthandProps<ThemeType>;
|
|
39
|
+
|
|
40
|
+
const restyleFunctions = composeRestyleFunctions<ThemeType, RestyleProps>([
|
|
41
|
+
spacing,
|
|
42
|
+
spacingShorthand,
|
|
43
|
+
layout,
|
|
44
|
+
position,
|
|
45
|
+
shadow,
|
|
46
|
+
opacity,
|
|
47
|
+
border,
|
|
48
|
+
backgroundColor,
|
|
49
|
+
backgroundColorShorthand,
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
type Props = RestyleProps & TouchableRippleProps;
|
|
53
|
+
|
|
54
|
+
export const TouchableRipple = ({ children, ...rest }: Props) => {
|
|
55
|
+
const props = useRestyle(restyleFunctions, rest);
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<TR borderless {...props}>
|
|
59
|
+
{children}
|
|
60
|
+
</TR>
|
|
61
|
+
);
|
|
62
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -17,8 +17,10 @@ export { Searchbar } from './Searchbar';
|
|
|
17
17
|
export { SelectionDialog } from './SelectionDialog';
|
|
18
18
|
export { Snackbar } from './Snackbar';
|
|
19
19
|
export { Surface } from './Surface';
|
|
20
|
+
export { Switch } from './Switch';
|
|
20
21
|
export { Text } from './Text';
|
|
21
22
|
export { TextInput } from './TextInput';
|
|
22
23
|
export { ToggleButton } from './ToggleButton';
|
|
24
|
+
export { TouchableRipple } from './TouchableRipple';
|
|
23
25
|
export { Video } from './Video';
|
|
24
26
|
export { View } from './View';
|