@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.
Files changed (73) hide show
  1. package/lib/commonjs/auth/screens/LoginScreen.js +14 -3
  2. package/lib/commonjs/auth/screens/LoginScreen.js.map +1 -1
  3. package/lib/commonjs/auth/screens/ResetPassword.js +8 -1
  4. package/lib/commonjs/auth/screens/ResetPassword.js.map +1 -1
  5. package/lib/commonjs/auth/screens/ResetPasswordInstructionsSent.js +6 -1
  6. package/lib/commonjs/auth/screens/ResetPasswordInstructionsSent.js.map +1 -1
  7. package/lib/commonjs/auth/screens/SignUp.js +12 -5
  8. package/lib/commonjs/auth/screens/SignUp.js.map +1 -1
  9. package/lib/commonjs/auth/screens/SignUpPassword.js +8 -1
  10. package/lib/commonjs/auth/screens/SignUpPassword.js.map +1 -1
  11. package/lib/commonjs/auth/screens/VerifyPhoneNumber.js +8 -1
  12. package/lib/commonjs/auth/screens/VerifyPhoneNumber.js.map +1 -1
  13. package/lib/commonjs/auth/screens/validators.js +7 -2
  14. package/lib/commonjs/auth/screens/validators.js.map +1 -1
  15. package/lib/commonjs/components/Switch.js +19 -0
  16. package/lib/commonjs/components/Switch.js.map +1 -0
  17. package/lib/commonjs/components/TouchableRipple.js +23 -0
  18. package/lib/commonjs/components/TouchableRipple.js.map +1 -0
  19. package/lib/commonjs/components/index.js +14 -0
  20. package/lib/commonjs/components/index.js.map +1 -1
  21. package/lib/commonjs/theme/index.js +2 -1
  22. package/lib/commonjs/theme/index.js.map +1 -1
  23. package/lib/module/auth/screens/LoginScreen.js +14 -3
  24. package/lib/module/auth/screens/LoginScreen.js.map +1 -1
  25. package/lib/module/auth/screens/ResetPassword.js +8 -1
  26. package/lib/module/auth/screens/ResetPassword.js.map +1 -1
  27. package/lib/module/auth/screens/ResetPasswordInstructionsSent.js +6 -1
  28. package/lib/module/auth/screens/ResetPasswordInstructionsSent.js.map +1 -1
  29. package/lib/module/auth/screens/SignUp.js +13 -6
  30. package/lib/module/auth/screens/SignUp.js.map +1 -1
  31. package/lib/module/auth/screens/SignUpPassword.js +8 -1
  32. package/lib/module/auth/screens/SignUpPassword.js.map +1 -1
  33. package/lib/module/auth/screens/VerifyPhoneNumber.js +8 -1
  34. package/lib/module/auth/screens/VerifyPhoneNumber.js.map +1 -1
  35. package/lib/module/auth/screens/validators.js +6 -1
  36. package/lib/module/auth/screens/validators.js.map +1 -1
  37. package/lib/module/components/Switch.js +11 -0
  38. package/lib/module/components/Switch.js.map +1 -0
  39. package/lib/module/components/TouchableRipple.js +15 -0
  40. package/lib/module/components/TouchableRipple.js.map +1 -0
  41. package/lib/module/components/index.js +2 -0
  42. package/lib/module/components/index.js.map +1 -1
  43. package/lib/module/theme/index.js +2 -1
  44. package/lib/module/theme/index.js.map +1 -1
  45. package/lib/typescript/src/auth/screens/LoginScreen.d.ts.map +1 -1
  46. package/lib/typescript/src/auth/screens/ResetPassword.d.ts.map +1 -1
  47. package/lib/typescript/src/auth/screens/ResetPasswordInstructionsSent.d.ts.map +1 -1
  48. package/lib/typescript/src/auth/screens/SignUp.d.ts +1 -1
  49. package/lib/typescript/src/auth/screens/SignUp.d.ts.map +1 -1
  50. package/lib/typescript/src/auth/screens/SignUpPassword.d.ts.map +1 -1
  51. package/lib/typescript/src/auth/screens/VerifyPhoneNumber.d.ts.map +1 -1
  52. package/lib/typescript/src/auth/screens/validators.d.ts +10 -1
  53. package/lib/typescript/src/auth/screens/validators.d.ts.map +1 -1
  54. package/lib/typescript/src/components/Switch.d.ts +9 -0
  55. package/lib/typescript/src/components/Switch.d.ts.map +1 -0
  56. package/lib/typescript/src/components/TouchableRipple.d.ts +9 -0
  57. package/lib/typescript/src/components/TouchableRipple.d.ts.map +1 -0
  58. package/lib/typescript/src/components/index.d.ts +2 -0
  59. package/lib/typescript/src/components/index.d.ts.map +1 -1
  60. package/lib/typescript/src/theme/index.d.ts +2 -0
  61. package/lib/typescript/src/theme/index.d.ts.map +1 -1
  62. package/package.json +2 -1
  63. package/src/auth/screens/LoginScreen.tsx +16 -2
  64. package/src/auth/screens/ResetPassword.tsx +5 -1
  65. package/src/auth/screens/ResetPasswordInstructionsSent.tsx +6 -1
  66. package/src/auth/screens/SignUp.tsx +39 -23
  67. package/src/auth/screens/SignUpPassword.tsx +5 -1
  68. package/src/auth/screens/VerifyPhoneNumber.tsx +5 -1
  69. package/src/auth/screens/validators.ts +7 -1
  70. package/src/components/Switch.tsx +47 -0
  71. package/src/components/TouchableRipple.tsx +62 -0
  72. package/src/components/index.ts +2 -0
  73. 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 { signUpValidationSchema } from './validators';
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: string;
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(signUpValidationSchema),
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 flex={1} justifyContent="center">
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
- <Controller
80
- control={control}
81
- render={({ field: { onChange, onBlur, value } }) => {
82
- return (
83
- <TextInput
84
- my="5"
85
- mode="outlined"
86
- error={!!errors.name?.message}
87
- errorMessage={errors.name?.message}
88
- onBlur={onBlur}
89
- onChangeText={onChange}
90
- value={value}
91
- label={t('authentication.businessName')}
92
- />
93
- );
94
- }}
95
- name="name"
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 signUpValidationSchema = yup.object().shape({
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
+ };
@@ -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';
@@ -26,6 +26,7 @@ export const generateRestyleComponentsTheme = ({
26
26
  spacing: units,
27
27
  breakpoints: {
28
28
  phone: 0,
29
+ tablet: 768,
29
30
  },
30
31
  zIndices: units,
31
32
  borderRadii: units,