@towsila/expo-ui-library 4.11.5 → 4.11.6
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/src/components/reusable/templateSubPage.tsx +46 -31
- package/src/components/screens/AddReportScreen.tsx +55 -61
- package/src/components/screens/LegalScreen.tsx +27 -30
- package/src/components/screens/VerificationCodeScreen.tsx +4 -2
- package/src/components/screens/confirmDeleteScreen.tsx +81 -27
- package/src/components/screens/forgotPasswordScreen.tsx +15 -12
- package/src/components/screens/loginScreen.tsx +183 -79
- package/src/components/screens/onBoarding.tsx +98 -73
- package/src/components/screens/profileScreen.tsx +84 -32
- package/src/components/screens/resetPassword.tsx +3 -0
- package/src/components/screens/signUpScreen.tsx +98 -93
- package/src/components/screens/sucessScreen.tsx +75 -28
- package/src/components/ui/AnimatedSuccessIcon.tsx +15 -8
- package/src/components/ui/OTPInput.tsx +59 -17
- package/src/components/ui/PageTopBar.tsx +45 -33
- package/src/components/ui/customPopup.tsx +78 -86
- package/src/components/ui/dynamicForm.tsx +49 -18
- package/src/components/ui/input.tsx +102 -65
- package/src/components/ui/navigationCard.tsx +60 -47
- package/src/components/ui/pageIndicator.tsx +42 -18
- package/src/components/ui/requestCard.tsx +161 -105
- package/src/components/ui/select.tsx +49 -33
- package/src/components/ui/sharpButton.tsx +37 -20
- package/src/components/ui/termsPopup.tsx +74 -45
- package/src/components/ui/textArea.tsx +37 -40
- package/src/components/ui/toast.tsx +49 -52
|
@@ -4,6 +4,7 @@ import PasswordRequirementsCard from "../ui/passwordRequirmentCard";
|
|
|
4
4
|
import SharpInput from "../ui/sharpInput";
|
|
5
5
|
import {LockClosed, EyeOff, Eye} from "@towsila/icons";
|
|
6
6
|
import Input from "../ui/input";
|
|
7
|
+
import { View } from "react-native";
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
interface ResetPasswordScreenProps {
|
|
@@ -55,6 +56,7 @@ export default function ResetPasswordScreen({
|
|
|
55
56
|
onBack={onBack}
|
|
56
57
|
loading={form.loading}
|
|
57
58
|
>
|
|
59
|
+
<View style={{ marginTop: 20 }}>
|
|
58
60
|
{includeOldPassword && (
|
|
59
61
|
<Input
|
|
60
62
|
label={oldPasswordLabel}
|
|
@@ -109,6 +111,7 @@ export default function ResetPasswordScreen({
|
|
|
109
111
|
cardItems = {cardItems}
|
|
110
112
|
/>
|
|
111
113
|
)}
|
|
114
|
+
</View>
|
|
112
115
|
</TemplateSubPage>
|
|
113
116
|
);
|
|
114
117
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { ScrollView, Text, TouchableOpacity, View } from "react-native";
|
|
2
|
+
import { ScrollView, Text, TouchableOpacity, View, KeyboardAvoidingView, Platform } from "react-native";
|
|
3
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
3
4
|
import { Field } from "../../types/formFields";
|
|
4
5
|
import { useAppTheme } from "../../context/ThemeContext";
|
|
5
6
|
import { useLanguage } from "../../context/LanguageContext";
|
|
@@ -28,10 +29,10 @@ interface SignupProps {
|
|
|
28
29
|
dialogTitle: string;
|
|
29
30
|
dialogDescription: string;
|
|
30
31
|
dialogButton: string;
|
|
31
|
-
agreeText?: string;
|
|
32
|
-
termsLinkText?: string;
|
|
32
|
+
agreeText?: string;
|
|
33
|
+
termsLinkText?: string;
|
|
33
34
|
t?: (key: string) => string;
|
|
34
|
-
termsLink?:()=>void;
|
|
35
|
+
termsLink?: () => void;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export default function SignUpScreen({
|
|
@@ -64,105 +65,109 @@ export default function SignUpScreen({
|
|
|
64
65
|
formState,
|
|
65
66
|
onSubmit,
|
|
66
67
|
});
|
|
67
|
-
const align = isRTL?"row-reverse":"row";
|
|
68
|
-
return (
|
|
69
|
-
<View style={{ flex: 1, paddingHorizontal: 25, paddingTop: 50, paddingBottom: 20 }}>
|
|
70
|
-
{/* Fixed: header */}
|
|
71
|
-
<ScreenHeader title={title} description={""} />
|
|
68
|
+
const align = isRTL ? "row-reverse" : "row";
|
|
72
69
|
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
return (
|
|
71
|
+
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background.main }}>
|
|
72
|
+
<KeyboardAvoidingView
|
|
75
73
|
style={{ flex: 1 }}
|
|
76
|
-
|
|
77
|
-
keyboardShouldPersistTaps="handled"
|
|
78
|
-
contentContainerStyle={{ paddingBottom: 20 }}
|
|
74
|
+
behavior={Platform.OS === "ios" ? "padding" : undefined}
|
|
79
75
|
>
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
formState={formState}
|
|
83
|
-
setFormState={setFormState}
|
|
84
|
-
errors={errors}
|
|
85
|
-
clearError={clearError}
|
|
86
|
-
nextLabel={nextLabel}
|
|
87
|
-
backLabel={backLabel}
|
|
88
|
-
setErrors={setErrors}
|
|
89
|
-
translator={t}
|
|
90
|
-
/>
|
|
76
|
+
<View style={{ flex: 1, paddingHorizontal: 20, paddingTop: 16 }}>
|
|
77
|
+
<ScreenHeader title={title} description={""} />
|
|
91
78
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
style={{ color: colors.primary, fontFamily: Fonts.montserrat.semiBold, textDecorationLine:"underline" }}
|
|
110
|
-
>
|
|
111
|
-
{termsLinkText}
|
|
112
|
-
</Text>
|
|
113
|
-
</TouchableOpacity>
|
|
114
|
-
|
|
115
|
-
</View>
|
|
79
|
+
<ScrollView
|
|
80
|
+
style={{ flex: 1 }}
|
|
81
|
+
showsVerticalScrollIndicator={false}
|
|
82
|
+
keyboardShouldPersistTaps="handled"
|
|
83
|
+
contentContainerStyle={{ paddingBottom: 16 }}
|
|
84
|
+
>
|
|
85
|
+
<DynamicForm
|
|
86
|
+
fields={fields}
|
|
87
|
+
formState={formState}
|
|
88
|
+
setFormState={setFormState}
|
|
89
|
+
errors={errors}
|
|
90
|
+
clearError={clearError}
|
|
91
|
+
nextLabel={nextLabel}
|
|
92
|
+
backLabel={backLabel}
|
|
93
|
+
setErrors={setErrors}
|
|
94
|
+
translator={t}
|
|
95
|
+
/>
|
|
116
96
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
97
|
+
{/* Terms row — sentence + inline link, wraps naturally */}
|
|
98
|
+
<View style={{ marginTop: 8, marginBottom: 24 }}>
|
|
99
|
+
<Text
|
|
100
|
+
style={{
|
|
101
|
+
fontSize: textSize.xs,
|
|
102
|
+
color: colors.text.secondary,
|
|
103
|
+
fontFamily: Fonts.montserrat.regular,
|
|
104
|
+
textAlign: isRTL ? "right" : "left",
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
{agreeText}{" "}
|
|
108
|
+
<Text
|
|
109
|
+
onPress={termsLink}
|
|
110
|
+
style={{
|
|
111
|
+
color: colors.primary,
|
|
112
|
+
fontFamily: Fonts.montserrat.semiBold,
|
|
113
|
+
textDecorationLine: "underline",
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
{termsLinkText}
|
|
117
|
+
</Text>
|
|
118
|
+
</Text>
|
|
119
|
+
</View>
|
|
124
120
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
<Text
|
|
135
|
-
style={{
|
|
136
|
-
fontSize: textSize.xs,
|
|
137
|
-
color: colors.text.secondary,
|
|
138
|
-
fontFamily: Fonts.montserrat.regular,
|
|
139
|
-
}}
|
|
140
|
-
>
|
|
141
|
-
{haveAccountLabel}
|
|
142
|
-
</Text>
|
|
143
|
-
<TouchableOpacity onPress={onLogin}>
|
|
144
|
-
<Text
|
|
121
|
+
<SharpButton
|
|
122
|
+
text={buttonLabel}
|
|
123
|
+
bgColor={colors.primary}
|
|
124
|
+
onPress={handleSubmit}
|
|
125
|
+
loading={loading}
|
|
126
|
+
height={50}
|
|
127
|
+
/>
|
|
128
|
+
|
|
129
|
+
<View
|
|
145
130
|
style={{
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
131
|
+
flexDirection: align,
|
|
132
|
+
justifyContent: "center",
|
|
133
|
+
alignItems: "center",
|
|
134
|
+
gap: 4,
|
|
135
|
+
marginTop: 15,
|
|
149
136
|
}}
|
|
150
137
|
>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
138
|
+
<Text
|
|
139
|
+
style={{
|
|
140
|
+
fontSize: textSize.xs,
|
|
141
|
+
color: colors.text.secondary,
|
|
142
|
+
fontFamily: Fonts.montserrat.regular,
|
|
143
|
+
}}
|
|
144
|
+
>
|
|
145
|
+
{haveAccountLabel}
|
|
146
|
+
</Text>
|
|
147
|
+
<TouchableOpacity onPress={onLogin}>
|
|
148
|
+
<Text
|
|
149
|
+
style={{
|
|
150
|
+
fontSize: textSize.xs,
|
|
151
|
+
fontFamily: Fonts.montserrat.regular,
|
|
152
|
+
color: colors.primary,
|
|
153
|
+
}}
|
|
154
|
+
>
|
|
155
|
+
{loginLabel}
|
|
156
|
+
</Text>
|
|
157
|
+
</TouchableOpacity>
|
|
158
|
+
</View>
|
|
159
|
+
</ScrollView>
|
|
154
160
|
</View>
|
|
155
|
-
</ScrollView>
|
|
156
161
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
</
|
|
162
|
+
<TermsPopup
|
|
163
|
+
title={dialogTitle}
|
|
164
|
+
description={dialogDescription}
|
|
165
|
+
buttonText={dialogButton}
|
|
166
|
+
showTerms={showTerms}
|
|
167
|
+
generalTerms={generalTerms}
|
|
168
|
+
onAgree={() => setShowTerms(false)}
|
|
169
|
+
/>
|
|
170
|
+
</KeyboardAvoidingView>
|
|
171
|
+
</SafeAreaView>
|
|
167
172
|
);
|
|
168
173
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Text, View } from "react-native";
|
|
1
|
+
import { ScrollView, Text, View } from "react-native";
|
|
2
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
2
3
|
import { useAppTheme } from "../../context/ThemeContext";
|
|
3
4
|
import { useLanguage } from "../../context/LanguageContext";
|
|
4
5
|
import { Fonts, textSize } from "../../tokens/typography";
|
|
5
6
|
import AnimatedSuccessIcon from "../ui/AnimatedSuccessIcon";
|
|
6
7
|
import SharpButton from "../ui/sharpButton";
|
|
7
8
|
|
|
8
|
-
|
|
9
9
|
interface SuccessScreenProps {
|
|
10
10
|
title?: string;
|
|
11
11
|
subtitle?: string;
|
|
@@ -13,7 +13,7 @@ interface SuccessScreenProps {
|
|
|
13
13
|
buttonText: string;
|
|
14
14
|
children: React.ReactNode;
|
|
15
15
|
onNext: () => void;
|
|
16
|
-
footer?:React.ReactNode;
|
|
16
|
+
footer?: React.ReactNode;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export default function SuccessScreen({
|
|
@@ -26,32 +26,79 @@ export default function SuccessScreen({
|
|
|
26
26
|
footer,
|
|
27
27
|
}: SuccessScreenProps) {
|
|
28
28
|
const { colors } = useAppTheme();
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const { isRTL } = useLanguage();
|
|
30
|
+
const align = isRTL ? "right" : "left";
|
|
31
|
+
|
|
31
32
|
return (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background.main }}>
|
|
34
|
+
<ScrollView
|
|
35
|
+
contentContainerStyle={{
|
|
36
|
+
flexGrow: 1,
|
|
37
|
+
paddingHorizontal: 32,
|
|
38
|
+
paddingTop: 60,
|
|
39
|
+
paddingBottom: 60,
|
|
40
|
+
}}
|
|
41
|
+
showsVerticalScrollIndicator={false}
|
|
42
|
+
keyboardShouldPersistTaps="handled"
|
|
43
|
+
>
|
|
35
44
|
<Text
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
style={{
|
|
46
|
+
color: colors.text.primary,
|
|
47
|
+
textAlign: align,
|
|
48
|
+
fontFamily: Fonts.montserrat.semiBold,
|
|
49
|
+
fontSize: textSize.xxl,
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
{title}
|
|
53
|
+
</Text>
|
|
54
|
+
{subtitle && (
|
|
55
|
+
<Text
|
|
56
|
+
style={{
|
|
57
|
+
fontSize: textSize.md,
|
|
58
|
+
fontFamily: Fonts.montserrat.regular,
|
|
59
|
+
color: colors.text.secondary,
|
|
60
|
+
textAlign: align,
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
{subtitle}
|
|
64
|
+
</Text>
|
|
65
|
+
)}
|
|
66
|
+
|
|
67
|
+
<View
|
|
68
|
+
style={{
|
|
69
|
+
flex: 1,
|
|
70
|
+
marginTop: 70,
|
|
71
|
+
alignItems: isRTL ? "flex-end" : "flex-start",
|
|
72
|
+
gap: 20,
|
|
73
|
+
}}
|
|
74
|
+
>
|
|
75
|
+
<View
|
|
76
|
+
style={{
|
|
77
|
+
backgroundColor: colors.primary + "30",
|
|
78
|
+
padding: 25,
|
|
79
|
+
borderRadius: 30,
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
<AnimatedSuccessIcon color={colors.primary} size={37} strokeWidth={2} />
|
|
83
|
+
</View>
|
|
84
|
+
<Text
|
|
85
|
+
style={{
|
|
86
|
+
color: colors.text.secondary,
|
|
87
|
+
textAlign: align,
|
|
88
|
+
fontFamily: Fonts.montserrat.regular,
|
|
89
|
+
fontSize: textSize.md,
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
{description}
|
|
93
|
+
</Text>
|
|
94
|
+
{children}
|
|
95
|
+
</View>
|
|
96
|
+
|
|
97
|
+
<SharpButton text={buttonText} onPress={onNext} bgColor={colors.primary} />
|
|
98
|
+
|
|
99
|
+
{footer && <View style={{ marginTop: 20 }} />}
|
|
100
|
+
{footer}
|
|
101
|
+
</ScrollView>
|
|
102
|
+
</SafeAreaView>
|
|
56
103
|
);
|
|
57
104
|
}
|
|
@@ -7,7 +7,7 @@ const AnimatedPath = Animated.createAnimatedComponent(Path);
|
|
|
7
7
|
|
|
8
8
|
interface AnimatedSuccessIconProps {
|
|
9
9
|
size?: number;
|
|
10
|
-
color?: string;
|
|
10
|
+
color?: string;
|
|
11
11
|
strokeWidth?: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -25,22 +25,22 @@ export default function AnimatedSuccessIcon({
|
|
|
25
25
|
const checkProgress = useRef(new Animated.Value(0)).current;
|
|
26
26
|
|
|
27
27
|
useEffect(() => {
|
|
28
|
-
Animated.sequence([
|
|
29
|
-
// Stage 1 — circle outline draws itself in, starting from the top
|
|
28
|
+
const anim = Animated.sequence([
|
|
30
29
|
Animated.timing(circleProgress, {
|
|
31
30
|
toValue: 1,
|
|
32
31
|
duration: 600,
|
|
33
32
|
easing: Easing.out(Easing.ease),
|
|
34
|
-
useNativeDriver: false,
|
|
33
|
+
useNativeDriver: false,
|
|
35
34
|
}),
|
|
36
|
-
// Stage 2 — checkmark draws itself, only after the circle completes
|
|
37
35
|
Animated.timing(checkProgress, {
|
|
38
36
|
toValue: 1,
|
|
39
37
|
duration: 400,
|
|
40
38
|
easing: Easing.out(Easing.ease),
|
|
41
39
|
useNativeDriver: false,
|
|
42
40
|
}),
|
|
43
|
-
])
|
|
41
|
+
]);
|
|
42
|
+
anim.start();
|
|
43
|
+
return () => anim.stop();
|
|
44
44
|
}, []);
|
|
45
45
|
|
|
46
46
|
const circleDashoffset = circleProgress.interpolate({
|
|
@@ -54,7 +54,14 @@ export default function AnimatedSuccessIcon({
|
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
|
-
<View
|
|
57
|
+
<View
|
|
58
|
+
style={{
|
|
59
|
+
width: size,
|
|
60
|
+
height: size,
|
|
61
|
+
alignItems: "center",
|
|
62
|
+
justifyContent: "center",
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
58
65
|
<Svg width={size} height={size} viewBox="0 0 64 64">
|
|
59
66
|
<AnimatedCircle
|
|
60
67
|
cx={32}
|
|
@@ -66,7 +73,7 @@ export default function AnimatedSuccessIcon({
|
|
|
66
73
|
strokeLinecap="round"
|
|
67
74
|
strokeDasharray={CIRCLE_CIRCUMFERENCE}
|
|
68
75
|
strokeDashoffset={circleDashoffset}
|
|
69
|
-
rotation="-90"
|
|
76
|
+
rotation="-90"
|
|
70
77
|
origin="32, 32"
|
|
71
78
|
/>
|
|
72
79
|
<AnimatedPath
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { useRef, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
TextInput,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
StyleProp,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
useWindowDimensions,
|
|
9
|
+
} from "react-native";
|
|
3
10
|
import { useAppTheme } from "../../context/ThemeContext";
|
|
4
11
|
import { textSize, Fonts } from "../../tokens/typography";
|
|
5
12
|
|
|
@@ -7,19 +14,36 @@ interface OtpInputProps {
|
|
|
7
14
|
length?: number;
|
|
8
15
|
onComplete?: (code: string) => void;
|
|
9
16
|
onChange?: (code: string) => void;
|
|
10
|
-
style?: StyleProp<
|
|
11
|
-
size?:number;
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
size?: number; // max size; will shrink to fit
|
|
12
19
|
borderRadius?: number;
|
|
13
20
|
fontFamily?: string;
|
|
14
21
|
}
|
|
15
22
|
|
|
16
|
-
export default function OtpInput({
|
|
23
|
+
export default function OtpInput({
|
|
24
|
+
length = 6,
|
|
25
|
+
onComplete,
|
|
26
|
+
onChange,
|
|
27
|
+
style,
|
|
28
|
+
size = 45,
|
|
29
|
+
borderRadius = 10,
|
|
30
|
+
fontFamily = Fonts.montserrat.regular,
|
|
31
|
+
}: OtpInputProps) {
|
|
17
32
|
const { colors } = useAppTheme();
|
|
18
|
-
const
|
|
33
|
+
const { width: screenWidth } = useWindowDimensions();
|
|
19
34
|
const [digits, setDigits] = useState<string[]>(Array(length).fill(""));
|
|
20
35
|
const [focusedIndex, setFocusedIndex] = useState<number | null>(null);
|
|
21
36
|
const refs = useRef<TextInput[]>([]);
|
|
22
37
|
|
|
38
|
+
// --- Responsive size calculation ---
|
|
39
|
+
// row padding: 20 each side (matches previous marginHorizontal: 20)
|
|
40
|
+
// gap: 12 between inputs
|
|
41
|
+
const horizontalPadding = 40;
|
|
42
|
+
const gap = 12;
|
|
43
|
+
const availableWidth = screenWidth - horizontalPadding - gap * (length - 1);
|
|
44
|
+
const computedSize = Math.min(size, Math.floor(availableWidth / length));
|
|
45
|
+
const boxSize = Math.max(computedSize, 36); // never go below 36pt touch target
|
|
46
|
+
|
|
23
47
|
const handleChange = (text: string, index: number) => {
|
|
24
48
|
const newDigits = [...digits];
|
|
25
49
|
newDigits[index] = text;
|
|
@@ -28,12 +52,9 @@ export default function OtpInput({ length = 6, onComplete, onChange, style, size
|
|
|
28
52
|
const code = newDigits.join("");
|
|
29
53
|
onChange?.(code);
|
|
30
54
|
|
|
31
|
-
|
|
55
|
+
if (text.length > 0 && index < length - 1) {
|
|
32
56
|
const nextIndex = index + 1;
|
|
33
|
-
|
|
34
|
-
requestAnimationFrame(() => {
|
|
35
|
-
refs.current[nextIndex]?.focus();
|
|
36
|
-
});
|
|
57
|
+
requestAnimationFrame(() => refs.current[nextIndex]?.focus());
|
|
37
58
|
}
|
|
38
59
|
|
|
39
60
|
if (code.length === length && newDigits.every((d) => d !== "")) {
|
|
@@ -41,16 +62,36 @@ export default function OtpInput({ length = 6, onComplete, onChange, style, size
|
|
|
41
62
|
}
|
|
42
63
|
};
|
|
43
64
|
|
|
65
|
+
const styles = createStyles(colors, boxSize);
|
|
66
|
+
|
|
44
67
|
return (
|
|
45
|
-
<View
|
|
68
|
+
<View
|
|
69
|
+
style={{
|
|
70
|
+
flexDirection: "row",
|
|
71
|
+
justifyContent: "center",
|
|
72
|
+
gap,
|
|
73
|
+
alignSelf: "center",
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
46
76
|
{digits.map((digit, index) => (
|
|
47
77
|
<TextInput
|
|
48
78
|
key={index}
|
|
49
|
-
ref={(r) => {
|
|
79
|
+
ref={(r) => {
|
|
80
|
+
if (r) refs.current[index] = r;
|
|
81
|
+
}}
|
|
50
82
|
style={[
|
|
51
83
|
styles.otpInput,
|
|
52
|
-
{
|
|
53
|
-
|
|
84
|
+
{
|
|
85
|
+
borderColor:
|
|
86
|
+
focusedIndex === index
|
|
87
|
+
? colors.primary
|
|
88
|
+
: colors.text.primary,
|
|
89
|
+
width: boxSize,
|
|
90
|
+
height: boxSize,
|
|
91
|
+
borderRadius,
|
|
92
|
+
fontFamily,
|
|
93
|
+
},
|
|
94
|
+
style,
|
|
54
95
|
]}
|
|
55
96
|
keyboardType="number-pad"
|
|
56
97
|
maxLength={1}
|
|
@@ -66,12 +107,13 @@ export default function OtpInput({ length = 6, onComplete, onChange, style, size
|
|
|
66
107
|
);
|
|
67
108
|
}
|
|
68
109
|
|
|
69
|
-
const createStyles = (colors: any) =>
|
|
110
|
+
const createStyles = (colors: any, boxSize: number) =>
|
|
70
111
|
StyleSheet.create({
|
|
71
112
|
otpInput: {
|
|
72
113
|
borderWidth: 1,
|
|
73
|
-
fontSize: textSize.md,
|
|
114
|
+
fontSize: Math.max(textSize.md, boxSize * 0.4),
|
|
74
115
|
color: colors.text.primary,
|
|
75
116
|
backgroundColor: colors.background.card,
|
|
76
117
|
},
|
|
77
|
-
});
|
|
118
|
+
});
|
|
119
|
+
|
|
@@ -1,40 +1,52 @@
|
|
|
1
1
|
import { Fonts, textSize } from "../../tokens/typography";
|
|
2
|
-
import {
|
|
3
|
-
import { I18nManager, Text, TouchableOpacity, View } from "react-native";
|
|
4
|
-
import {ArrowBack} from "@towsila/icons";
|
|
2
|
+
import { Text, View } from "react-native";
|
|
5
3
|
import BackIcon from "./backIcon";
|
|
6
4
|
import { useLanguage } from "../../context/LanguageContext";
|
|
5
|
+
import { useAppTheme } from "../../context/ThemeContext";
|
|
7
6
|
|
|
8
|
-
interface PageProps{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
interface PageProps {
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
onBack?: () => void;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
export default function ScreenHeader({title, description, onBack}:PageProps){
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</
|
|
39
|
-
|
|
13
|
+
export default function ScreenHeader({ title, description, onBack }: PageProps) {
|
|
14
|
+
const { colors } = useAppTheme();
|
|
15
|
+
const { isRTL } = useLanguage();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<View style={{ gap: 10 }}>
|
|
19
|
+
<View
|
|
20
|
+
style={{
|
|
21
|
+
minHeight: 44, // was: height (would clip on big fonts)
|
|
22
|
+
flexDirection: isRTL ? "row-reverse" : "row",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
gap: 15,
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
{onBack && <BackIcon onBack={onBack} />}
|
|
28
|
+
<Text
|
|
29
|
+
style={{
|
|
30
|
+
flexShrink: 1, // long titles wrap instead of overflowing
|
|
31
|
+
fontSize: textSize.xl,
|
|
32
|
+
fontFamily: Fonts.montserrat.bold,
|
|
33
|
+
color: colors.text.primary,
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
{title}
|
|
37
|
+
</Text>
|
|
38
|
+
</View>
|
|
39
|
+
<Text
|
|
40
|
+
style={{
|
|
41
|
+
fontSize: textSize.md,
|
|
42
|
+
fontFamily: Fonts.montserrat.regular,
|
|
43
|
+
color: colors.text.secondary,
|
|
44
|
+
textAlign: isRTL ? "right" : "left",
|
|
45
|
+
marginTop: 10,
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
{description}
|
|
49
|
+
</Text>
|
|
50
|
+
</View>
|
|
51
|
+
);
|
|
40
52
|
}
|