@momo-kits/foundation 0.92.8-rc.7 → 0.92.8-rc.8
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/Input/InputMoney.tsx +9 -0
- package/Input/index.tsx +5 -10
- package/Title/index.tsx +7 -2
- package/package.json +1 -1
package/Input/InputMoney.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, {
|
|
2
2
|
forwardRef,
|
|
3
3
|
useContext,
|
|
4
|
+
useEffect,
|
|
4
5
|
useImperativeHandle,
|
|
5
6
|
useRef,
|
|
6
7
|
useState,
|
|
@@ -40,6 +41,7 @@ const InputMoney = forwardRef(
|
|
|
40
41
|
defaultValue = '',
|
|
41
42
|
accessibilityLabel,
|
|
42
43
|
hintText,
|
|
44
|
+
value: _value,
|
|
43
45
|
...props
|
|
44
46
|
}: InputMoneyProps,
|
|
45
47
|
ref,
|
|
@@ -48,6 +50,13 @@ const InputMoney = forwardRef(
|
|
|
48
50
|
const [focused, setFocused] = useState(false);
|
|
49
51
|
const inputRef = useRef<TextInput>(null);
|
|
50
52
|
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (_value) {
|
|
55
|
+
setValue(validateText(_value));
|
|
56
|
+
onChangeText?.(formatMoneyToNumber(_value, 'đ').toString());
|
|
57
|
+
}
|
|
58
|
+
}, [_value]);
|
|
59
|
+
|
|
51
60
|
const validateText = (text: string) => {
|
|
52
61
|
const valueFormat = formatMoneyToNumber(text, 'đ');
|
|
53
62
|
return formatNumberToMoney(valueFormat, 'đ');
|
package/Input/index.tsx
CHANGED
|
@@ -105,14 +105,8 @@ export interface InputProps extends TextInputProps {
|
|
|
105
105
|
hintText?: string;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
InputProps,
|
|
110
|
-
'size' | 'icon' | 'iconColor'
|
|
111
|
-
>;
|
|
112
|
-
|
|
113
|
-
type InputPropsWithoutPlaceholder = Omit<InputProps, 'placeholder'>;
|
|
114
|
-
|
|
115
|
-
export interface InputTextAreaProps extends InputPropsWithoutSizeAndIcon {
|
|
108
|
+
export interface InputTextAreaProps
|
|
109
|
+
extends Omit<InputProps, 'size' | 'icon' | 'iconColor'> {
|
|
116
110
|
/**
|
|
117
111
|
* Optional. Defines the height of the InputTextArea component.
|
|
118
112
|
* It can be used to set a specific height for the text area.
|
|
@@ -152,11 +146,12 @@ export interface InputSearchProps extends TextInputProps {
|
|
|
152
146
|
params?: any;
|
|
153
147
|
}
|
|
154
148
|
|
|
155
|
-
export interface InputMoneyProps extends
|
|
149
|
+
export interface InputMoneyProps extends Omit<InputProps, 'placeholder'> {}
|
|
156
150
|
|
|
157
151
|
export type OTPInputLength = 2 | 4 | 6 | 8 | 10;
|
|
158
152
|
|
|
159
|
-
export interface InputOTPProps
|
|
153
|
+
export interface InputOTPProps
|
|
154
|
+
extends Omit<InputProps, 'size' | 'icon' | 'iconColor'> {
|
|
160
155
|
/**
|
|
161
156
|
* Optional. Defines the length of the OTP (One Time Password) input.
|
|
162
157
|
* Can be 2, 4, 6, 8, or 10.
|
package/Title/index.tsx
CHANGED
|
@@ -143,8 +143,14 @@ const Title: FC<TitleProps> = ({
|
|
|
143
143
|
const renderActionRight = () => {
|
|
144
144
|
if (!showRightAction || showTrailingAction) return false;
|
|
145
145
|
|
|
146
|
+
const lineHeight = styleSheet[typography].lineHeight;
|
|
147
|
+
|
|
146
148
|
return (
|
|
147
|
-
<View
|
|
149
|
+
<View
|
|
150
|
+
style={{
|
|
151
|
+
height: lineHeight,
|
|
152
|
+
justifyContent: 'center',
|
|
153
|
+
}}>
|
|
148
154
|
{!buttonTitle ? (
|
|
149
155
|
<TouchableOpacity
|
|
150
156
|
onPress={onPressRightAction}
|
|
@@ -174,7 +180,6 @@ const Title: FC<TitleProps> = ({
|
|
|
174
180
|
if (textOnly) {
|
|
175
181
|
return (
|
|
176
182
|
<View style={isSection && styles.margin}>
|
|
177
|
-
zZ
|
|
178
183
|
<RNText
|
|
179
184
|
numberOfLines={numberOfLines}
|
|
180
185
|
style={[styleSheet[typography], styles.title]}>
|