@towsila/expo-ui-library 3.6.1 → 4.0.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
|
@@ -44,6 +44,7 @@ export default function Input({
|
|
|
44
44
|
const { colors } = useAppTheme();
|
|
45
45
|
const [focused, setFocused] = useState(false);
|
|
46
46
|
const {isRTL} = useLanguage();
|
|
47
|
+
const [prefixW, setPrefixW] = useState(0);
|
|
47
48
|
return (
|
|
48
49
|
<View style={[style, {marginBottom: 4}]}>
|
|
49
50
|
{label && (
|
|
@@ -74,10 +75,16 @@ export default function Input({
|
|
|
74
75
|
/>
|
|
75
76
|
)}
|
|
76
77
|
{prefix && (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
<View
|
|
79
|
+
onLayout={(e) => setPrefixW(e.nativeEvent.layout.width)}
|
|
80
|
+
style={[
|
|
81
|
+
styles.prefix,
|
|
82
|
+
{ [isRTL ? "left" : "right"]: 0, flexDirection: isRTL?"row":"row-reverse", },
|
|
83
|
+
]}
|
|
84
|
+
>
|
|
85
|
+
{prefix}
|
|
86
|
+
</View>
|
|
87
|
+
)}
|
|
81
88
|
{/* input */}
|
|
82
89
|
<TextInput
|
|
83
90
|
value={value}
|
|
@@ -103,7 +110,7 @@ export default function Input({
|
|
|
103
110
|
direction: isRTL ? "rtl" : "ltr",
|
|
104
111
|
textAlign: isRTL ? "right" : "left",
|
|
105
112
|
|
|
106
|
-
paddingStart: iconLeft ? 42 : 16,
|
|
113
|
+
paddingStart: prefix ? prefixW + 10 : iconLeft ? 42 : 16,
|
|
107
114
|
paddingEnd: iconRight ? 42 : 16,
|
|
108
115
|
|
|
109
116
|
borderColor: error
|
|
@@ -140,10 +147,11 @@ export default function Input({
|
|
|
140
147
|
}
|
|
141
148
|
|
|
142
149
|
const styles = StyleSheet.create({
|
|
143
|
-
prefix:{
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
150
|
+
prefix: {
|
|
151
|
+
position: "absolute",
|
|
152
|
+
top: 0,
|
|
153
|
+
height: 50,
|
|
154
|
+
zIndex: 1,
|
|
155
|
+
alignItems: "center",
|
|
156
|
+
},
|
|
149
157
|
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { SvgProps } from "react-native-svg";
|
|
2
|
+
|
|
1
3
|
export interface Settings {
|
|
2
4
|
id: string;
|
|
3
5
|
title: string;
|
|
4
|
-
iconLeft: React.
|
|
6
|
+
iconLeft: React.ComponentType<SvgProps>;
|
|
5
7
|
iconRight?: React.ReactNode;
|
|
6
8
|
route?: string; // for navigation
|
|
7
9
|
isDarkModeToggle?: boolean; // marks the special dark mode row
|