@fadyshawky/react-native-magic 2.0.1 → 2.0.3
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/components/Cards.tsx +5 -5
- package/template/src/common/components/EmptyView.tsx +1 -1
- package/template/src/common/components/ImageCropPickerButton.tsx +1 -1
- package/template/src/common/components/OTPInput.tsx +5 -5
- package/template/src/common/components/PhotoTakingButton.tsx +2 -2
- package/template/src/common/components/PrimaryButton.tsx +19 -19
- package/template/src/common/components/PrimaryTextInput.tsx +195 -129
- package/template/src/common/components/RadioButton.tsx +2 -2
- package/template/src/common/components/RadioIcon.tsx +4 -4
- package/template/src/common/components/SearchBar.tsx +13 -13
- package/template/src/common/components/Separator.tsx +1 -1
- package/template/src/common/components/Stepper.tsx +153 -0
- package/template/src/common/components/TryAgain.tsx +3 -3
- package/template/src/common/helpers/defaultKeyIdExtractor.ts +1 -1
- package/template/src/common/helpers/shareHelpers.ts +47 -0
- package/template/src/common/helpers/stringsHelpers.ts +0 -4
- package/template/src/core/api/errorHandler.ts +1 -2
- package/template/src/core/store/app/appSlice.ts +5 -13
- package/template/src/core/store/app/appState.ts +2 -10
- package/template/src/core/theme/colors.ts +94 -72
- package/template/src/core/theme/commonSizes.ts +110 -43
- package/template/src/core/theme/commonStyles.ts +22 -22
- package/template/src/core/theme/fonts.ts +13 -14
- package/template/src/core/theme/shadows.ts +135 -0
- package/template/src/core/theme/themes.ts +386 -75
- package/template/src/core/theme/types.ts +145 -18
- package/template/src/navigation/HeaderComponents.tsx +1 -1
- package/template/src/navigation/MainNavigation.tsx +1 -2
- package/template/src/navigation/MainStack.tsx +1 -1
- package/template/src/navigation/TabBar.tsx +3 -3
- package/template/src/navigation/TopTabBar.tsx +5 -3
- package/template/src/screens/Login/Login.tsx +0 -14
- package/template/src/screens/home/HomeScreen.tsx +14 -14
- package/template/src/screens/home/components/CarouselSection.tsx +9 -9
- package/template/src/screens/home/components/FeaturedCarousel.tsx +10 -10
- package/template/src/screens/registration/RegistrationScreen.tsx +6 -6
- package/template/src/screens/resetPassword/ForgotPasswordScreen.tsx +6 -6
- package/template/src/types/react-native-config.d.ts +8 -0
package/package.json
CHANGED
|
@@ -61,8 +61,8 @@ export const Card = ({
|
|
|
61
61
|
|
|
62
62
|
const styles = StyleSheet.create({
|
|
63
63
|
card: {
|
|
64
|
-
padding: CommonSizes.spacing.
|
|
65
|
-
borderRadius: CommonSizes.borderRadius.
|
|
64
|
+
padding: CommonSizes.spacing.medium,
|
|
65
|
+
borderRadius: CommonSizes.borderRadius.large,
|
|
66
66
|
alignItems: 'center',
|
|
67
67
|
justifyContent: 'flex-start',
|
|
68
68
|
gap: scaleHeight(10),
|
|
@@ -71,7 +71,7 @@ const styles = StyleSheet.create({
|
|
|
71
71
|
},
|
|
72
72
|
blurContainer: {
|
|
73
73
|
flex: 1,
|
|
74
|
-
padding: CommonSizes.spacing.
|
|
74
|
+
padding: CommonSizes.spacing.medium,
|
|
75
75
|
alignItems: 'center',
|
|
76
76
|
justifyContent: 'center',
|
|
77
77
|
},
|
|
@@ -80,9 +80,9 @@ const styles = StyleSheet.create({
|
|
|
80
80
|
height: scaleHeight(100),
|
|
81
81
|
},
|
|
82
82
|
title: {
|
|
83
|
-
fontSize: CommonSizes.
|
|
83
|
+
fontSize: CommonSizes.fontSize.body2,
|
|
84
84
|
textAlign: 'center',
|
|
85
|
-
marginBottom: CommonSizes.spacing.
|
|
85
|
+
marginBottom: CommonSizes.spacing.small,
|
|
86
86
|
},
|
|
87
87
|
dotsContainer: {
|
|
88
88
|
flexDirection: 'row',
|
|
@@ -22,7 +22,7 @@ const styles = StyleSheet.create({
|
|
|
22
22
|
...CommonStyles.normalText,
|
|
23
23
|
fontWeight: '600',
|
|
24
24
|
textAlign: 'center',
|
|
25
|
-
marginBottom: CommonSizes.spacing.
|
|
25
|
+
marginBottom: CommonSizes.spacing.extraSmall,
|
|
26
26
|
} as TextStyle,
|
|
27
27
|
description: {
|
|
28
28
|
...CommonStyles.normalText,
|
|
@@ -61,7 +61,7 @@ export const OTPInput: React.FC<OTPInputProps> = ({
|
|
|
61
61
|
<RTLAwareView style={{...styles.container, ...style}}>
|
|
62
62
|
{[0, 1, 2, 3, 4, 5].map(index => (
|
|
63
63
|
<PrimaryTextInput
|
|
64
|
-
|
|
64
|
+
width={scaleWidth(78)}
|
|
65
65
|
key={index}
|
|
66
66
|
inputRef={ref => (inputRefs.current[index] = ref)}
|
|
67
67
|
style={[
|
|
@@ -94,14 +94,14 @@ const styles = StyleSheet.create({
|
|
|
94
94
|
flexDirection: 'row',
|
|
95
95
|
justifyContent: 'space-between',
|
|
96
96
|
width: '100%',
|
|
97
|
-
gap: CommonSizes.spacing.
|
|
98
|
-
paddingHorizontal: CommonSizes.spacing.
|
|
97
|
+
gap: CommonSizes.spacing.small,
|
|
98
|
+
paddingHorizontal: CommonSizes.spacing.large,
|
|
99
99
|
},
|
|
100
100
|
input: {
|
|
101
101
|
flex: 1,
|
|
102
|
-
height: CommonSizes.spacing.
|
|
102
|
+
height: CommonSizes.spacing.xxl,
|
|
103
103
|
borderWidth: 1,
|
|
104
|
-
borderRadius: CommonSizes.borderRadius.
|
|
104
|
+
borderRadius: CommonSizes.borderRadius.medium,
|
|
105
105
|
textAlign: 'center',
|
|
106
106
|
},
|
|
107
107
|
});
|
|
@@ -73,7 +73,7 @@ const styles = StyleSheet.create({
|
|
|
73
73
|
width: 120,
|
|
74
74
|
alignItems: 'center',
|
|
75
75
|
justifyContent: 'center',
|
|
76
|
-
borderRadius: CommonSizes.borderRadius.
|
|
76
|
+
borderRadius: CommonSizes.borderRadius.small,
|
|
77
77
|
borderWidth: 1,
|
|
78
78
|
} as ViewStyle,
|
|
79
79
|
image: {
|
|
@@ -82,7 +82,7 @@ const styles = StyleSheet.create({
|
|
|
82
82
|
resizeMode: 'contain',
|
|
83
83
|
alignItems: 'center',
|
|
84
84
|
justifyContent: 'center',
|
|
85
|
-
borderRadius: CommonSizes.borderRadius.
|
|
85
|
+
borderRadius: CommonSizes.borderRadius.small,
|
|
86
86
|
overflow: 'hidden',
|
|
87
87
|
} as ImageStyle,
|
|
88
88
|
icon: {
|
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
TouchablePlatformProps,
|
|
18
18
|
} from '../../../types';
|
|
19
19
|
import {useTheme} from '../../core/theme/ThemeProvider';
|
|
20
|
-
import {CommonSizes} from '../../core/theme/commonSizes';
|
|
21
20
|
import {createThemedStyles} from '../../core/theme/commonStyles';
|
|
22
21
|
import {Theme} from '../../core/theme/types';
|
|
23
22
|
import {IconPlatform} from './IconPlatform';
|
|
24
23
|
import {TouchablePlatform} from './TouchablePlatform';
|
|
25
24
|
import {scaleHeight, scaleSpacing} from '../../core/theme/scaling';
|
|
25
|
+
import {CommonSizes} from '../../core/theme/commonSizes';
|
|
26
26
|
|
|
27
27
|
interface IProps extends TouchablePlatformProps {
|
|
28
28
|
label: string;
|
|
@@ -58,7 +58,7 @@ export const PrimaryButton: FC<IProps> = memo(
|
|
|
58
58
|
return (
|
|
59
59
|
<ActivityIndicator
|
|
60
60
|
animating={true}
|
|
61
|
-
color={theme.colors.
|
|
61
|
+
color={theme.colors.grayScale_50}
|
|
62
62
|
size={'small'}
|
|
63
63
|
/>
|
|
64
64
|
);
|
|
@@ -91,7 +91,7 @@ export const PrimaryButton: FC<IProps> = memo(
|
|
|
91
91
|
return (
|
|
92
92
|
<TouchablePlatform
|
|
93
93
|
style={[styles.button, style] as ViewStyle[]}
|
|
94
|
-
highlightColor={theme.colors.
|
|
94
|
+
highlightColor={theme.colors.grayScale_50}
|
|
95
95
|
{...props}>
|
|
96
96
|
{content}
|
|
97
97
|
</TouchablePlatform>
|
|
@@ -158,19 +158,19 @@ function mergeStylesWithDisabled(
|
|
|
158
158
|
...styles,
|
|
159
159
|
button: {
|
|
160
160
|
...styles.button,
|
|
161
|
-
backgroundColor: theme.colors.
|
|
161
|
+
backgroundColor: theme.colors.grayScale_50,
|
|
162
162
|
borderColor: outline
|
|
163
|
-
? theme.colors.
|
|
163
|
+
? theme.colors.grayScale_50
|
|
164
164
|
: styles.button.borderColor,
|
|
165
165
|
elevation: 0,
|
|
166
166
|
} as ViewStyle,
|
|
167
167
|
icon: {
|
|
168
168
|
...styles.icon,
|
|
169
|
-
tintColor: theme.colors.
|
|
169
|
+
tintColor: theme.colors.grayScale_50,
|
|
170
170
|
} as ImageStyle,
|
|
171
171
|
label: {
|
|
172
172
|
...styles.label,
|
|
173
|
-
color: theme.colors.
|
|
173
|
+
color: theme.colors.grayScale_50,
|
|
174
174
|
} as TextStyle,
|
|
175
175
|
};
|
|
176
176
|
}
|
|
@@ -194,7 +194,7 @@ function createButtonStyles(theme: Theme) {
|
|
|
194
194
|
|
|
195
195
|
const commonLabelStyle: TextStyle = {
|
|
196
196
|
...createThemedStyles(theme).h4_bold,
|
|
197
|
-
color: theme.colors.
|
|
197
|
+
color: theme.colors.grayScale_0,
|
|
198
198
|
textAlign: 'center',
|
|
199
199
|
textAlignVertical: 'center',
|
|
200
200
|
...Platform.select({
|
|
@@ -209,26 +209,26 @@ function createButtonStyles(theme: Theme) {
|
|
|
209
209
|
height: 22,
|
|
210
210
|
marginHorizontal: scaleSpacing(12),
|
|
211
211
|
resizeMode: 'contain',
|
|
212
|
-
tintColor: theme.colors.
|
|
212
|
+
tintColor: theme.colors.PlatinateBlue_700,
|
|
213
213
|
};
|
|
214
214
|
|
|
215
215
|
return {
|
|
216
216
|
solid: StyleSheet.create({
|
|
217
217
|
button: {
|
|
218
218
|
...commonButtonStyle,
|
|
219
|
-
backgroundColor: theme.colors.
|
|
219
|
+
backgroundColor: theme.colors.PlatinateBlue_700,
|
|
220
220
|
} as ViewStyle,
|
|
221
221
|
label: theme.text.button,
|
|
222
222
|
icon: {
|
|
223
223
|
...commonIcon,
|
|
224
|
-
tintColor: theme.colors.
|
|
224
|
+
tintColor: theme.colors.grayScale_0,
|
|
225
225
|
},
|
|
226
226
|
}),
|
|
227
227
|
|
|
228
228
|
outline: StyleSheet.create({
|
|
229
229
|
button: {
|
|
230
230
|
...commonButtonStyle,
|
|
231
|
-
borderColor: theme.colors.
|
|
231
|
+
borderColor: theme.colors.PlatinateBlue_700,
|
|
232
232
|
borderWidth: 2,
|
|
233
233
|
} as ViewStyle,
|
|
234
234
|
label: {
|
|
@@ -240,7 +240,7 @@ function createButtonStyles(theme: Theme) {
|
|
|
240
240
|
outlineNegative: StyleSheet.create({
|
|
241
241
|
button: {
|
|
242
242
|
...commonButtonStyle,
|
|
243
|
-
borderColor: theme.colors.
|
|
243
|
+
borderColor: theme.colors.PlatinateBlue_700,
|
|
244
244
|
borderWidth: 2,
|
|
245
245
|
} as ViewStyle,
|
|
246
246
|
label: {
|
|
@@ -248,7 +248,7 @@ function createButtonStyles(theme: Theme) {
|
|
|
248
248
|
} as TextStyle,
|
|
249
249
|
icon: {
|
|
250
250
|
...commonIcon,
|
|
251
|
-
tintColor: theme.colors.
|
|
251
|
+
tintColor: theme.colors.PlatinateBlue_700,
|
|
252
252
|
},
|
|
253
253
|
}),
|
|
254
254
|
|
|
@@ -276,7 +276,7 @@ function createSmallSolidStyles(theme: Theme): IStyles {
|
|
|
276
276
|
justifyContent: 'center',
|
|
277
277
|
borderRadius: CommonSizes.borderRadius.xl,
|
|
278
278
|
flexDirection: 'row',
|
|
279
|
-
backgroundColor: theme.colors.
|
|
279
|
+
backgroundColor: theme.colors.PlatinateBlue_700,
|
|
280
280
|
// width: 175,
|
|
281
281
|
} as ViewStyle,
|
|
282
282
|
label: {
|
|
@@ -286,7 +286,7 @@ function createSmallSolidStyles(theme: Theme): IStyles {
|
|
|
286
286
|
width: 22,
|
|
287
287
|
height: 22,
|
|
288
288
|
resizeMode: 'contain',
|
|
289
|
-
tintColor: theme.colors.
|
|
289
|
+
tintColor: theme.colors.grayScale_0,
|
|
290
290
|
} as ImageStyle,
|
|
291
291
|
});
|
|
292
292
|
}
|
|
@@ -302,18 +302,18 @@ function createSmallOutlineStyles(theme: Theme): IStyles {
|
|
|
302
302
|
flexDirection: 'row',
|
|
303
303
|
backgroundColor: 'transparent',
|
|
304
304
|
width: 175,
|
|
305
|
-
borderColor: theme.colors.
|
|
305
|
+
borderColor: theme.colors.PlatinateBlue_700,
|
|
306
306
|
borderWidth: 1,
|
|
307
307
|
} as ViewStyle,
|
|
308
308
|
label: {
|
|
309
309
|
...commonStyles.normalText,
|
|
310
|
-
color: theme.colors.
|
|
310
|
+
color: theme.colors.PlatinateBlue_700,
|
|
311
311
|
} as TextStyle,
|
|
312
312
|
icon: {
|
|
313
313
|
width: 22,
|
|
314
314
|
height: 22,
|
|
315
315
|
resizeMode: 'contain',
|
|
316
|
-
tintColor: theme.colors.
|
|
316
|
+
tintColor: theme.colors.PlatinateBlue_700,
|
|
317
317
|
} as ImageStyle,
|
|
318
318
|
});
|
|
319
319
|
}
|
|
@@ -21,9 +21,8 @@ import {
|
|
|
21
21
|
View,
|
|
22
22
|
ViewStyle,
|
|
23
23
|
} from 'react-native';
|
|
24
|
-
import {
|
|
24
|
+
import {useTheme} from '../../core/theme/ThemeProvider';
|
|
25
25
|
import {isIos} from '../../core/theme/commonConsts';
|
|
26
|
-
import {CommonSizes} from '../../core/theme/commonSizes';
|
|
27
26
|
import {CommonStyles} from '../../core/theme/commonStyles';
|
|
28
27
|
import {localization} from '../localization/localization';
|
|
29
28
|
|
|
@@ -53,31 +52,28 @@ interface IProps extends TextInputProps {
|
|
|
53
52
|
inputContainerStyle?: ViewStyle;
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
const PrimaryTextInput: FC<IProps> = memo(
|
|
57
56
|
({
|
|
58
|
-
style
|
|
59
|
-
|
|
60
|
-
disableFullscreenUI = true,
|
|
61
|
-
enablesReturnKeyAutomatically = true,
|
|
62
|
-
underlineColorAndroid = Colors.white,
|
|
63
|
-
placeholderTextColor = Colors.gray,
|
|
64
|
-
editable = true,
|
|
65
|
-
clearButtonMode = 'while-editing',
|
|
57
|
+
style,
|
|
58
|
+
containerStyle,
|
|
66
59
|
label,
|
|
67
60
|
error,
|
|
68
61
|
hint,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
nextInputFocusRef,
|
|
72
|
-
onTouchStart,
|
|
62
|
+
required,
|
|
63
|
+
optional,
|
|
73
64
|
onFocus,
|
|
74
65
|
onBlur,
|
|
75
66
|
onSubmitEditing,
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
nextInputFocusRef,
|
|
68
|
+
inputRef,
|
|
69
|
+
onTouchStart,
|
|
70
|
+
editable = true,
|
|
78
71
|
...props
|
|
79
72
|
}) => {
|
|
80
73
|
const [isFocused, setFocused] = useState<boolean>(false);
|
|
74
|
+
const {theme} = useTheme();
|
|
75
|
+
|
|
76
|
+
const selectionColor = theme.colors.PlatinateBlue_700;
|
|
81
77
|
|
|
82
78
|
const onLocalFocus = useCallback(
|
|
83
79
|
(e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
@@ -100,8 +96,9 @@ export const PrimaryTextInput: FC<IProps> = memo(
|
|
|
100
96
|
isFocused,
|
|
101
97
|
error,
|
|
102
98
|
onTouchStart ? true : editable,
|
|
99
|
+
theme,
|
|
103
100
|
);
|
|
104
|
-
}, [isFocused, error, editable, onTouchStart]);
|
|
101
|
+
}, [isFocused, error, editable, onTouchStart, theme]);
|
|
105
102
|
|
|
106
103
|
const onLocalSubmitEditing = useCallback(
|
|
107
104
|
(e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => {
|
|
@@ -117,9 +114,97 @@ export const PrimaryTextInput: FC<IProps> = memo(
|
|
|
117
114
|
return onTouchStart ? 'none' : undefined;
|
|
118
115
|
}, [onTouchStart]);
|
|
119
116
|
|
|
117
|
+
const styles = useMemo(() => {
|
|
118
|
+
const commonInputContainer: TextStyle = {
|
|
119
|
+
flexDirection: 'row',
|
|
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
|
+
};
|
|
130
|
+
|
|
131
|
+
return StyleSheet.create({
|
|
132
|
+
container: {
|
|
133
|
+
flexDirection: 'column',
|
|
134
|
+
} as ViewStyle,
|
|
135
|
+
input: {
|
|
136
|
+
...CommonStyles.normalText,
|
|
137
|
+
flex: 1,
|
|
138
|
+
textAlignVertical: 'center',
|
|
139
|
+
paddingStart: theme.spacing.xLarge, // 16px
|
|
140
|
+
...Platform.select({
|
|
141
|
+
android: {
|
|
142
|
+
paddingEnd: theme.spacing.xLarge, // 16px
|
|
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]);
|
|
199
|
+
|
|
120
200
|
return (
|
|
121
201
|
<View style={[styles.container, containerStyle]}>
|
|
122
|
-
<Label
|
|
202
|
+
<Label
|
|
203
|
+
text={label}
|
|
204
|
+
required={required}
|
|
205
|
+
optional={optional}
|
|
206
|
+
styles={styles}
|
|
207
|
+
/>
|
|
123
208
|
<TouchableOpacity
|
|
124
209
|
style={[inputContainerStyle, props.inputContainerStyle]}
|
|
125
210
|
onPress={onTouchStart}
|
|
@@ -135,33 +220,36 @@ export const PrimaryTextInput: FC<IProps> = memo(
|
|
|
135
220
|
autoComplete="off"
|
|
136
221
|
/>
|
|
137
222
|
</TouchableOpacity>
|
|
138
|
-
<BottomText error={error} hint={hint} />
|
|
223
|
+
<BottomText error={error} hint={hint} styles={styles} />
|
|
139
224
|
</View>
|
|
140
225
|
);
|
|
141
226
|
},
|
|
142
227
|
);
|
|
143
228
|
|
|
144
|
-
const Label: FC<{
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
229
|
+
const Label: FC<{
|
|
230
|
+
text?: string;
|
|
231
|
+
required?: boolean;
|
|
232
|
+
optional?: boolean;
|
|
233
|
+
styles: any;
|
|
234
|
+
}> = memo(({text, required, optional, styles}) => {
|
|
235
|
+
if (text != null) {
|
|
236
|
+
return (
|
|
237
|
+
<Text style={styles.label} numberOfLines={1}>
|
|
238
|
+
{text +
|
|
239
|
+
(required
|
|
240
|
+
? localization.common.required
|
|
241
|
+
: optional
|
|
242
|
+
? localization.common.optional
|
|
243
|
+
: '')}
|
|
244
|
+
</Text>
|
|
245
|
+
);
|
|
246
|
+
} else {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
162
250
|
|
|
163
|
-
const BottomText: FC<{error?: string | null; hint?: string}> =
|
|
164
|
-
({error, hint}) => {
|
|
251
|
+
const BottomText: FC<{error?: string | null; hint?: string; styles: any}> =
|
|
252
|
+
memo(({error, hint, styles}) => {
|
|
165
253
|
if (error != null) {
|
|
166
254
|
return <Text style={styles.error}>{error}</Text>;
|
|
167
255
|
} else if (hint != null) {
|
|
@@ -169,108 +257,86 @@ const BottomText: FC<{error?: string | null; hint?: string}> = memo(
|
|
|
169
257
|
} else {
|
|
170
258
|
return null;
|
|
171
259
|
}
|
|
172
|
-
}
|
|
173
|
-
);
|
|
260
|
+
});
|
|
174
261
|
|
|
175
262
|
function getInputContainerStyle(
|
|
176
263
|
isFocused: boolean,
|
|
177
264
|
error?: string | null,
|
|
178
265
|
isEditable?: boolean,
|
|
266
|
+
theme?: any,
|
|
179
267
|
): 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
|
+
|
|
180
281
|
if (isIos) {
|
|
181
|
-
return !isEditable
|
|
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
|
+
};
|
|
182
300
|
} else {
|
|
183
301
|
if (isFocused) {
|
|
184
|
-
return
|
|
302
|
+
return {
|
|
303
|
+
...commonInputContainer,
|
|
304
|
+
...Platform.select({
|
|
305
|
+
android: {
|
|
306
|
+
borderColor: theme.colors.grayScale_50,
|
|
307
|
+
},
|
|
308
|
+
}),
|
|
309
|
+
};
|
|
185
310
|
} else if (!isEditable) {
|
|
186
|
-
return
|
|
311
|
+
return {
|
|
312
|
+
...commonInputContainer,
|
|
313
|
+
...Platform.select({
|
|
314
|
+
android: {
|
|
315
|
+
backgroundColor: theme.colors.grayScale_50,
|
|
316
|
+
borderColor: theme.colors.grayScale_50,
|
|
317
|
+
},
|
|
318
|
+
}),
|
|
319
|
+
};
|
|
187
320
|
} else if (error) {
|
|
188
|
-
return
|
|
321
|
+
return {
|
|
322
|
+
...commonInputContainer,
|
|
323
|
+
...Platform.select({
|
|
324
|
+
android: {
|
|
325
|
+
borderColor: theme.colors.error_400,
|
|
326
|
+
},
|
|
327
|
+
}),
|
|
328
|
+
};
|
|
189
329
|
} else {
|
|
190
|
-
return
|
|
330
|
+
return {
|
|
331
|
+
...commonInputContainer,
|
|
332
|
+
...Platform.select({
|
|
333
|
+
ios: {
|
|
334
|
+
paddingEnd: theme.spacing.xLarge, // 16px
|
|
335
|
+
},
|
|
336
|
+
}),
|
|
337
|
+
};
|
|
191
338
|
}
|
|
192
339
|
}
|
|
193
340
|
}
|
|
194
341
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
const commonInputContainer: TextStyle = {
|
|
198
|
-
flexDirection: 'row',
|
|
199
|
-
alignItems: 'center',
|
|
200
|
-
justifyContent: 'center',
|
|
201
|
-
minHeight: CommonSizes.spacing.xl,
|
|
202
|
-
textAlignVertical: 'center',
|
|
203
|
-
textAlign: 'center',
|
|
204
|
-
backgroundColor: Colors.white,
|
|
205
|
-
borderRadius: CommonSizes.borderRadius.md,
|
|
206
|
-
borderWidth: CommonSizes.borderWidth.small,
|
|
207
|
-
borderColor: Colors.gray,
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
const styles = StyleSheet.create({
|
|
211
|
-
container: {
|
|
212
|
-
flexDirection: 'column',
|
|
213
|
-
} as ViewStyle,
|
|
214
|
-
input: {
|
|
215
|
-
...CommonStyles.normalText,
|
|
216
|
-
flex: 1,
|
|
217
|
-
textAlignVertical: 'center',
|
|
218
|
-
paddingStart: CommonSizes.spacing.md,
|
|
219
|
-
...Platform.select({
|
|
220
|
-
android: {
|
|
221
|
-
paddingEnd: CommonSizes.spacing.md,
|
|
222
|
-
},
|
|
223
|
-
}),
|
|
224
|
-
} as TextStyle,
|
|
225
|
-
inputContainer: {
|
|
226
|
-
...commonInputContainer,
|
|
227
|
-
...Platform.select({
|
|
228
|
-
ios: {
|
|
229
|
-
paddingEnd: CommonSizes.spacing.md,
|
|
230
|
-
},
|
|
231
|
-
}),
|
|
232
|
-
} as TextStyle,
|
|
233
|
-
errorInputContainer: {
|
|
234
|
-
...commonInputContainer,
|
|
235
|
-
...Platform.select({
|
|
236
|
-
android: {
|
|
237
|
-
borderColor: Colors.red,
|
|
238
|
-
},
|
|
239
|
-
}),
|
|
240
|
-
} as TextStyle,
|
|
241
|
-
disabledInputContainer: {
|
|
242
|
-
...commonInputContainer,
|
|
243
|
-
...Platform.select({
|
|
244
|
-
android: {
|
|
245
|
-
backgroundColor: Colors.gray,
|
|
246
|
-
borderColor: Colors.gray,
|
|
247
|
-
},
|
|
248
|
-
}),
|
|
249
|
-
} as TextStyle,
|
|
250
|
-
focusedInputContainer: {
|
|
251
|
-
...commonInputContainer,
|
|
252
|
-
...Platform.select({
|
|
253
|
-
android: {
|
|
254
|
-
borderColor: Colors.gray,
|
|
255
|
-
},
|
|
256
|
-
}),
|
|
257
|
-
} as TextStyle,
|
|
258
|
-
label: {
|
|
259
|
-
...CommonStyles.body_regular,
|
|
260
|
-
paddingBottom: CommonSizes.spacing.xs,
|
|
261
|
-
} as TextStyle,
|
|
262
|
-
hint: {
|
|
263
|
-
...CommonStyles.normalText,
|
|
264
|
-
fontWeight: '200',
|
|
265
|
-
fontSize: CommonSizes.font.small,
|
|
266
|
-
lineHeight: CommonSizes.lineHeight.small,
|
|
267
|
-
paddingTop: CommonSizes.spacing.xs,
|
|
268
|
-
} as TextStyle,
|
|
269
|
-
error: {
|
|
270
|
-
...CommonStyles.normalText,
|
|
271
|
-
color: Colors.red,
|
|
272
|
-
fontSize: CommonSizes.font.small,
|
|
273
|
-
lineHeight: CommonSizes.lineHeight.small,
|
|
274
|
-
paddingTop: CommonSizes.spacing.xs,
|
|
275
|
-
} as TextStyle,
|
|
276
|
-
});
|
|
342
|
+
export {PrimaryTextInput};
|
|
@@ -46,13 +46,13 @@ export const RadioButton: FC<IProps> = memo(
|
|
|
46
46
|
const commonLabel: TextStyle = {
|
|
47
47
|
...CommonStyles.normalText,
|
|
48
48
|
flex: 1,
|
|
49
|
-
paddingStart: CommonSizes.spacing.
|
|
49
|
+
paddingStart: CommonSizes.spacing.extraSmall,
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const styles = StyleSheet.create({
|
|
53
53
|
container: {
|
|
54
54
|
flexDirection: 'row',
|
|
55
|
-
padding: CommonSizes.spacing.
|
|
55
|
+
padding: CommonSizes.spacing.medium,
|
|
56
56
|
alignItems: 'center',
|
|
57
57
|
} as ViewStyle,
|
|
58
58
|
label: {
|