@hoddy-ui/next 1.0.3 → 1.0.29
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/dist/index.d.mts +32 -3
- package/dist/index.d.ts +32 -3
- package/dist/index.js +327 -272
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +357 -299
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -4,61 +4,65 @@ var setExtraColors = (c) => extraColors = c;
|
|
|
4
4
|
function colors(theme) {
|
|
5
5
|
const lightColors = {
|
|
6
6
|
white: {
|
|
7
|
-
1: "#
|
|
7
|
+
1: "#ffffff",
|
|
8
8
|
2: "#f7f7f7",
|
|
9
|
-
3: "#
|
|
10
|
-
4: "#
|
|
11
|
-
5: "#
|
|
9
|
+
3: "#eeeeee",
|
|
10
|
+
4: "#dddddd",
|
|
11
|
+
5: "#bbbbbb",
|
|
12
|
+
...extraColors?.light?.white
|
|
12
13
|
},
|
|
13
14
|
black: {
|
|
14
|
-
1: "#
|
|
15
|
-
2: "#
|
|
16
|
-
3: "#
|
|
17
|
-
4: "#
|
|
18
|
-
5: "#
|
|
15
|
+
1: "#888888",
|
|
16
|
+
2: "#777777",
|
|
17
|
+
3: "#555555",
|
|
18
|
+
4: "#333333",
|
|
19
|
+
5: "#000000",
|
|
20
|
+
...extraColors?.light?.black
|
|
19
21
|
}
|
|
20
22
|
};
|
|
21
23
|
const darkColors = {
|
|
22
24
|
black: {
|
|
23
|
-
1: "#
|
|
25
|
+
1: "#ffffff",
|
|
24
26
|
2: "#f7f7f7",
|
|
25
|
-
3: "#
|
|
26
|
-
4: "#
|
|
27
|
-
5: "#
|
|
27
|
+
3: "#eeeeee",
|
|
28
|
+
4: "#dddddd",
|
|
29
|
+
5: "#aaaaaa",
|
|
30
|
+
...extraColors?.dark?.black
|
|
28
31
|
},
|
|
29
32
|
white: {
|
|
30
|
-
1: "#
|
|
31
|
-
2: "#
|
|
32
|
-
3: "#
|
|
33
|
-
4: "#
|
|
34
|
-
5: "#
|
|
33
|
+
1: "#060606",
|
|
34
|
+
2: "#222222",
|
|
35
|
+
3: "#333333",
|
|
36
|
+
4: "#444444",
|
|
37
|
+
5: "#555555",
|
|
38
|
+
...extraColors?.dark?.white
|
|
35
39
|
},
|
|
36
40
|
dark: {
|
|
37
41
|
main: "#f2f3f4",
|
|
38
|
-
light: "#
|
|
39
|
-
dark: "#
|
|
40
|
-
text: "#
|
|
42
|
+
light: "#ffffff",
|
|
43
|
+
dark: "#dddddd",
|
|
44
|
+
text: "#000000",
|
|
41
45
|
...extraColors?.dark?.dark
|
|
42
46
|
},
|
|
43
47
|
light: {
|
|
44
|
-
main: "#
|
|
45
|
-
light: "#
|
|
46
|
-
dark: "#
|
|
47
|
-
text: "#
|
|
48
|
+
main: "#111111",
|
|
49
|
+
light: "#555555",
|
|
50
|
+
dark: "#333333",
|
|
51
|
+
text: "#ffffff",
|
|
48
52
|
...extraColors?.dark?.light
|
|
49
53
|
},
|
|
50
54
|
textSecondary: {
|
|
51
|
-
main: "#
|
|
52
|
-
light: "#
|
|
53
|
-
dark: "#
|
|
54
|
-
text: "#
|
|
55
|
+
main: "#666666",
|
|
56
|
+
light: "#777777",
|
|
57
|
+
dark: "#444444",
|
|
58
|
+
text: "#ffffff",
|
|
55
59
|
...extraColors?.dark?.textSecondary
|
|
56
60
|
},
|
|
57
61
|
primary: {
|
|
58
|
-
main: "#
|
|
59
|
-
light: "#
|
|
60
|
-
dark: "#
|
|
61
|
-
text: "#
|
|
62
|
+
main: "#ff8800",
|
|
63
|
+
light: "#feffd3",
|
|
64
|
+
dark: "#ffaa00",
|
|
65
|
+
text: "#ffffff",
|
|
62
66
|
...extraColors?.light?.primary,
|
|
63
67
|
...extraColors?.dark?.primary
|
|
64
68
|
}
|
|
@@ -67,73 +71,73 @@ function colors(theme) {
|
|
|
67
71
|
return {
|
|
68
72
|
...extraColors[theme],
|
|
69
73
|
primary: {
|
|
70
|
-
main: "#
|
|
71
|
-
light: "#
|
|
72
|
-
dark: "#
|
|
73
|
-
text: "#
|
|
74
|
+
main: "#ff8800",
|
|
75
|
+
light: "#feffd3",
|
|
76
|
+
dark: "#ffaa00",
|
|
77
|
+
text: "#ffffff",
|
|
74
78
|
...extraColors?.light?.primary
|
|
75
79
|
},
|
|
76
80
|
secondary: {
|
|
77
|
-
main: "#
|
|
78
|
-
light: "#
|
|
79
|
-
dark: "#
|
|
80
|
-
text: "#
|
|
81
|
+
main: "#ff1111",
|
|
82
|
+
light: "#ff4433",
|
|
83
|
+
dark: "#dd0000",
|
|
84
|
+
text: "#ffffff",
|
|
81
85
|
...extraColors?.light?.secondary
|
|
82
86
|
},
|
|
83
87
|
light: {
|
|
84
|
-
main: "#
|
|
85
|
-
light: "#
|
|
86
|
-
dark: "#
|
|
87
|
-
text: "#
|
|
88
|
+
main: "#ffffff",
|
|
89
|
+
light: "#ffffff",
|
|
90
|
+
dark: "#dddddd",
|
|
91
|
+
text: "#000000",
|
|
88
92
|
...extraColors?.light?.light
|
|
89
93
|
},
|
|
90
94
|
dark: {
|
|
91
|
-
main: "#
|
|
92
|
-
light: "#
|
|
93
|
-
dark: "#
|
|
94
|
-
text: "#
|
|
95
|
+
main: "#000000",
|
|
96
|
+
light: "#777777",
|
|
97
|
+
dark: "#111111",
|
|
98
|
+
text: "#ffffff",
|
|
95
99
|
...extraColors?.light?.dark
|
|
96
100
|
},
|
|
97
101
|
textSecondary: {
|
|
98
|
-
main: "#
|
|
99
|
-
light: "#
|
|
100
|
-
dark: "#
|
|
101
|
-
text: "#
|
|
102
|
+
main: "#aaaaaa",
|
|
103
|
+
light: "#bbbbbb",
|
|
104
|
+
dark: "#777777",
|
|
105
|
+
text: "#112233",
|
|
102
106
|
...extraColors?.light?.textSecondary
|
|
103
107
|
},
|
|
104
108
|
blue: {
|
|
105
|
-
main: "#
|
|
106
|
-
light: "#
|
|
107
|
-
dark: "#
|
|
108
|
-
text: "#
|
|
109
|
+
main: "#0099ff",
|
|
110
|
+
light: "#3399ff",
|
|
111
|
+
dark: "#002288",
|
|
112
|
+
text: "#ffffff",
|
|
109
113
|
...extraColors?.light?.blue
|
|
110
114
|
},
|
|
111
115
|
info: {
|
|
112
|
-
main: "#
|
|
113
|
-
light: "#
|
|
114
|
-
dark: "#
|
|
115
|
-
text: "#
|
|
116
|
+
main: "#0099ff",
|
|
117
|
+
light: "#33aaff",
|
|
118
|
+
dark: "#0088aa",
|
|
119
|
+
text: "#ffffff",
|
|
116
120
|
...extraColors?.light?.info
|
|
117
121
|
},
|
|
118
122
|
success: {
|
|
119
|
-
main: "#
|
|
120
|
-
text: "#
|
|
121
|
-
light: "#
|
|
122
|
-
dark: "#
|
|
123
|
+
main: "#00aa44",
|
|
124
|
+
text: "#ffffff",
|
|
125
|
+
light: "#55cc33",
|
|
126
|
+
dark: "#006622",
|
|
123
127
|
...extraColors?.light?.success
|
|
124
128
|
},
|
|
125
129
|
warning: {
|
|
126
|
-
main: "#
|
|
127
|
-
light: "#
|
|
128
|
-
dark: "#
|
|
129
|
-
text: "#
|
|
130
|
+
main: "#ffaa22",
|
|
131
|
+
light: "#ffcc77",
|
|
132
|
+
dark: "#ff9900",
|
|
133
|
+
text: "#ffffff",
|
|
130
134
|
...extraColors?.light?.warning
|
|
131
135
|
},
|
|
132
136
|
error: {
|
|
133
|
-
main: "#
|
|
134
|
-
text: "#
|
|
135
|
-
light: "#
|
|
136
|
-
dark: "#
|
|
137
|
+
main: "#dd2222",
|
|
138
|
+
text: "#ffffff",
|
|
139
|
+
light: "#ff4433",
|
|
140
|
+
dark: "#aa2200",
|
|
137
141
|
...extraColors?.light?.error
|
|
138
142
|
},
|
|
139
143
|
...dynamicColors
|
|
@@ -141,24 +145,25 @@ function colors(theme) {
|
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
// ../src/config/KeyManager.ts
|
|
144
|
-
var
|
|
148
|
+
var config = {
|
|
145
149
|
GOOGLE_MAP_API_KEY: ""
|
|
146
150
|
};
|
|
147
|
-
function
|
|
148
|
-
|
|
151
|
+
function setConfig(key) {
|
|
152
|
+
config = key;
|
|
149
153
|
}
|
|
150
|
-
function
|
|
151
|
-
return
|
|
154
|
+
function getConfig() {
|
|
155
|
+
return config;
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
// ../src/config/index.ts
|
|
155
|
-
function initialize(
|
|
159
|
+
function initialize(config2) {
|
|
156
160
|
try {
|
|
157
|
-
|
|
158
|
-
GOOGLE_MAP_API_KEY:
|
|
161
|
+
setConfig({
|
|
162
|
+
GOOGLE_MAP_API_KEY: config2.googleMapApiKey,
|
|
163
|
+
DEFAULT_FONT_FAMILY: config2.fontFamily
|
|
159
164
|
});
|
|
160
|
-
if (
|
|
161
|
-
setExtraColors(
|
|
165
|
+
if (config2.colors)
|
|
166
|
+
setExtraColors(config2.colors);
|
|
162
167
|
} catch (error) {
|
|
163
168
|
console.error("Error reading the config file:", error);
|
|
164
169
|
}
|
|
@@ -166,7 +171,7 @@ function initialize(config) {
|
|
|
166
171
|
|
|
167
172
|
// components/AdaptiveStatusBarNext.tsx
|
|
168
173
|
import { useFocusEffect } from "expo-router";
|
|
169
|
-
import React5, { useState as
|
|
174
|
+
import React5, { useState as useState2 } from "react";
|
|
170
175
|
import { Platform as Platform3, StatusBar } from "react-native";
|
|
171
176
|
|
|
172
177
|
// ../src/hooks.ts
|
|
@@ -178,8 +183,9 @@ import { vs } from "react-native-size-matters";
|
|
|
178
183
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
179
184
|
import * as NavigationBar from "expo-navigation-bar";
|
|
180
185
|
import * as SystemUI from "expo-system-ui";
|
|
181
|
-
import React4, { createContext, useReducer } from "react";
|
|
186
|
+
import React4, { createContext, useEffect as useEffect2, useReducer } from "react";
|
|
182
187
|
import { Platform, useColorScheme } from "react-native";
|
|
188
|
+
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
183
189
|
|
|
184
190
|
// ../src/Components/FlashMessage.tsx
|
|
185
191
|
import React3, { useEffect, useState } from "react";
|
|
@@ -192,54 +198,63 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
|
192
198
|
import { ScaledSheet } from "react-native-size-matters";
|
|
193
199
|
|
|
194
200
|
// ../src/Components/Typography.tsx
|
|
195
|
-
import React2 from "react";
|
|
196
|
-
import {
|
|
201
|
+
import React2, { forwardRef } from "react";
|
|
202
|
+
import { StyleSheet, Text } from "react-native";
|
|
197
203
|
import { moderateScale, verticalScale } from "react-native-size-matters";
|
|
198
|
-
var Typography = (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
204
|
+
var Typography = forwardRef(
|
|
205
|
+
({
|
|
206
|
+
children,
|
|
207
|
+
color = "dark",
|
|
208
|
+
style = {},
|
|
209
|
+
textCase = null,
|
|
210
|
+
variant = "body1",
|
|
211
|
+
align = "left",
|
|
212
|
+
gutterBottom = 0,
|
|
213
|
+
numberOfLines,
|
|
214
|
+
adjustsFontSizeToFit,
|
|
215
|
+
fontWeight = 400,
|
|
216
|
+
fontFamily,
|
|
217
|
+
// NEW PROP ADDED
|
|
218
|
+
...props
|
|
219
|
+
}, ref) => {
|
|
220
|
+
const colors2 = useColors();
|
|
221
|
+
const fontSize = {
|
|
222
|
+
h1: moderateScale(42),
|
|
223
|
+
h2: moderateScale(37),
|
|
224
|
+
h3: moderateScale(32),
|
|
225
|
+
h4: moderateScale(27),
|
|
226
|
+
h5: moderateScale(22),
|
|
227
|
+
h6: moderateScale(17),
|
|
228
|
+
body1: moderateScale(15),
|
|
229
|
+
body2: moderateScale(12),
|
|
230
|
+
caption: moderateScale(10)
|
|
231
|
+
};
|
|
232
|
+
const styles2 = StyleSheet.create({
|
|
233
|
+
text: {
|
|
234
|
+
fontSize: fontSize[variant],
|
|
235
|
+
marginBottom: verticalScale(gutterBottom) || 0,
|
|
236
|
+
color: colors2[color]?.main || color,
|
|
237
|
+
textTransform: textCase,
|
|
238
|
+
alignItems: "center",
|
|
239
|
+
textAlign: align,
|
|
240
|
+
fontWeight,
|
|
241
|
+
fontFamily: fontFamily || getConfig().DEFAULT_FONT_FAMILY || void 0
|
|
242
|
+
// Use custom font if provided, else default
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
return /* @__PURE__ */ React2.createElement(
|
|
246
|
+
Text,
|
|
247
|
+
{
|
|
248
|
+
ref,
|
|
249
|
+
numberOfLines,
|
|
250
|
+
adjustsFontSizeToFit,
|
|
251
|
+
style: [styles2.text, style],
|
|
252
|
+
...props
|
|
253
|
+
},
|
|
254
|
+
children
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
);
|
|
243
258
|
var Typography_default = Typography;
|
|
244
259
|
|
|
245
260
|
// ../src/Components/FlashMessage.tsx
|
|
@@ -304,24 +319,10 @@ var FlashMessage = () => {
|
|
|
304
319
|
var FlashMessage_default = FlashMessage;
|
|
305
320
|
|
|
306
321
|
// ../src/theme/index.tsx
|
|
307
|
-
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
308
322
|
var UIThemeContext = createContext({
|
|
309
323
|
themeState: { mode: "default", value: "light" }
|
|
310
324
|
});
|
|
311
325
|
function themeReducer(state, { type, payload }) {
|
|
312
|
-
if (payload === "dark" || type === "dark") {
|
|
313
|
-
SystemUI.setBackgroundColorAsync("#000000");
|
|
314
|
-
if (Platform.OS === "android") {
|
|
315
|
-
NavigationBar.setButtonStyleAsync("light");
|
|
316
|
-
NavigationBar.setBackgroundColorAsync("#000000");
|
|
317
|
-
}
|
|
318
|
-
} else {
|
|
319
|
-
SystemUI.setBackgroundColorAsync("#ffffff");
|
|
320
|
-
if (Platform.OS === "android") {
|
|
321
|
-
NavigationBar.setButtonStyleAsync("dark");
|
|
322
|
-
NavigationBar.setBackgroundColorAsync("#fff");
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
326
|
switch (type) {
|
|
326
327
|
case "dark":
|
|
327
328
|
return { mode: "dark", value: "dark" };
|
|
@@ -333,6 +334,24 @@ function themeReducer(state, { type, payload }) {
|
|
|
333
334
|
return state;
|
|
334
335
|
}
|
|
335
336
|
}
|
|
337
|
+
var ConfigureSystemUI = () => {
|
|
338
|
+
const theme = useTheme();
|
|
339
|
+
const colors2 = useColors();
|
|
340
|
+
useEffect2(() => {
|
|
341
|
+
if (colors2) {
|
|
342
|
+
SystemUI.setBackgroundColorAsync(colors2.white[1]);
|
|
343
|
+
if (Platform.OS === "android") {
|
|
344
|
+
NavigationBar.setBackgroundColorAsync(colors2.white[1]);
|
|
345
|
+
if (theme === "dark") {
|
|
346
|
+
NavigationBar.setButtonStyleAsync("light");
|
|
347
|
+
} else {
|
|
348
|
+
NavigationBar.setButtonStyleAsync("dark");
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}, [colors2, theme]);
|
|
353
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null);
|
|
354
|
+
};
|
|
336
355
|
var UIThemeProvider = ({ children }) => {
|
|
337
356
|
const [themeState, themeDispatch] = useReducer(themeReducer, {
|
|
338
357
|
mode: "default",
|
|
@@ -368,7 +387,8 @@ var UIThemeProvider = ({ children }) => {
|
|
|
368
387
|
}
|
|
369
388
|
},
|
|
370
389
|
children,
|
|
371
|
-
/* @__PURE__ */ React4.createElement(FlashMessage_default, null)
|
|
390
|
+
/* @__PURE__ */ React4.createElement(FlashMessage_default, null),
|
|
391
|
+
/* @__PURE__ */ React4.createElement(ConfigureSystemUI, null)
|
|
372
392
|
));
|
|
373
393
|
};
|
|
374
394
|
|
|
@@ -383,6 +403,7 @@ var useTheme = () => {
|
|
|
383
403
|
};
|
|
384
404
|
var useNavScreenOptions = (type) => {
|
|
385
405
|
const colors2 = useColors();
|
|
406
|
+
const theme = useTheme();
|
|
386
407
|
const options = {
|
|
387
408
|
stack: {
|
|
388
409
|
headerShown: false,
|
|
@@ -402,7 +423,7 @@ var useNavScreenOptions = (type) => {
|
|
|
402
423
|
headerShown: false,
|
|
403
424
|
headerTintColor: colors2.dark.main,
|
|
404
425
|
tabBarStyle: {
|
|
405
|
-
borderTopColor: colors2.white[
|
|
426
|
+
borderTopColor: theme === "dark" ? colors2.light.main : colors2.white[2],
|
|
406
427
|
borderTopWidth: 1,
|
|
407
428
|
// shadowColor: "#000",
|
|
408
429
|
// shadowOffset: { height: -3, width: 0 },
|
|
@@ -443,7 +464,7 @@ var useNavScreenOptions = (type) => {
|
|
|
443
464
|
|
|
444
465
|
// components/AdaptiveStatusBarNext.tsx
|
|
445
466
|
var AdaptiveStatusBar = ({ translucent = false }) => {
|
|
446
|
-
const [focused, setFocused] =
|
|
467
|
+
const [focused, setFocused] = useState2(false);
|
|
447
468
|
const colors2 = useColors();
|
|
448
469
|
const theme = useTheme();
|
|
449
470
|
useFocusEffect(
|
|
@@ -551,7 +572,7 @@ var Avatar_default = Avatar;
|
|
|
551
572
|
|
|
552
573
|
// ../src/Components/Button.tsx
|
|
553
574
|
import { Ionicons, MaterialIcons as MaterialIcons2 } from "@expo/vector-icons";
|
|
554
|
-
import React8 from "react";
|
|
575
|
+
import React8, { forwardRef as forwardRef2 } from "react";
|
|
555
576
|
import { ActivityIndicator, Text as Text2, TouchableOpacity as TouchableOpacity2 } from "react-native";
|
|
556
577
|
import { ScaledSheet as ScaledSheet4, moderateScale as moderateScale2 } from "react-native-size-matters";
|
|
557
578
|
var LinkButton = ({
|
|
@@ -569,6 +590,7 @@ var LinkButton = ({
|
|
|
569
590
|
text: {
|
|
570
591
|
fontSize: moderateScale2(fontSize),
|
|
571
592
|
fontWeight,
|
|
593
|
+
fontFamily: getConfig().DEFAULT_FONT_FAMILY || "System",
|
|
572
594
|
color: disabled ? "#777" : colors2[color].main
|
|
573
595
|
}
|
|
574
596
|
});
|
|
@@ -628,64 +650,79 @@ var IconButton = ({
|
|
|
628
650
|
/* @__PURE__ */ React8.createElement(IconComp, { style: { ...styles2.text, ...style }, name: icon, size })
|
|
629
651
|
);
|
|
630
652
|
};
|
|
631
|
-
var Button = (
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
653
|
+
var Button = forwardRef2(
|
|
654
|
+
({
|
|
655
|
+
elevation = 0,
|
|
656
|
+
onPress = () => {
|
|
657
|
+
},
|
|
658
|
+
disabled = false,
|
|
659
|
+
title,
|
|
660
|
+
loading,
|
|
661
|
+
size = "normal",
|
|
662
|
+
rounded = false,
|
|
663
|
+
gutterBottom,
|
|
664
|
+
style = {},
|
|
665
|
+
fullWidth = false,
|
|
666
|
+
translucent = false,
|
|
667
|
+
color = "primary",
|
|
668
|
+
variant = "contained",
|
|
669
|
+
start,
|
|
670
|
+
end
|
|
671
|
+
}, ref) => {
|
|
672
|
+
const colors2 = useColors();
|
|
673
|
+
const styles2 = ScaledSheet4.create({
|
|
674
|
+
con: {
|
|
675
|
+
flexDirection: "row",
|
|
676
|
+
alignItems: "center",
|
|
677
|
+
alignSelf: "flex-start",
|
|
678
|
+
justifyContent: "center",
|
|
679
|
+
backgroundColor: variant === "text" || variant === "outlined" ? null : translucent ? translucent === "dark" ? colors2.white[3] + "22" : colors2.black[3] + "22" : loading ? colors2[color].light : disabled ? colors2.white[4] : colors2[color].main,
|
|
680
|
+
borderRadius: rounded ? 30 : 10,
|
|
681
|
+
elevation: variant === "text" ? 0 : elevation,
|
|
682
|
+
paddingVertical: size === "small" ? 8 : size === "large" ? "15@ms" : "13@ms",
|
|
683
|
+
paddingHorizontal: size === "small" ? "10@ms" : "18@ms",
|
|
684
|
+
borderColor: colors2[color].main,
|
|
685
|
+
borderWidth: variant === "outlined" ? 1 : 0,
|
|
686
|
+
shadowColor: "#000",
|
|
687
|
+
shadowRadius: elevation,
|
|
688
|
+
marginBottom: gutterBottom,
|
|
689
|
+
shadowOffset: {
|
|
690
|
+
height: elevation / 2,
|
|
691
|
+
width: 0
|
|
692
|
+
},
|
|
693
|
+
shadowOpacity: variant === "text" ? 0 : 0.3,
|
|
694
|
+
width: fullWidth ? "100%" : null,
|
|
695
|
+
...style
|
|
669
696
|
},
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
697
|
+
text: {
|
|
698
|
+
color: disabled ? variant === "text" || variant === "outlined" ? colors2.black[1] : colors2[color].text : colors2[color][variant === "text" || variant === "outlined" ? "main" : "text"],
|
|
699
|
+
fontWeight: variant === "outlined" ? "700" : "500",
|
|
700
|
+
fontSize: size === "small" ? "12@ms" : "16@ms",
|
|
701
|
+
fontFamily: getConfig().DEFAULT_FONT_FAMILY || "System"
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
return /* @__PURE__ */ React8.createElement(
|
|
705
|
+
TouchableOpacity2,
|
|
706
|
+
{
|
|
707
|
+
ref,
|
|
708
|
+
onPress,
|
|
709
|
+
disabled,
|
|
710
|
+
style: styles2.con
|
|
711
|
+
},
|
|
712
|
+
start,
|
|
713
|
+
loading && /* @__PURE__ */ React8.createElement(
|
|
714
|
+
ActivityIndicator,
|
|
715
|
+
{
|
|
716
|
+
size: "small",
|
|
717
|
+
color: colors2[color].text,
|
|
718
|
+
style: { marginRight: 10 }
|
|
719
|
+
}
|
|
720
|
+
),
|
|
721
|
+
/* @__PURE__ */ React8.createElement(Text2, { style: styles2.text }, title),
|
|
722
|
+
end
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
);
|
|
689
726
|
var Button_default = Button;
|
|
690
727
|
|
|
691
728
|
// ../src/Components/Checkbox.tsx
|
|
@@ -780,7 +817,7 @@ var FormWrapper = ({
|
|
|
780
817
|
// ../src/Components/StarRating.tsx
|
|
781
818
|
import { Ionicons as Ionicons2 } from "@expo/vector-icons";
|
|
782
819
|
import * as Haptics from "expo-haptics";
|
|
783
|
-
import { useEffect as
|
|
820
|
+
import { useEffect as useEffect3, useState as useState4 } from "react";
|
|
784
821
|
import {
|
|
785
822
|
ActivityIndicator as ActivityIndicator2,
|
|
786
823
|
TextInput,
|
|
@@ -800,7 +837,7 @@ import {
|
|
|
800
837
|
TouchableWithoutFeedback as TouchableWithoutFeedback2,
|
|
801
838
|
View as View5
|
|
802
839
|
} from "react-native";
|
|
803
|
-
import React11, { useState as
|
|
840
|
+
import React11, { useState as useState3 } from "react";
|
|
804
841
|
import { ScaledSheet as ScaledSheet7 } from "react-native-size-matters";
|
|
805
842
|
var Popup = ({
|
|
806
843
|
title,
|
|
@@ -810,11 +847,13 @@ var Popup = ({
|
|
|
810
847
|
children,
|
|
811
848
|
open,
|
|
812
849
|
onClose = () => {
|
|
813
|
-
}
|
|
850
|
+
},
|
|
851
|
+
style
|
|
814
852
|
}) => {
|
|
853
|
+
const theme = useTheme();
|
|
815
854
|
const colors2 = useColors();
|
|
816
|
-
const [show, setShow] =
|
|
817
|
-
const [showSecondary, setShowSecondary] =
|
|
855
|
+
const [show, setShow] = useState3(open);
|
|
856
|
+
const [showSecondary, setShowSecondary] = useState3(false);
|
|
818
857
|
const styles2 = ScaledSheet7.create({
|
|
819
858
|
root: {
|
|
820
859
|
height: "100%",
|
|
@@ -831,12 +870,13 @@ var Popup = ({
|
|
|
831
870
|
},
|
|
832
871
|
container: {
|
|
833
872
|
paddingBottom: sheet ? "30@ms" : 0,
|
|
834
|
-
backgroundColor: colors2.white[2],
|
|
873
|
+
backgroundColor: theme === "dark" ? "#111" : colors2.white[2],
|
|
835
874
|
borderTopLeftRadius: 20,
|
|
836
875
|
borderTopRightRadius: 20,
|
|
837
876
|
borderBottomRightRadius: sheet ? 0 : 20,
|
|
838
877
|
borderBottomLeftRadius: sheet ? 0 : 20,
|
|
839
|
-
width: "100%"
|
|
878
|
+
width: "100%",
|
|
879
|
+
...style
|
|
840
880
|
},
|
|
841
881
|
content: {
|
|
842
882
|
paddingHorizontal: bare ? void 0 : "10@ms"
|
|
@@ -858,14 +898,21 @@ var Popup = ({
|
|
|
858
898
|
}
|
|
859
899
|
});
|
|
860
900
|
React11.useEffect(() => {
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
901
|
+
if (open) {
|
|
902
|
+
setShow(open);
|
|
903
|
+
setTimeout(() => {
|
|
904
|
+
setShowSecondary(open);
|
|
905
|
+
}, 500);
|
|
906
|
+
} else {
|
|
907
|
+
closeAction();
|
|
908
|
+
}
|
|
865
909
|
}, [open]);
|
|
866
910
|
const closeAction = () => {
|
|
867
|
-
|
|
868
|
-
|
|
911
|
+
setShowSecondary(false);
|
|
912
|
+
setTimeout(() => {
|
|
913
|
+
setShow(false);
|
|
914
|
+
onClose();
|
|
915
|
+
}, 300);
|
|
869
916
|
};
|
|
870
917
|
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
871
918
|
Modal,
|
|
@@ -939,11 +986,11 @@ var RatingInput = ({
|
|
|
939
986
|
rating = 0,
|
|
940
987
|
size = 16
|
|
941
988
|
}) => {
|
|
942
|
-
const [showReviewsModal, setShowReviewsModal] =
|
|
943
|
-
const [rate, setRate] =
|
|
989
|
+
const [showReviewsModal, setShowReviewsModal] = useState4(false);
|
|
990
|
+
const [rate, setRate] = useState4(0);
|
|
944
991
|
const colors2 = useColors();
|
|
945
|
-
const [loading, setLoading] =
|
|
946
|
-
const [review, setReview] =
|
|
992
|
+
const [loading, setLoading] = useState4(false);
|
|
993
|
+
const [review, setReview] = useState4("");
|
|
947
994
|
const styles2 = ScaledSheet8.create({
|
|
948
995
|
root: {
|
|
949
996
|
flexDirection: "row",
|
|
@@ -961,7 +1008,7 @@ var RatingInput = ({
|
|
|
961
1008
|
height: "100@vs"
|
|
962
1009
|
}
|
|
963
1010
|
});
|
|
964
|
-
|
|
1011
|
+
useEffect3(() => {
|
|
965
1012
|
setRate(rating);
|
|
966
1013
|
}, [rating]);
|
|
967
1014
|
const onRate = (index) => {
|
|
@@ -1086,7 +1133,7 @@ var Grid = ({
|
|
|
1086
1133
|
|
|
1087
1134
|
// ../src/Components/Locator.tsx
|
|
1088
1135
|
import { Ionicons as Ionicons4 } from "@expo/vector-icons";
|
|
1089
|
-
import React16, { useEffect as
|
|
1136
|
+
import React16, { useEffect as useEffect4, useState as useState7 } from "react";
|
|
1090
1137
|
import { Alert, TouchableOpacity as TouchableOpacity8, View as View11 } from "react-native";
|
|
1091
1138
|
|
|
1092
1139
|
// ../src/Components/List.tsx
|
|
@@ -1108,7 +1155,7 @@ var ListItem = ({
|
|
|
1108
1155
|
flexDirection: "row",
|
|
1109
1156
|
alignItems: "center",
|
|
1110
1157
|
paddingHorizontal: "10@s",
|
|
1111
|
-
borderBottomColor: colors2.white[
|
|
1158
|
+
borderBottomColor: colors2.white[2],
|
|
1112
1159
|
borderBottomWidth: divider ? 1 : 0,
|
|
1113
1160
|
paddingVertical: "10@vs"
|
|
1114
1161
|
}
|
|
@@ -1130,7 +1177,7 @@ var ListItem = ({
|
|
|
1130
1177
|
|
|
1131
1178
|
// ../src/Components/TextField.tsx
|
|
1132
1179
|
import { Ionicons as Ionicons3, MaterialIcons as MaterialIcons5 } from "@expo/vector-icons";
|
|
1133
|
-
import React15, {
|
|
1180
|
+
import React15, { useRef, useState as useState6 } from "react";
|
|
1134
1181
|
import { Animated, TextInput as TextInput2, TouchableOpacity as TouchableOpacity7, View as View10 } from "react-native";
|
|
1135
1182
|
import {
|
|
1136
1183
|
ScaledSheet as ScaledSheet12,
|
|
@@ -1141,7 +1188,7 @@ import {
|
|
|
1141
1188
|
|
|
1142
1189
|
// ../src/Components/SelectMenu.tsx
|
|
1143
1190
|
import { MaterialIcons as MaterialIcons4 } from "@expo/vector-icons";
|
|
1144
|
-
import React14, { useCallback, useState as
|
|
1191
|
+
import React14, { useCallback, useState as useState5 } from "react";
|
|
1145
1192
|
import { FlatList, Modal as Modal2, TouchableOpacity as TouchableOpacity6, View as View9 } from "react-native";
|
|
1146
1193
|
import { useSafeAreaInsets as useSafeAreaInsets2 } from "react-native-safe-area-context";
|
|
1147
1194
|
import { ScaledSheet as ScaledSheet11 } from "react-native-size-matters";
|
|
@@ -1158,7 +1205,7 @@ var SelectMenu = ({
|
|
|
1158
1205
|
}) => {
|
|
1159
1206
|
const colors2 = useColors();
|
|
1160
1207
|
const { bottom } = useSafeAreaInsets2();
|
|
1161
|
-
const [search, setSearch] =
|
|
1208
|
+
const [search, setSearch] = useState5("");
|
|
1162
1209
|
const styles2 = ScaledSheet11.create({
|
|
1163
1210
|
root: {
|
|
1164
1211
|
backgroundColor: colors2.white[1],
|
|
@@ -1192,7 +1239,7 @@ var SelectMenu = ({
|
|
|
1192
1239
|
{
|
|
1193
1240
|
style: {
|
|
1194
1241
|
...styles2.option,
|
|
1195
|
-
backgroundColor: item.value === value ? colors2.blue.light + "
|
|
1242
|
+
backgroundColor: item.value === value ? colors2.blue.light + "22" : colors2.white[2]
|
|
1196
1243
|
},
|
|
1197
1244
|
onPress: () => {
|
|
1198
1245
|
onChange(item.value);
|
|
@@ -1294,9 +1341,11 @@ var TextField = ({
|
|
|
1294
1341
|
...props
|
|
1295
1342
|
}) => {
|
|
1296
1343
|
const colors2 = useColors();
|
|
1297
|
-
const [focused, setFocused] =
|
|
1298
|
-
const labelAnim = useRef(new Animated.Value(0)).current;
|
|
1344
|
+
const [focused, setFocused] = useState6(false);
|
|
1299
1345
|
const height = moderateScale3(variant === "text" ? 50 : 45) * (size === "large" ? 1.2 : size === "small" ? 0.8 : 1);
|
|
1346
|
+
const labelAnim = useRef(
|
|
1347
|
+
new Animated.Value(height / moderateScale3(variant === "text" ? 2.5 : 3.2))
|
|
1348
|
+
).current;
|
|
1300
1349
|
React15.useEffect(() => {
|
|
1301
1350
|
if (focused || value) {
|
|
1302
1351
|
Animated.timing(labelAnim, {
|
|
@@ -1338,6 +1387,7 @@ var TextField = ({
|
|
|
1338
1387
|
paddingLeft: variant === "text" ? 0 : moderateScale3(15),
|
|
1339
1388
|
paddingRight: moderateScale3(10),
|
|
1340
1389
|
paddingTop: "11@vs",
|
|
1390
|
+
fontFamily: getConfig().DEFAULT_FONT_FAMILY || "System",
|
|
1341
1391
|
color: colors2.black[1],
|
|
1342
1392
|
zIndex: 10
|
|
1343
1393
|
// backgroundColor: "#284",
|
|
@@ -1349,6 +1399,7 @@ var TextField = ({
|
|
|
1349
1399
|
paddingTop: "13@ms"
|
|
1350
1400
|
},
|
|
1351
1401
|
label: {
|
|
1402
|
+
fontFamily: getConfig().DEFAULT_FONT_FAMILY || "System",
|
|
1352
1403
|
position: "absolute",
|
|
1353
1404
|
left: variant === "text" ? 0 : moderateScale3(15),
|
|
1354
1405
|
fontSize: focused || value ? "10@s" : "13@s",
|
|
@@ -1439,15 +1490,33 @@ var TextField = ({
|
|
|
1439
1490
|
style: styles2.input
|
|
1440
1491
|
}
|
|
1441
1492
|
),
|
|
1442
|
-
end && /* @__PURE__ */ React15.createElement(
|
|
1443
|
-
|
|
1444
|
-
Ionicons3,
|
|
1493
|
+
end && /* @__PURE__ */ React15.createElement(
|
|
1494
|
+
View10,
|
|
1445
1495
|
{
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1496
|
+
style: {
|
|
1497
|
+
marginRight: 20,
|
|
1498
|
+
paddingTop: variant === "text" ? ms(13) : 0
|
|
1499
|
+
}
|
|
1500
|
+
},
|
|
1501
|
+
end
|
|
1502
|
+
),
|
|
1503
|
+
options && /* @__PURE__ */ React15.createElement(
|
|
1504
|
+
View10,
|
|
1505
|
+
{
|
|
1506
|
+
style: {
|
|
1507
|
+
marginRight: variant === "text" ? 0 : 20,
|
|
1508
|
+
paddingTop: variant === "text" ? ms(13) : 0
|
|
1509
|
+
}
|
|
1510
|
+
},
|
|
1511
|
+
/* @__PURE__ */ React15.createElement(
|
|
1512
|
+
Ionicons3,
|
|
1513
|
+
{
|
|
1514
|
+
name: "chevron-down",
|
|
1515
|
+
color: colors2.textSecondary.main,
|
|
1516
|
+
size: 24
|
|
1517
|
+
}
|
|
1518
|
+
)
|
|
1519
|
+
)
|
|
1451
1520
|
), helperText && /* @__PURE__ */ React15.createElement(
|
|
1452
1521
|
Typography_default,
|
|
1453
1522
|
{
|
|
@@ -1472,7 +1541,6 @@ var TextField = ({
|
|
|
1472
1541
|
var TextField2 = ({
|
|
1473
1542
|
label,
|
|
1474
1543
|
keyboardType,
|
|
1475
|
-
variant,
|
|
1476
1544
|
color = "primary",
|
|
1477
1545
|
value,
|
|
1478
1546
|
type,
|
|
@@ -1497,32 +1565,14 @@ var TextField2 = ({
|
|
|
1497
1565
|
...props
|
|
1498
1566
|
}) => {
|
|
1499
1567
|
const colors2 = useColors();
|
|
1500
|
-
const [focused, _setFocused] =
|
|
1501
|
-
const [showPassword, setShowPassword] =
|
|
1502
|
-
const labelAnim = useRef(new Animated.Value(0)).current;
|
|
1568
|
+
const [focused, _setFocused] = useState6(false);
|
|
1569
|
+
const [showPassword, setShowPassword] = useState6(false);
|
|
1503
1570
|
const height = moderateScale3(
|
|
1504
1571
|
props.multiline ? 50 + (props.numberOfLines || 1) * 18 : 50
|
|
1505
1572
|
);
|
|
1506
1573
|
const setFocused = (value2) => {
|
|
1507
|
-
|
|
1508
|
-
_setFocused(value2);
|
|
1509
|
-
});
|
|
1574
|
+
_setFocused(value2);
|
|
1510
1575
|
};
|
|
1511
|
-
React15.useEffect(() => {
|
|
1512
|
-
if (focused || value) {
|
|
1513
|
-
Animated.timing(labelAnim, {
|
|
1514
|
-
toValue: verticalScale2(5),
|
|
1515
|
-
duration: 300,
|
|
1516
|
-
useNativeDriver: false
|
|
1517
|
-
}).start();
|
|
1518
|
-
} else {
|
|
1519
|
-
Animated.timing(labelAnim, {
|
|
1520
|
-
toValue: height / moderateScale3(3),
|
|
1521
|
-
duration: 300,
|
|
1522
|
-
useNativeDriver: false
|
|
1523
|
-
}).start();
|
|
1524
|
-
}
|
|
1525
|
-
}, [focused, value]);
|
|
1526
1576
|
const styles2 = ScaledSheet12.create({
|
|
1527
1577
|
root: {
|
|
1528
1578
|
marginBottom: gutterBottom + "@vs",
|
|
@@ -1545,13 +1595,13 @@ var TextField2 = ({
|
|
|
1545
1595
|
alignSelf: "stretch",
|
|
1546
1596
|
paddingLeft: moderateScale3(10),
|
|
1547
1597
|
paddingRight: moderateScale3(10),
|
|
1548
|
-
color: colors2.dark.
|
|
1598
|
+
color: colors2.dark.main,
|
|
1549
1599
|
zIndex: 10
|
|
1550
1600
|
// backgroundColor: "#284",
|
|
1551
1601
|
},
|
|
1552
1602
|
inputText: {
|
|
1553
1603
|
fontSize: "14@ms",
|
|
1554
|
-
color: colors2.dark.
|
|
1604
|
+
color: colors2.dark.main,
|
|
1555
1605
|
paddingLeft: moderateScale3(10)
|
|
1556
1606
|
},
|
|
1557
1607
|
placeholder: {
|
|
@@ -1678,13 +1728,8 @@ var TextField_default = TextField;
|
|
|
1678
1728
|
// ../src/Components/Locator.tsx
|
|
1679
1729
|
import * as Location from "expo-location";
|
|
1680
1730
|
import { ScaledSheet as ScaledSheet13 } from "react-native-size-matters";
|
|
1681
|
-
setTimeout(() => {
|
|
1682
|
-
const { GOOGLE_MAP_API_KEY } = getApiKey();
|
|
1683
|
-
if (GOOGLE_MAP_API_KEY)
|
|
1684
|
-
Location.setGoogleApiKey(GOOGLE_MAP_API_KEY);
|
|
1685
|
-
}, 500);
|
|
1686
1731
|
var getPredictionsFromCoords = async (coords) => {
|
|
1687
|
-
const { GOOGLE_MAP_API_KEY } =
|
|
1732
|
+
const { GOOGLE_MAP_API_KEY } = getConfig();
|
|
1688
1733
|
if (!GOOGLE_MAP_API_KEY)
|
|
1689
1734
|
console.error(
|
|
1690
1735
|
"Google map api key needs to be set to use this component \nMake sure to run initialize() with a valid google map api key"
|
|
@@ -1719,10 +1764,10 @@ var Locator = ({
|
|
|
1719
1764
|
float = true,
|
|
1720
1765
|
country = "ng"
|
|
1721
1766
|
}) => {
|
|
1722
|
-
const { GOOGLE_MAP_API_KEY } =
|
|
1723
|
-
const [changed, setChanged] =
|
|
1724
|
-
const [value, setValue] =
|
|
1725
|
-
const [prediction, setPrediction] =
|
|
1767
|
+
const { GOOGLE_MAP_API_KEY } = getConfig();
|
|
1768
|
+
const [changed, setChanged] = useState7(false);
|
|
1769
|
+
const [value, setValue] = useState7("");
|
|
1770
|
+
const [prediction, setPrediction] = useState7([]);
|
|
1726
1771
|
const colors2 = useColors();
|
|
1727
1772
|
const styles2 = ScaledSheet13.create({
|
|
1728
1773
|
list: {
|
|
@@ -1802,7 +1847,7 @@ var Locator = ({
|
|
|
1802
1847
|
setChanged(false);
|
|
1803
1848
|
setPrediction([]);
|
|
1804
1849
|
};
|
|
1805
|
-
|
|
1850
|
+
useEffect4(() => {
|
|
1806
1851
|
if (!GOOGLE_MAP_API_KEY)
|
|
1807
1852
|
console.error(
|
|
1808
1853
|
"Google map api key needs to be set to use this component \nMake sure to run initialize() with a valid google map api key"
|
|
@@ -1932,7 +1977,7 @@ var Spinner = ({
|
|
|
1932
1977
|
alignItems: "center",
|
|
1933
1978
|
justifyContent: "center",
|
|
1934
1979
|
position: fullscreen ? "absolute" : "relative",
|
|
1935
|
-
backgroundColor: fullscreen ? colors2.white[1] + "
|
|
1980
|
+
backgroundColor: fullscreen ? colors2.white[1] + "dd" : void 0,
|
|
1936
1981
|
...style
|
|
1937
1982
|
},
|
|
1938
1983
|
content: {
|
|
@@ -1954,7 +1999,10 @@ var Spinner_default = Spinner;
|
|
|
1954
1999
|
|
|
1955
2000
|
// ../src/Components/OTPInput.tsx
|
|
1956
2001
|
import React19, { useMemo } from "react";
|
|
1957
|
-
import {
|
|
2002
|
+
import {
|
|
2003
|
+
TextInput as TextInput3,
|
|
2004
|
+
View as View14
|
|
2005
|
+
} from "react-native";
|
|
1958
2006
|
import { ScaledSheet as ScaledSheet16, ms as ms3 } from "react-native-size-matters";
|
|
1959
2007
|
var OTPInput = ({
|
|
1960
2008
|
length = 6,
|
|
@@ -1969,6 +2017,36 @@ var OTPInput = ({
|
|
|
1969
2017
|
() => Array(length).fill(0).map((_) => React19.createRef()),
|
|
1970
2018
|
[length]
|
|
1971
2019
|
);
|
|
2020
|
+
console.log("v", value);
|
|
2021
|
+
const onChangeHandler = (val, index) => {
|
|
2022
|
+
if (value.length >= length && val.length > 0)
|
|
2023
|
+
return;
|
|
2024
|
+
if (val.length > 1) {
|
|
2025
|
+
console.log("reached", val);
|
|
2026
|
+
const digits = val.replace(/\D/g, "").slice(0, length);
|
|
2027
|
+
onChange(digits);
|
|
2028
|
+
if (digits.length === length) {
|
|
2029
|
+
inputRefs[length - 1].current?.focus();
|
|
2030
|
+
}
|
|
2031
|
+
return;
|
|
2032
|
+
}
|
|
2033
|
+
if (val.length === 0) {
|
|
2034
|
+
const newValue2 = value.slice(0, index) + value.slice(index + 1);
|
|
2035
|
+
onChange(newValue2);
|
|
2036
|
+
if (index > 0) {
|
|
2037
|
+
inputRefs[index - 1].current?.focus();
|
|
2038
|
+
}
|
|
2039
|
+
return;
|
|
2040
|
+
}
|
|
2041
|
+
const digit = val.replace(/\D/g, "").slice(0, 1);
|
|
2042
|
+
if (!digit)
|
|
2043
|
+
return;
|
|
2044
|
+
const newValue = value.slice(0, index) + digit + value.slice(index + 1);
|
|
2045
|
+
onChange(newValue);
|
|
2046
|
+
if (index < length - 1) {
|
|
2047
|
+
inputRefs[index + 1].current?.focus();
|
|
2048
|
+
}
|
|
2049
|
+
};
|
|
1972
2050
|
const colors2 = useColors();
|
|
1973
2051
|
const styles2 = ScaledSheet16.create({
|
|
1974
2052
|
root: {},
|
|
@@ -1991,27 +2069,7 @@ var OTPInput = ({
|
|
|
1991
2069
|
TextInput3,
|
|
1992
2070
|
{
|
|
1993
2071
|
ref: inputRefs[index],
|
|
1994
|
-
onChangeText: (val) =>
|
|
1995
|
-
if (val.length === 1) {
|
|
1996
|
-
if (index !== length - 1)
|
|
1997
|
-
inputRefs[index + 1].current?.focus();
|
|
1998
|
-
let text = value;
|
|
1999
|
-
text = text.slice(0, index) + val + text.slice(index + 1);
|
|
2000
|
-
onChange(text);
|
|
2001
|
-
} else if (val.length === 0) {
|
|
2002
|
-
if (index !== 0) {
|
|
2003
|
-
inputRefs[index - 1].current?.focus();
|
|
2004
|
-
let text = value;
|
|
2005
|
-
text = text.slice(0, index);
|
|
2006
|
-
onChange(text);
|
|
2007
|
-
} else
|
|
2008
|
-
onChange("");
|
|
2009
|
-
} else {
|
|
2010
|
-
let text = val.replace(/\D/g, "").slice(0, length);
|
|
2011
|
-
onChange(text);
|
|
2012
|
-
inputRefs[text.length < length - 1 ? text.length : length - 1]?.current?.focus();
|
|
2013
|
-
}
|
|
2014
|
-
},
|
|
2072
|
+
onChangeText: (val) => onChangeHandler(val, index),
|
|
2015
2073
|
value: value[index] || "",
|
|
2016
2074
|
blurOnSubmit: false,
|
|
2017
2075
|
keyboardType: "number-pad",
|