@momo-kits/foundation 0.169.16-beta.2 → 0.169.16-beta.21

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.
@@ -45,7 +45,7 @@ const ErrorView: FC<ErrorViewProps> = ({
45
45
  color={messageColor}
46
46
  typography={'description_default_regular'}
47
47
  >
48
- {errorMessage ?? hintTextDefault}
48
+ {errorMessage || hintTextDefault}
49
49
  </Text>
50
50
  </View>
51
51
  );
@@ -53,8 +53,8 @@ type InputMoneyViewProps = Pick<
53
53
  };
54
54
 
55
55
  /**
56
- * Presentational body of InputMoney: bordered field, currency suffix (kept
57
- * after a placeholder that ends with it) and the clear/trailing icons.
56
+ * Presentational body of InputMoney: bordered field, currency suffix (shown
57
+ * once there is a value) and the clear/trailing icons.
58
58
  */
59
59
  export const InputMoneyView = ({
60
60
  size,
@@ -101,13 +101,8 @@ export const InputMoneyView = ({
101
101
  fontSize: scaledFontSize,
102
102
  fontFamily: inputFontFamily,
103
103
  };
104
- const hasCurrencyInPlaceholder = placeholder.endsWith(currency);
105
- const shouldShowCurrency = !!displayValue || hasCurrencyInPlaceholder;
104
+ const hasValue = displayValue.length > 0;
106
105
  const shouldShowClearIcon = !!(showClearIcon && focused && displayValue);
107
- let inputPlaceholder = placeholder;
108
- if (hasCurrencyInPlaceholder) {
109
- inputPlaceholder = placeholder.slice(0, -currency.length);
110
- }
111
106
  return (
112
107
  <View
113
108
  style={[
@@ -148,18 +143,15 @@ export const InputMoneyView = ({
148
143
  onChangeText={onChangeText}
149
144
  onFocus={onFocus}
150
145
  onBlur={onBlur}
151
- placeholder={inputPlaceholder}
146
+ placeholder={placeholder}
152
147
  selectionColor={theme.colors.primary}
153
148
  placeholderTextColor={placeholderColor}
154
149
  keyboardType={'numeric'}
155
150
  maxLength={undefined}
156
151
  />
157
- {shouldShowCurrency && (
152
+ {hasValue && (
158
153
  <Text
159
- style={[
160
- textStyle,
161
- { color: displayValue ? textColor : placeholderColor },
162
- ]}
154
+ style={[textStyle, { color: textColor }]}
163
155
  allowFontScaling={false}
164
156
  >
165
157
  {currency}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.169.16-beta.2",
3
+ "version": "0.169.16-beta.21",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},