@towsila/expo-ui-library 1.9.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@towsila/expo-ui-library",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -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} seconds
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
- <Arrow width={20} height={20} color={colors.text.primary} style={styles.skipIcon}/>
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
- {/* Sharp container wraps the input + icons */}
63
- <SharpContainer
64
- height={height}
65
- bgColor={bgColor ?? colors.background.main}
66
- borderColor={getBorderColor()} // dynamic border
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
- <TextInput
82
- value={value}
83
- onChangeText={(text) => {
84
- onChangeText(text);
85
- if (error) onClearError?.();
86
- }}
87
- placeholder={placeholder}
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
- {iconRight && (
107
- <TouchableOpacity onPress={onPressIconRight} style={styles.iconRight}>
108
- {iconRight(colors.semantic.border)}
109
- </TouchableOpacity>
110
- )}
111
- </View>
112
- </SharpContainer>
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
- {error && <ErrorMessage message={error} />}
115
- </View>
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
- iconRight: {
132
- position: "absolute",
133
- right: 14,
134
- zIndex: 1,
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
  });