@fadyshawky/react-native-magic 2.0.3 → 2.0.5
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/package.json +1 -1
- package/template/src/common/ImageResources.g.ts +33 -1
- package/template/src/common/components/Background.tsx +3 -1
- package/template/src/common/components/Container.tsx +1 -1
- package/template/src/common/components/OTPInput.tsx +3 -2
- package/template/src/common/components/PrimaryButton.tsx +23 -23
- package/template/src/common/components/PrimaryTextInput.tsx +189 -199
- package/template/src/common/components/RadioIcon.tsx +4 -4
- package/template/src/common/components/SafeText.tsx +41 -0
- package/template/src/common/components/SearchBar.tsx +19 -17
- package/template/src/common/components/TryAgain.tsx +3 -3
- package/template/src/common/localization/localization.ts +10 -0
- package/template/src/common/localization/translations/commonLocalization.ts +97 -0
- package/template/src/common/localization/translations/homeLocalization.ts +24 -0
- package/template/src/common/localization/translations/loginLocalization.ts +28 -2
- package/template/src/common/localization/translations/mainNavigationLocalization.ts +30 -0
- package/template/src/common/localization/translations/navigationLocalization.ts +48 -0
- package/template/src/common/localization/translations/otpLocalization.ts +28 -0
- package/template/src/common/localization/translations/passwordLocalization.ts +54 -0
- package/template/src/common/localization/translations/posLocalization.ts +196 -0
- package/template/src/common/utils/FeesCaalculation.tsx +37 -0
- package/template/src/common/utils/index.tsx +11 -0
- package/template/src/common/utils/printData.tsx +161 -0
- package/template/src/common/validations/errorValidations.ts +3 -2
- package/template/src/components/PrinterExample.js +226 -0
- package/template/src/core/api/serverHeaders.ts +62 -1
- package/template/src/core/store/Categories/categoryActions.ts +33 -0
- package/template/src/core/store/Categories/categorySlice.ts +75 -0
- package/template/src/core/store/Categories/categoryState.ts +41 -0
- package/template/src/core/store/Providers/providersActions.ts +102 -0
- package/template/src/core/store/Providers/providersSlice.ts +136 -0
- package/template/src/core/store/Providers/providersState.ts +37 -0
- package/template/src/core/store/Services/servicesActions.ts +191 -0
- package/template/src/core/store/Services/servicesSlice.ts +205 -0
- package/template/src/core/store/Services/servicesState.ts +466 -0
- package/template/src/core/store/app/appSlice.ts +13 -5
- package/template/src/core/store/app/appState.ts +10 -2
- package/template/src/core/store/rootReducer.ts +6 -1
- package/template/src/core/store/store.tsx +55 -2
- package/template/src/core/store/user/userActions.ts +164 -26
- package/template/src/core/store/user/userSlice.ts +193 -21
- package/template/src/core/store/user/userState.ts +148 -25
- package/template/src/core/theme/colors.ts +70 -94
- package/template/src/core/theme/commonConsts.ts +1 -1
- package/template/src/core/theme/commonSizes.ts +94 -119
- package/template/src/core/theme/commonStyles.ts +22 -22
- package/template/src/core/theme/fonts.ts +14 -13
- package/template/src/core/theme/themes.ts +75 -386
- package/template/src/core/theme/types.ts +15 -201
- package/template/src/core/utils/stringUtils.ts +114 -0
- package/template/src/modules/SunmiCard.js +212 -0
- package/template/src/modules/SunmiPrepaid.ts +122 -0
- package/template/src/navigation/AuthStack.tsx +8 -0
- package/template/src/navigation/HeaderComponents.tsx +76 -1
- package/template/src/navigation/MainNavigation.tsx +3 -1
- package/template/src/navigation/MainStack.tsx +130 -56
- package/template/src/navigation/TabBar.tsx +111 -59
- package/template/src/navigation/types.ts +24 -0
- package/template/src/screens/Categories/Categories.tsx +141 -0
- package/template/src/screens/Categories/hooks/useCategoriesData.ts +33 -0
- package/template/src/screens/Categories/types.ts +7 -0
- package/template/src/screens/Favorites/Favorites.tsx +130 -0
- package/template/src/screens/ForceChangePassword/ForceChangePasswordScreen.tsx +155 -0
- package/template/src/screens/History/History.tsx +430 -0
- package/template/src/screens/History/hooks/useHistoryData.ts +49 -0
- package/template/src/screens/History/types.ts +7 -0
- package/template/src/screens/InquiredBill/InquiredBill.tsx +443 -0
- package/template/src/screens/InquiredBill/hooks/useInquiredData.ts +91 -0
- package/template/src/screens/Login/Login.tsx +85 -85
- package/template/src/screens/OTP/OTPScreen.tsx +170 -0
- package/template/src/screens/PaymentConfirmation/PaymentConfirmation.tsx +326 -0
- package/template/src/screens/Providers/Providers.tsx +166 -0
- package/template/src/screens/Providers/hooks/useProvidersData.ts +33 -0
- package/template/src/screens/Providers/types.ts +7 -0
- package/template/src/screens/ReceiptScreen/ReceiptScreen.tsx +181 -0
- package/template/src/screens/ReceiptScreen/hooks/useReceiptData.ts +46 -0
- package/template/src/screens/ReceiptScreen/utils/utils.tsx +156 -0
- package/template/src/screens/Services/Services.tsx +144 -0
- package/template/src/screens/Services/hooks/useServicesData.ts +41 -0
- package/template/src/screens/SingleService/Components/FawryInputs.tsx +446 -0
- package/template/src/screens/SingleService/SingleService.tsx +229 -0
- package/template/src/screens/SingleService/hooks/useServiceData.ts +164 -0
- package/template/src/screens/home/Components/PayByCode.tsx +129 -0
- package/template/src/screens/home/HomeScreen.tsx +268 -77
- package/template/src/screens/home/hooks/useHomeData.ts +32 -38
- package/template/src/screens/index.tsx +24 -0
- package/template/src/screens/profile/Profile.tsx +290 -2
- package/template/src/services/SunmiPrinterInternal.js +268 -0
- package/template/src/types/sunmiPrepaid.d.ts +20 -0
- package/template/src/utils/SunmiPrinter.ts +442 -0
- package/template/src/utils/feesCalculator.ts +92 -0
- package/template/src/common/components/Stepper.tsx +0 -153
- package/template/src/common/components/Svg.tsx +0 -25
- package/template/src/common/hooks/useDebounce.ts +0 -17
- package/template/src/common/hooks/usePrevious.ts +0 -11
- package/template/src/common/localization/intlFormatter.ts +0 -37
- package/template/src/common/urls/emailUrl.ts +0 -20
- package/template/src/common/urls/mapUrl.ts +0 -22
- package/template/src/common/utils/listHandlers.ts +0 -30
- package/template/src/common/utils/serializeQueryParams.ts +0 -10
- package/template/src/common/validations/hooks/useDatesError.ts +0 -40
- package/template/src/common/validations/profileValidations.ts +0 -30
- package/template/src/core/theme/shadows.ts +0 -135
- package/template/src/navigation/TopTabBar.tsx +0 -77
- package/template/src/screens/Settings/Settings.tsx +0 -5
- package/template/src/screens/home/components/CarouselSection.tsx +0 -79
- package/template/src/screens/home/components/FeaturedCarousel.tsx +0 -128
- package/template/src/screens/main/Main.tsx +0 -5
- package/template/src/screens/registration/RegistrationScreen.tsx +0 -198
- package/template/src/screens/resetPassword/ForgotPasswordScreen.tsx +0 -129
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {GradientBorderView} from '@good-react-native/gradient-border';
|
|
1
2
|
import React, {
|
|
2
3
|
FC,
|
|
3
4
|
memo,
|
|
@@ -17,14 +18,17 @@ import {
|
|
|
17
18
|
TextInputProps,
|
|
18
19
|
TextInputSubmitEditingEventData,
|
|
19
20
|
TextStyle,
|
|
20
|
-
TouchableOpacity,
|
|
21
21
|
View,
|
|
22
22
|
ViewStyle,
|
|
23
23
|
} from 'react-native';
|
|
24
24
|
import {useTheme} from '../../core/theme/ThemeProvider';
|
|
25
|
+
import {NewColors} from '../../core/theme/colors';
|
|
25
26
|
import {isIos} from '../../core/theme/commonConsts';
|
|
27
|
+
import {CommonSizes} from '../../core/theme/commonSizes';
|
|
26
28
|
import {CommonStyles} from '../../core/theme/commonStyles';
|
|
29
|
+
import {scaleHeight} from '../../core/theme/scaling';
|
|
27
30
|
import {localization} from '../localization/localization';
|
|
31
|
+
import {regexValidation} from '../validations/regexValidator';
|
|
28
32
|
|
|
29
33
|
interface IProps extends TextInputProps {
|
|
30
34
|
nextInputFocusRef?: MutableRefObject<any>;
|
|
@@ -33,6 +37,7 @@ interface IProps extends TextInputProps {
|
|
|
33
37
|
label?: string;
|
|
34
38
|
error?: string | null;
|
|
35
39
|
hint?: string;
|
|
40
|
+
width?: ViewStyle['width'];
|
|
36
41
|
autoComplete?:
|
|
37
42
|
| 'off'
|
|
38
43
|
| 'username'
|
|
@@ -50,30 +55,43 @@ interface IProps extends TextInputProps {
|
|
|
50
55
|
required?: boolean;
|
|
51
56
|
optional?: boolean;
|
|
52
57
|
inputContainerStyle?: ViewStyle;
|
|
58
|
+
height?: ViewStyle['height'];
|
|
59
|
+
regex?: RegExp;
|
|
60
|
+
regexErrorMessage?: string;
|
|
53
61
|
}
|
|
54
62
|
|
|
55
|
-
const PrimaryTextInput: FC<IProps> = memo(
|
|
63
|
+
export const PrimaryTextInput: FC<IProps> = memo(
|
|
56
64
|
({
|
|
57
65
|
style,
|
|
58
|
-
|
|
66
|
+
blurOnSubmit = true,
|
|
67
|
+
disableFullscreenUI = true,
|
|
68
|
+
enablesReturnKeyAutomatically = true,
|
|
69
|
+
underlineColorAndroid,
|
|
70
|
+
placeholderTextColor,
|
|
71
|
+
editable = true,
|
|
72
|
+
clearButtonMode = 'while-editing',
|
|
59
73
|
label,
|
|
74
|
+
keyboardType = 'numeric',
|
|
60
75
|
error,
|
|
61
76
|
hint,
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
containerStyle,
|
|
78
|
+
inputRef,
|
|
79
|
+
nextInputFocusRef,
|
|
80
|
+
onTouchStart,
|
|
64
81
|
onFocus,
|
|
65
82
|
onBlur,
|
|
66
83
|
onSubmitEditing,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
84
|
+
required,
|
|
85
|
+
optional,
|
|
86
|
+
width,
|
|
87
|
+
height,
|
|
88
|
+
regex,
|
|
89
|
+
regexErrorMessage = 'Invalid format',
|
|
71
90
|
...props
|
|
72
91
|
}) => {
|
|
73
92
|
const [isFocused, setFocused] = useState<boolean>(false);
|
|
74
93
|
const {theme} = useTheme();
|
|
75
|
-
|
|
76
|
-
const selectionColor = theme.colors.PlatinateBlue_700;
|
|
94
|
+
const [regexError, setRegexError] = useState<string | null>(null);
|
|
77
95
|
|
|
78
96
|
const onLocalFocus = useCallback(
|
|
79
97
|
(e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
@@ -96,9 +114,8 @@ const PrimaryTextInput: FC<IProps> = memo(
|
|
|
96
114
|
isFocused,
|
|
97
115
|
error,
|
|
98
116
|
onTouchStart ? true : editable,
|
|
99
|
-
theme,
|
|
100
117
|
);
|
|
101
|
-
}, [isFocused, error, editable, onTouchStart
|
|
118
|
+
}, [isFocused, error, editable, onTouchStart]);
|
|
102
119
|
|
|
103
120
|
const onLocalSubmitEditing = useCallback(
|
|
104
121
|
(e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => {
|
|
@@ -114,229 +131,202 @@ const PrimaryTextInput: FC<IProps> = memo(
|
|
|
114
131
|
return onTouchStart ? 'none' : undefined;
|
|
115
132
|
}, [onTouchStart]);
|
|
116
133
|
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
alignItems: 'center',
|
|
121
|
-
justifyContent: 'center',
|
|
122
|
-
minHeight: theme.spacing.xxxLarge, // 32px
|
|
123
|
-
textAlignVertical: 'center',
|
|
124
|
-
textAlign: 'center',
|
|
125
|
-
backgroundColor: theme.colors.grayScale_0,
|
|
126
|
-
borderRadius: theme.borderRadius.large, // 12px
|
|
127
|
-
borderWidth: theme.borderWidth.small, // 1px
|
|
128
|
-
borderColor: theme.colors.grayScale_50,
|
|
129
|
-
};
|
|
134
|
+
const handleChangeText = useCallback(
|
|
135
|
+
(text: string) => {
|
|
136
|
+
setRegexError(null);
|
|
130
137
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}),
|
|
145
|
-
} as TextStyle,
|
|
146
|
-
inputContainer: {
|
|
147
|
-
...commonInputContainer,
|
|
148
|
-
...Platform.select({
|
|
149
|
-
ios: {
|
|
150
|
-
paddingEnd: theme.spacing.xLarge, // 16px
|
|
151
|
-
},
|
|
152
|
-
}),
|
|
153
|
-
} as TextStyle,
|
|
154
|
-
errorInputContainer: {
|
|
155
|
-
...commonInputContainer,
|
|
156
|
-
...Platform.select({
|
|
157
|
-
android: {
|
|
158
|
-
borderColor: theme.colors.error_400,
|
|
159
|
-
},
|
|
160
|
-
}),
|
|
161
|
-
} as TextStyle,
|
|
162
|
-
disabledInputContainer: {
|
|
163
|
-
...commonInputContainer,
|
|
164
|
-
...Platform.select({
|
|
165
|
-
android: {
|
|
166
|
-
backgroundColor: theme.colors.grayScale_50,
|
|
167
|
-
borderColor: theme.colors.grayScale_50,
|
|
168
|
-
},
|
|
169
|
-
}),
|
|
170
|
-
} as TextStyle,
|
|
171
|
-
focusedInputContainer: {
|
|
172
|
-
...commonInputContainer,
|
|
173
|
-
...Platform.select({
|
|
174
|
-
android: {
|
|
175
|
-
borderColor: theme.colors.grayScale_50,
|
|
176
|
-
},
|
|
177
|
-
}),
|
|
178
|
-
} as TextStyle,
|
|
179
|
-
label: {
|
|
180
|
-
...CommonStyles.body_regular,
|
|
181
|
-
paddingBottom: theme.spacing.small, // 4px
|
|
182
|
-
} as TextStyle,
|
|
183
|
-
hint: {
|
|
184
|
-
...CommonStyles.normalText,
|
|
185
|
-
fontWeight: '200',
|
|
186
|
-
fontSize: theme.text.bodySmallRegular.fontSize, // 12px
|
|
187
|
-
lineHeight: theme.text.bodySmallRegular.lineHeight, // 16px
|
|
188
|
-
paddingTop: theme.spacing.small, // 4px
|
|
189
|
-
} as TextStyle,
|
|
190
|
-
error: {
|
|
191
|
-
...CommonStyles.normalText,
|
|
192
|
-
color: theme.colors.error_400,
|
|
193
|
-
fontSize: theme.text.bodySmallRegular.fontSize, // 12px
|
|
194
|
-
lineHeight: theme.text.bodySmallRegular.lineHeight, // 16px
|
|
195
|
-
paddingTop: theme.spacing.small, // 4px
|
|
196
|
-
} as TextStyle,
|
|
197
|
-
});
|
|
198
|
-
}, [theme]);
|
|
138
|
+
if (regex) {
|
|
139
|
+
const validation = regexValidation(text, regex, regexErrorMessage);
|
|
140
|
+
if (!validation.isValid) {
|
|
141
|
+
setRegexError(validation.message);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (props.onChangeText) {
|
|
146
|
+
props.onChangeText(text);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
[regex, regexErrorMessage, props.onChangeText],
|
|
150
|
+
);
|
|
199
151
|
|
|
200
152
|
return (
|
|
201
|
-
<View
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
153
|
+
<View
|
|
154
|
+
style={{
|
|
155
|
+
justifyContent: 'space-between',
|
|
156
|
+
gap: CommonSizes.spacing.small,
|
|
157
|
+
width: width ?? '100%',
|
|
158
|
+
}}>
|
|
159
|
+
<GradientBorderView
|
|
160
|
+
gradientProps={{
|
|
161
|
+
colors: [theme.colors.mutedLavender, theme.colors.indigoBlue],
|
|
162
|
+
}}
|
|
163
|
+
style={{
|
|
164
|
+
borderWidth: CommonSizes.borderWidth.small,
|
|
165
|
+
borderRadius: CommonSizes.borderRadius.medium,
|
|
166
|
+
height: height ?? scaleHeight(84),
|
|
167
|
+
width: '100%',
|
|
168
|
+
backgroundColor: theme.colors.backgroundOpacity,
|
|
169
|
+
}}>
|
|
212
170
|
<TextInput
|
|
213
171
|
disableFullscreenUI={true}
|
|
214
172
|
selectionColor={selectionColor}
|
|
215
173
|
{...props}
|
|
216
174
|
pointerEvents={pointerEvents}
|
|
217
175
|
ref={inputRef}
|
|
218
|
-
style={[
|
|
176
|
+
style={[
|
|
177
|
+
{
|
|
178
|
+
...theme.text.body1,
|
|
179
|
+
width: '100%',
|
|
180
|
+
zIndex: 2,
|
|
181
|
+
alignSelf: 'flex-start',
|
|
182
|
+
alignItems: 'center',
|
|
183
|
+
justifyContent: 'center',
|
|
184
|
+
flex: 1,
|
|
185
|
+
textAlignVertical: 'center',
|
|
186
|
+
paddingStart: CommonSizes.spacing.medium,
|
|
187
|
+
...Platform.select({
|
|
188
|
+
android: {
|
|
189
|
+
paddingEnd: CommonSizes.spacing.medium,
|
|
190
|
+
},
|
|
191
|
+
}),
|
|
192
|
+
},
|
|
193
|
+
style,
|
|
194
|
+
]}
|
|
195
|
+
onChangeText={handleChangeText}
|
|
196
|
+
placeholderTextColor={theme.colors.tintColor}
|
|
219
197
|
autoCapitalize="none"
|
|
220
198
|
autoComplete="off"
|
|
199
|
+
keyboardType={keyboardType}
|
|
200
|
+
editable={editable}
|
|
221
201
|
/>
|
|
222
|
-
</
|
|
223
|
-
<BottomText error={error} hint={hint}
|
|
202
|
+
</GradientBorderView>
|
|
203
|
+
<BottomText error={error || regexError} hint={hint} />
|
|
224
204
|
</View>
|
|
225
205
|
);
|
|
226
206
|
},
|
|
227
207
|
);
|
|
228
208
|
|
|
229
|
-
const Label: FC<{
|
|
230
|
-
text
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
209
|
+
const Label: FC<{text?: string; required?: boolean; optional?: boolean}> = memo(
|
|
210
|
+
({text, required, optional}) => {
|
|
211
|
+
const {theme} = useTheme();
|
|
212
|
+
if (text != null) {
|
|
213
|
+
return (
|
|
214
|
+
<Text
|
|
215
|
+
style={{
|
|
216
|
+
...theme.text.label,
|
|
217
|
+
color: theme.colors.indigoBlue,
|
|
218
|
+
}}
|
|
219
|
+
numberOfLines={1}>
|
|
220
|
+
{text +
|
|
221
|
+
(required
|
|
222
|
+
? localization.common.required
|
|
223
|
+
: optional
|
|
224
|
+
? localization.common.optional
|
|
225
|
+
: '')}
|
|
226
|
+
</Text>
|
|
227
|
+
);
|
|
228
|
+
} else {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
);
|
|
250
233
|
|
|
251
|
-
const BottomText: FC<{error?: string | null; hint?: string
|
|
252
|
-
|
|
234
|
+
const BottomText: FC<{error?: string | null; hint?: string}> = memo(
|
|
235
|
+
({error, hint}) => {
|
|
236
|
+
const {theme} = useTheme();
|
|
253
237
|
if (error != null) {
|
|
254
|
-
return
|
|
238
|
+
return (
|
|
239
|
+
<Text style={{...theme.text.body2, color: theme.colors.red}}>
|
|
240
|
+
{error}
|
|
241
|
+
</Text>
|
|
242
|
+
);
|
|
255
243
|
} else if (hint != null) {
|
|
256
244
|
return <Text style={styles.hint}>{hint}</Text>;
|
|
257
245
|
} else {
|
|
258
246
|
return null;
|
|
259
247
|
}
|
|
260
|
-
}
|
|
248
|
+
},
|
|
249
|
+
);
|
|
261
250
|
|
|
262
251
|
function getInputContainerStyle(
|
|
263
252
|
isFocused: boolean,
|
|
264
253
|
error?: string | null,
|
|
265
254
|
isEditable?: boolean,
|
|
266
|
-
theme?: any,
|
|
267
255
|
): ViewStyle {
|
|
268
|
-
const commonInputContainer: TextStyle = {
|
|
269
|
-
flexDirection: 'row',
|
|
270
|
-
alignItems: 'center',
|
|
271
|
-
justifyContent: 'center',
|
|
272
|
-
minHeight: theme.spacing.xxxLarge, // 32px
|
|
273
|
-
textAlignVertical: 'center',
|
|
274
|
-
textAlign: 'center',
|
|
275
|
-
backgroundColor: theme.colors.grayScale_0,
|
|
276
|
-
borderRadius: theme.borderRadius.large, // 12px
|
|
277
|
-
borderWidth: theme.borderWidth.small, // 1px
|
|
278
|
-
borderColor: theme.colors.grayScale_50,
|
|
279
|
-
};
|
|
280
|
-
|
|
281
256
|
if (isIos) {
|
|
282
|
-
return !isEditable
|
|
283
|
-
? {
|
|
284
|
-
...commonInputContainer,
|
|
285
|
-
...Platform.select({
|
|
286
|
-
android: {
|
|
287
|
-
backgroundColor: theme.colors.grayScale_50,
|
|
288
|
-
borderColor: theme.colors.grayScale_50,
|
|
289
|
-
},
|
|
290
|
-
}),
|
|
291
|
-
}
|
|
292
|
-
: {
|
|
293
|
-
...commonInputContainer,
|
|
294
|
-
...Platform.select({
|
|
295
|
-
ios: {
|
|
296
|
-
paddingEnd: theme.spacing.xLarge, // 16px
|
|
297
|
-
},
|
|
298
|
-
}),
|
|
299
|
-
};
|
|
257
|
+
return !isEditable ? styles.disabledInputContainer : styles.inputContainer;
|
|
300
258
|
} else {
|
|
301
259
|
if (isFocused) {
|
|
302
|
-
return
|
|
303
|
-
...commonInputContainer,
|
|
304
|
-
...Platform.select({
|
|
305
|
-
android: {
|
|
306
|
-
borderColor: theme.colors.grayScale_50,
|
|
307
|
-
},
|
|
308
|
-
}),
|
|
309
|
-
};
|
|
260
|
+
return styles.focusedInputContainer;
|
|
310
261
|
} else if (!isEditable) {
|
|
311
|
-
return
|
|
312
|
-
...commonInputContainer,
|
|
313
|
-
...Platform.select({
|
|
314
|
-
android: {
|
|
315
|
-
backgroundColor: theme.colors.grayScale_50,
|
|
316
|
-
borderColor: theme.colors.grayScale_50,
|
|
317
|
-
},
|
|
318
|
-
}),
|
|
319
|
-
};
|
|
262
|
+
return styles.disabledInputContainer;
|
|
320
263
|
} else if (error) {
|
|
321
|
-
return
|
|
322
|
-
...commonInputContainer,
|
|
323
|
-
...Platform.select({
|
|
324
|
-
android: {
|
|
325
|
-
borderColor: theme.colors.error_400,
|
|
326
|
-
},
|
|
327
|
-
}),
|
|
328
|
-
};
|
|
264
|
+
return styles.errorInputContainer;
|
|
329
265
|
} else {
|
|
330
|
-
return
|
|
331
|
-
...commonInputContainer,
|
|
332
|
-
...Platform.select({
|
|
333
|
-
ios: {
|
|
334
|
-
paddingEnd: theme.spacing.xLarge, // 16px
|
|
335
|
-
},
|
|
336
|
-
}),
|
|
337
|
-
};
|
|
266
|
+
return styles.inputContainer;
|
|
338
267
|
}
|
|
339
268
|
}
|
|
340
269
|
}
|
|
341
270
|
|
|
342
|
-
|
|
271
|
+
const selectionColor = NewColors.blueNormalActive;
|
|
272
|
+
|
|
273
|
+
const commonInputContainer: TextStyle = {
|
|
274
|
+
flexDirection: 'row',
|
|
275
|
+
alignItems: 'center',
|
|
276
|
+
justifyContent: 'center',
|
|
277
|
+
minHeight: CommonSizes.spacing.extraLarge,
|
|
278
|
+
textAlignVertical: 'center',
|
|
279
|
+
textAlign: 'center',
|
|
280
|
+
width: '100%',
|
|
281
|
+
borderRadius: CommonSizes.borderRadius.medium,
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const styles = StyleSheet.create({
|
|
285
|
+
container: {
|
|
286
|
+
flexDirection: 'column',
|
|
287
|
+
} as ViewStyle,
|
|
288
|
+
input: {
|
|
289
|
+
flex: 1,
|
|
290
|
+
textAlignVertical: 'center',
|
|
291
|
+
paddingStart: CommonSizes.spacing.medium,
|
|
292
|
+
...Platform.select({
|
|
293
|
+
android: {
|
|
294
|
+
paddingEnd: CommonSizes.spacing.medium,
|
|
295
|
+
},
|
|
296
|
+
}),
|
|
297
|
+
} as TextStyle,
|
|
298
|
+
inputContainer: {
|
|
299
|
+
...commonInputContainer,
|
|
300
|
+
...Platform.select({
|
|
301
|
+
ios: {
|
|
302
|
+
paddingEnd: CommonSizes.spacing.medium,
|
|
303
|
+
},
|
|
304
|
+
}),
|
|
305
|
+
} as TextStyle,
|
|
306
|
+
errorInputContainer: {
|
|
307
|
+
...commonInputContainer,
|
|
308
|
+
...Platform.select({
|
|
309
|
+
android: {
|
|
310
|
+
borderColor: NewColors.red,
|
|
311
|
+
},
|
|
312
|
+
}),
|
|
313
|
+
} as TextStyle,
|
|
314
|
+
disabledInputContainer: {
|
|
315
|
+
...commonInputContainer,
|
|
316
|
+
} as TextStyle,
|
|
317
|
+
focusedInputContainer: {
|
|
318
|
+
...commonInputContainer,
|
|
319
|
+
} as TextStyle,
|
|
320
|
+
label: {
|
|
321
|
+
...CommonStyles.body_regular,
|
|
322
|
+
} as TextStyle,
|
|
323
|
+
hint: {
|
|
324
|
+
...CommonStyles.normalText,
|
|
325
|
+
fontWeight: '200',
|
|
326
|
+
lineHeight: CommonSizes.lineHeight.small,
|
|
327
|
+
} as TextStyle,
|
|
328
|
+
error: {
|
|
329
|
+
...CommonStyles.normalText,
|
|
330
|
+
lineHeight: CommonSizes.lineHeight.small,
|
|
331
|
+
} as TextStyle,
|
|
332
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {FC, memo, useMemo} from 'react';
|
|
2
2
|
import {StyleSheet, View, ViewStyle} from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import {NewColors} from '../../core/theme/colors';
|
|
4
4
|
|
|
5
5
|
interface IProps {
|
|
6
6
|
isSelected: boolean;
|
|
@@ -41,14 +41,14 @@ const commonInnerCircle: ViewStyle = {
|
|
|
41
41
|
const styles = StyleSheet.create({
|
|
42
42
|
outerCircle: {
|
|
43
43
|
...commonOuterCircle,
|
|
44
|
-
borderColor:
|
|
44
|
+
borderColor: NewColors.blueNormalActive,
|
|
45
45
|
} as ViewStyle,
|
|
46
46
|
outerCircleSelected: {
|
|
47
47
|
...commonOuterCircle,
|
|
48
|
-
borderColor:
|
|
48
|
+
borderColor: NewColors.blueNormalActive,
|
|
49
49
|
} as ViewStyle,
|
|
50
50
|
innerCircle: {
|
|
51
51
|
...commonInnerCircle,
|
|
52
|
-
backgroundColor:
|
|
52
|
+
backgroundColor: NewColors.blueNormalActive,
|
|
53
53
|
} as ViewStyle,
|
|
54
54
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Text, TextProps} from 'react-native';
|
|
3
|
+
import {ensureString} from '../../core/utils/stringUtils';
|
|
4
|
+
|
|
5
|
+
interface SafeTextProps extends TextProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const SafeText: React.FC<SafeTextProps> = ({children, ...props}) => {
|
|
10
|
+
// Process children to ensure all text nodes are strings
|
|
11
|
+
const processChildren = (node: React.ReactNode): React.ReactNode => {
|
|
12
|
+
// If it's a string or number, it's safe
|
|
13
|
+
if (typeof node === 'string' || typeof node === 'number') {
|
|
14
|
+
return node;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// If it's null or undefined, return empty string
|
|
18
|
+
if (node === null || node === undefined) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// If it's a React element, process its children
|
|
23
|
+
if (React.isValidElement(node)) {
|
|
24
|
+
return React.cloneElement(
|
|
25
|
+
node,
|
|
26
|
+
node.props,
|
|
27
|
+
React.Children.map(node.props.children, processChildren),
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// If it's an array, process each item
|
|
32
|
+
if (Array.isArray(node)) {
|
|
33
|
+
return node.map(processChildren);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// For any other value (objects, etc.), convert to string
|
|
37
|
+
return ensureString(node);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return <Text {...props}>{processChildren(children)}</Text>;
|
|
41
|
+
};
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
I18nManager,
|
|
4
|
-
KeyboardTypeOptions,
|
|
5
|
-
Platform,
|
|
6
|
-
StyleProp,
|
|
7
3
|
StyleSheet,
|
|
8
4
|
TextInput,
|
|
9
|
-
|
|
5
|
+
View,
|
|
6
|
+
ViewStyle,
|
|
10
7
|
TextStyle,
|
|
11
8
|
TouchableOpacity,
|
|
12
|
-
|
|
9
|
+
StyleProp,
|
|
10
|
+
Platform,
|
|
11
|
+
KeyboardTypeOptions,
|
|
12
|
+
TextInputProps,
|
|
13
|
+
I18nManager,
|
|
14
|
+
NativeModules,
|
|
13
15
|
} from 'react-native';
|
|
14
|
-
import Icon from 'react-native-vector-icons/Ionicons';
|
|
15
|
-
import {CommonSizes} from '../../core/theme/commonSizes';
|
|
16
|
-
import {createThemedStyles} from '../../core/theme/commonStyles';
|
|
17
16
|
import {useTheme} from '../../core/theme/ThemeProvider';
|
|
18
|
-
import {Languages} from '../localization/localization';
|
|
19
17
|
import {
|
|
20
|
-
useLocalization,
|
|
21
18
|
useRTL,
|
|
22
19
|
useTranslation,
|
|
20
|
+
useLocalization,
|
|
23
21
|
} from '../localization/LocalizationProvider';
|
|
22
|
+
import {CommonSizes} from '../../core/theme/commonSizes';
|
|
24
23
|
import {RTLAwareView} from './RTLAwareView';
|
|
24
|
+
import Icon from 'react-native-vector-icons/Ionicons';
|
|
25
|
+
import {createThemedStyles} from '../../core/theme/commonStyles';
|
|
26
|
+
import {Languages} from '../localization/localization';
|
|
25
27
|
|
|
26
28
|
interface SearchBarProps {
|
|
27
29
|
value: string;
|
|
@@ -59,8 +61,8 @@ export const SearchBar: React.FC<SearchBarProps> = ({
|
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
const containerStyle: ViewStyle = {
|
|
62
|
-
backgroundColor: `${theme.colors.
|
|
63
|
-
borderColor: theme.colors.
|
|
64
|
+
backgroundColor: `${theme.colors.white}20`,
|
|
65
|
+
borderColor: theme.colors.mutedLavender30,
|
|
64
66
|
};
|
|
65
67
|
|
|
66
68
|
// Set keyboard language specific properties
|
|
@@ -111,14 +113,14 @@ export const SearchBar: React.FC<SearchBarProps> = ({
|
|
|
111
113
|
containerStyle,
|
|
112
114
|
style as ViewStyle,
|
|
113
115
|
{
|
|
114
|
-
backgroundColor: theme.colors.
|
|
116
|
+
backgroundColor: theme.colors.surface,
|
|
115
117
|
...createThemedStyles(theme).dropShadow,
|
|
116
118
|
},
|
|
117
119
|
]}>
|
|
118
120
|
<Icon
|
|
119
121
|
name="search"
|
|
120
122
|
size={20}
|
|
121
|
-
color={theme.colors.
|
|
123
|
+
color={theme.colors.mutedLavender}
|
|
122
124
|
style={styles.searchIcon}
|
|
123
125
|
/>
|
|
124
126
|
<TextInput
|
|
@@ -133,7 +135,7 @@ export const SearchBar: React.FC<SearchBarProps> = ({
|
|
|
133
135
|
inputStyle as TextStyle,
|
|
134
136
|
]}
|
|
135
137
|
placeholder={placeholder || t('search', 'common')}
|
|
136
|
-
placeholderTextColor={`${theme.colors.
|
|
138
|
+
placeholderTextColor={`${theme.colors.mutedLavender}80`}
|
|
137
139
|
value={value}
|
|
138
140
|
onChangeText={onChangeText}
|
|
139
141
|
autoCapitalize="none"
|
|
@@ -146,7 +148,7 @@ export const SearchBar: React.FC<SearchBarProps> = ({
|
|
|
146
148
|
<Icon
|
|
147
149
|
name="close-circle"
|
|
148
150
|
size={20}
|
|
149
|
-
color={theme.colors.
|
|
151
|
+
color={theme.colors.mutedLavender}
|
|
150
152
|
/>
|
|
151
153
|
</TouchableOpacity>
|
|
152
154
|
)}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
TouchableOpacity,
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
import {
|
|
9
|
+
import {Colors, NewColors} from '../../core/theme/colors';
|
|
10
10
|
import {CommonSizes} from '../../core/theme/commonSizes';
|
|
11
11
|
import {CommonStyles} from '../../core/theme/commonStyles';
|
|
12
12
|
import {localization} from '../localization/localization';
|
|
@@ -38,11 +38,11 @@ const styles = StyleSheet.create({
|
|
|
38
38
|
title: {
|
|
39
39
|
...CommonStyles.normalText,
|
|
40
40
|
textAlign: 'center',
|
|
41
|
-
marginBottom: CommonSizes.spacing.
|
|
41
|
+
marginBottom: CommonSizes.spacing.extraSmall,
|
|
42
42
|
} as TextStyle,
|
|
43
43
|
description: {
|
|
44
44
|
...CommonStyles.normalText,
|
|
45
|
-
color:
|
|
45
|
+
color: NewColors.blueNormalActive,
|
|
46
46
|
textAlign: 'center',
|
|
47
47
|
textDecorationLine: 'underline',
|
|
48
48
|
} as TextStyle,
|
|
@@ -8,7 +8,12 @@ import {setDateLocale} from './dateFormatter';
|
|
|
8
8
|
import {loginLocalization} from './translations/loginLocalization';
|
|
9
9
|
import {homeLocalization} from './translations/homeLocalization';
|
|
10
10
|
import {profileLocalization} from './translations/profileLocalization';
|
|
11
|
+
import {otpLocalization} from './translations/otpLocalization';
|
|
12
|
+
import {passwordLocalization} from './translations/passwordLocalization';
|
|
13
|
+
import {navigationLocalization} from './translations/navigationLocalization';
|
|
14
|
+
import {mainNavigationLocalization} from './translations/mainNavigationLocalization';
|
|
11
15
|
import {I18nManager} from 'react-native';
|
|
16
|
+
import {posLocalization} from './translations/posLocalization';
|
|
12
17
|
|
|
13
18
|
export enum Languages {
|
|
14
19
|
en = 'en',
|
|
@@ -24,6 +29,11 @@ export const localization = {
|
|
|
24
29
|
login: new LocalizedStrings(loginLocalization),
|
|
25
30
|
home: new LocalizedStrings(homeLocalization),
|
|
26
31
|
profile: new LocalizedStrings(profileLocalization),
|
|
32
|
+
otp: new LocalizedStrings(otpLocalization),
|
|
33
|
+
password: new LocalizedStrings(passwordLocalization),
|
|
34
|
+
navigation: new LocalizedStrings(navigationLocalization),
|
|
35
|
+
mainNavigation: new LocalizedStrings(mainNavigationLocalization),
|
|
36
|
+
pos: new LocalizedStrings(posLocalization),
|
|
27
37
|
};
|
|
28
38
|
|
|
29
39
|
export function getLanguage(): string {
|