@momo-kits/foundation 0.169.16-beta.17 → 0.169.16-beta.18

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.
@@ -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,15 +101,8 @@ export const InputMoneyView = ({
101
101
  fontSize: scaledFontSize,
102
102
  fontFamily: inputFontFamily,
103
103
  };
104
- const hasCurrency = currency.length > 0;
105
- const endsWithCurrency = placeholder.endsWith(currency);
106
- const hasCurrencyInPlaceholder = hasCurrency && endsWithCurrency;
107
- const shouldShowCurrency = !!displayValue || hasCurrencyInPlaceholder;
104
+ const hasValue = displayValue.length > 0;
108
105
  const shouldShowClearIcon = !!(showClearIcon && focused && displayValue);
109
- let inputPlaceholder = placeholder;
110
- if (hasCurrencyInPlaceholder) {
111
- inputPlaceholder = placeholder.slice(0, -currency.length);
112
- }
113
106
  return (
114
107
  <View
115
108
  style={[
@@ -150,18 +143,15 @@ export const InputMoneyView = ({
150
143
  onChangeText={onChangeText}
151
144
  onFocus={onFocus}
152
145
  onBlur={onBlur}
153
- placeholder={inputPlaceholder}
146
+ placeholder={placeholder}
154
147
  selectionColor={theme.colors.primary}
155
148
  placeholderTextColor={placeholderColor}
156
149
  keyboardType={'numeric'}
157
150
  maxLength={undefined}
158
151
  />
159
- {shouldShowCurrency && (
152
+ {hasValue && (
160
153
  <Text
161
- style={[
162
- textStyle,
163
- { color: displayValue ? textColor : placeholderColor },
164
- ]}
154
+ style={[textStyle, { color: textColor }]}
165
155
  allowFontScaling={false}
166
156
  >
167
157
  {currency}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.169.16-beta.17",
3
+ "version": "0.169.16-beta.18",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},