@towsila/expo-ui-library 1.8.0 → 1.10.0
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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
-
import { Text, TouchableOpacity } from "react-native";
|
|
2
|
+
import { I18nManager, Text, TouchableOpacity } from "react-native";
|
|
3
3
|
import { useAppTheme } from "../../context/ThemeContext";
|
|
4
4
|
import { textSize, Fonts} from "../../tokens/typography";
|
|
5
5
|
import TemplateSubPage from "../reusable/templateSubPage";
|
|
@@ -17,6 +17,7 @@ interface VerificationCodeScreenProps {
|
|
|
17
17
|
resendBtn?:string;
|
|
18
18
|
onBack: ()=>void;
|
|
19
19
|
loading?: boolean;
|
|
20
|
+
unit?: string;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export default function VerificationCodeScreen({
|
|
@@ -30,6 +31,7 @@ export default function VerificationCodeScreen({
|
|
|
30
31
|
onBack,
|
|
31
32
|
loading,
|
|
32
33
|
resendBtn="Resend Code",
|
|
34
|
+
unit,
|
|
33
35
|
}: VerificationCodeScreenProps) {
|
|
34
36
|
const { colors } = useAppTheme();
|
|
35
37
|
const [code, setCode] = useState("");
|
|
@@ -52,7 +54,7 @@ export default function VerificationCodeScreen({
|
|
|
52
54
|
<SharpOtpInput length={4} onChange={setCode} />
|
|
53
55
|
{count !== 0 ? (
|
|
54
56
|
<Text style={{ textAlign: "center", color: colors.text.placeholder, fontSize: textSize.xs, fontFamily: Fonts.montserrat.regular}}>
|
|
55
|
-
{resendText}: {count}
|
|
57
|
+
{resendText}: {count} {unit}
|
|
56
58
|
</Text>
|
|
57
59
|
) : (
|
|
58
60
|
<TouchableOpacity onPress={handleResend}>
|
|
@@ -4,6 +4,7 @@ import { useAppTheme } from "../../context/ThemeContext";
|
|
|
4
4
|
import { Fonts, textSize } from "../../tokens/typography";
|
|
5
5
|
import {Arrow} from "@towsila/icons";
|
|
6
6
|
import SharpButton from "../ui/sharpButton";
|
|
7
|
+
import { I18nManager } from "react-native";
|
|
7
8
|
|
|
8
9
|
interface OnBoardingProps {
|
|
9
10
|
onSkip: () => void;
|
|
@@ -48,7 +49,15 @@ export default function OnBoarding({
|
|
|
48
49
|
>
|
|
49
50
|
{skipLabel}
|
|
50
51
|
</Text>
|
|
51
|
-
|
|
52
|
+
<Arrow
|
|
53
|
+
width={20}
|
|
54
|
+
height={20}
|
|
55
|
+
color={colors.text.primary}
|
|
56
|
+
style={[
|
|
57
|
+
styles.skipIcon,
|
|
58
|
+
I18nManager.isRTL && { transform: [{ scaleX: -1 }] },
|
|
59
|
+
]}
|
|
60
|
+
/>
|
|
52
61
|
</TouchableOpacity>
|
|
53
62
|
</View>
|
|
54
63
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fonts, textSize } from "../../tokens/typography";
|
|
2
2
|
import { useAppTheme } from "../../context/ThemeContext";
|
|
3
|
-
import { Text, TouchableOpacity, View } from "react-native";
|
|
3
|
+
import { I18nManager, Text, TouchableOpacity, View } from "react-native";
|
|
4
4
|
import {ArrowBack} from "@towsila/icons";
|
|
5
5
|
|
|
6
6
|
interface PageProps{
|
|
@@ -18,7 +18,7 @@ export default function PageTopBar({title, description, onBack}:PageProps){
|
|
|
18
18
|
flexDirection: "row",
|
|
19
19
|
alignItems: "center", marginBottom: 10 }}>
|
|
20
20
|
<TouchableOpacity onPress={onBack}>
|
|
21
|
-
<ArrowBack width={24} height={24} color={colors.text.primary}/>
|
|
21
|
+
<ArrowBack width={24} height={24} color={colors.text.primary} style={[I18nManager.isRTL && { transform: [{ scaleX: -1 }] },]}/>
|
|
22
22
|
</TouchableOpacity>
|
|
23
23
|
<Text style={{ flex: 1, textAlign: "center", color: colors.text.primary, fontSize: textSize.xxl, fontFamily: Fonts.montserrat.bold }}>
|
|
24
24
|
{title}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { Text, TextInput, TextInputProps, View, StyleSheet, TouchableOpacity } from "react-native";
|
|
2
|
+
import { Text, TextInput, TextInputProps, View, StyleSheet, TouchableOpacity, I18nManager } from "react-native";
|
|
3
3
|
import { useAppTheme } from "../../context/ThemeContext";
|
|
4
4
|
import { textSize, Fonts } from "../../tokens/typography";
|
|
5
5
|
import ErrorMessage from "./error";
|
|
6
6
|
import SharpContainer from "./sharpContainer";
|
|
7
|
+
|
|
7
8
|
interface InputProps extends TextInputProps {
|
|
8
9
|
value: string;
|
|
9
10
|
onChangeText: (text: string) => void;
|
|
@@ -44,76 +45,61 @@ export default function SharpInput({
|
|
|
44
45
|
return colors.semantic.border; // default border color
|
|
45
46
|
};
|
|
46
47
|
|
|
47
|
-
return (
|
|
48
|
-
<View style={{ marginBottom: 4 }}>
|
|
49
|
-
{label && (
|
|
50
|
-
<Text
|
|
51
|
-
style={{
|
|
52
|
-
color: colors.text.primary,
|
|
53
|
-
fontSize: textSize.xs,
|
|
54
|
-
fontFamily: Fonts.montserrat.semiBold,
|
|
55
|
-
marginBottom: 6,
|
|
56
|
-
}}
|
|
57
|
-
>
|
|
58
|
-
{label}
|
|
59
|
-
</Text>
|
|
60
|
-
)}
|
|
61
48
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<View style={styles.inputWrapper}>
|
|
70
|
-
{iconLeft && (
|
|
71
|
-
<View style={styles.iconLeft}>
|
|
72
|
-
{iconLeft(getBorderColor())}
|
|
73
|
-
</View>
|
|
74
|
-
)}
|
|
75
|
-
{prefix && (
|
|
76
|
-
<View style={styles.prefix}>
|
|
77
|
-
{prefix}
|
|
78
|
-
</View>
|
|
79
|
-
)}
|
|
49
|
+
return (
|
|
50
|
+
<View style={{ marginBottom: 4 }}>
|
|
51
|
+
{label && (
|
|
52
|
+
<Text style={{ color: colors.text.primary, fontSize: textSize.xs, fontFamily: Fonts.montserrat.semiBold, marginBottom: 6 }}>
|
|
53
|
+
{label}
|
|
54
|
+
</Text>
|
|
55
|
+
)}
|
|
80
56
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
placeholderTextColor={colors.text.secondary}
|
|
89
|
-
onFocus={() => {
|
|
90
|
-
setFocused(true);
|
|
91
|
-
if (error) onClearError?.();
|
|
92
|
-
}}
|
|
93
|
-
onBlur={() => setFocused(false)}
|
|
94
|
-
style={[
|
|
95
|
-
styles.input,
|
|
96
|
-
{
|
|
97
|
-
color: colors.text.primary,
|
|
98
|
-
paddingLeft: iconLeft ? 42 : 16,
|
|
99
|
-
paddingRight: iconRight ? 42 : 16,
|
|
100
|
-
backgroundColor: "transparent", // let SharpContainer handle background
|
|
101
|
-
},
|
|
102
|
-
]}
|
|
103
|
-
{...rest}
|
|
104
|
-
/>
|
|
57
|
+
<SharpContainer height={height} bgColor={bgColor ?? colors.background.main} borderColor={getBorderColor()}>
|
|
58
|
+
<View style={styles.inputWrapper}>
|
|
59
|
+
{iconLeft && (
|
|
60
|
+
<View style={styles.iconSlot}>
|
|
61
|
+
{iconLeft(getBorderColor())}
|
|
62
|
+
</View>
|
|
63
|
+
)}
|
|
105
64
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
65
|
+
{prefix && (
|
|
66
|
+
<View style={styles.prefix}>
|
|
67
|
+
{prefix}
|
|
68
|
+
</View>
|
|
69
|
+
)}
|
|
70
|
+
|
|
71
|
+
<TextInput
|
|
72
|
+
value={value}
|
|
73
|
+
onChangeText={(text) => {
|
|
74
|
+
onChangeText(text);
|
|
75
|
+
if (error) onClearError?.();
|
|
76
|
+
}}
|
|
77
|
+
placeholder={placeholder}
|
|
78
|
+
placeholderTextColor={colors.text.secondary}
|
|
79
|
+
onFocus={() => { setFocused(true); if (error) onClearError?.(); }}
|
|
80
|
+
onBlur={() => setFocused(false)}
|
|
81
|
+
style={[
|
|
82
|
+
styles.input,
|
|
83
|
+
{
|
|
84
|
+
color: colors.text.primary,
|
|
85
|
+
backgroundColor: "transparent",
|
|
86
|
+
textAlign: I18nManager.isRTL ? "right" : "left",
|
|
87
|
+
},
|
|
88
|
+
]}
|
|
89
|
+
{...rest}
|
|
90
|
+
/>
|
|
113
91
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
92
|
+
{iconRight && (
|
|
93
|
+
<TouchableOpacity onPress={onPressIconRight} style={styles.iconSlot}>
|
|
94
|
+
{iconRight(colors.semantic.border)}
|
|
95
|
+
</TouchableOpacity>
|
|
96
|
+
)}
|
|
97
|
+
</View>
|
|
98
|
+
</SharpContainer>
|
|
99
|
+
|
|
100
|
+
{error && <ErrorMessage message={error} />}
|
|
101
|
+
</View>
|
|
102
|
+
);
|
|
117
103
|
}
|
|
118
104
|
|
|
119
105
|
const styles = StyleSheet.create({
|
|
@@ -121,17 +107,11 @@ const styles = StyleSheet.create({
|
|
|
121
107
|
flex: 1,
|
|
122
108
|
flexDirection: "row",
|
|
123
109
|
alignItems: "center",
|
|
124
|
-
paddingHorizontal: 4, // small inner padding
|
|
125
|
-
},
|
|
126
|
-
iconLeft: {
|
|
127
|
-
position: "absolute",
|
|
128
|
-
left: 14,
|
|
129
|
-
zIndex: 1,
|
|
130
110
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
111
|
+
iconSlot: {
|
|
112
|
+
paddingHorizontal: 12,
|
|
113
|
+
justifyContent: "center",
|
|
114
|
+
alignItems: "center",
|
|
135
115
|
},
|
|
136
116
|
input: {
|
|
137
117
|
flex: 1,
|
|
@@ -143,6 +123,7 @@ const styles = StyleSheet.create({
|
|
|
143
123
|
prefix:{
|
|
144
124
|
flexDirection: "row",
|
|
145
125
|
gap: 4,
|
|
146
|
-
alignItems:"center"
|
|
126
|
+
alignItems:"center",
|
|
127
|
+
paddingStart: 14,
|
|
147
128
|
}
|
|
148
129
|
});
|
|
@@ -17,11 +17,9 @@ const LanguageContext = createContext<LanguageContextValue | null>(null);
|
|
|
17
17
|
|
|
18
18
|
export function LanguageProvider({
|
|
19
19
|
defaultLanguage = "en",
|
|
20
|
-
onLanguageChange,
|
|
21
20
|
children,
|
|
22
21
|
}: {
|
|
23
22
|
defaultLanguage?: Language;
|
|
24
|
-
onLanguageChange?: (lang: Language) => void;
|
|
25
23
|
children: React.ReactNode;
|
|
26
24
|
}) {
|
|
27
25
|
const [language, setLanguageState] = useState<Language>(defaultLanguage);
|
|
@@ -31,7 +29,6 @@ export function LanguageProvider({
|
|
|
31
29
|
AsyncStorage.getItem(LANGUAGE_KEY).then((saved) => {
|
|
32
30
|
if (saved === "en" || saved === "fr" || saved === "ar") {
|
|
33
31
|
setLanguageState(saved);
|
|
34
|
-
onLanguageChange?.(saved);
|
|
35
32
|
|
|
36
33
|
const shouldBeRTL = RTL_LANGUAGES.includes(saved);
|
|
37
34
|
if (I18nManager.isRTL !== shouldBeRTL) {
|
|
@@ -46,7 +43,6 @@ export function LanguageProvider({
|
|
|
46
43
|
const setLanguage = async (lang: Language) => {
|
|
47
44
|
setLanguageState(lang);
|
|
48
45
|
await AsyncStorage.setItem(LANGUAGE_KEY, lang);
|
|
49
|
-
onLanguageChange?.(lang);
|
|
50
46
|
|
|
51
47
|
const shouldBeRTL = RTL_LANGUAGES.includes(lang);
|
|
52
48
|
if (I18nManager.isRTL !== shouldBeRTL) {
|