@momo-kits/foundation 0.153.1-beta.2 → 0.153.1-beta.3

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/Input.tsx CHANGED
@@ -24,7 +24,6 @@ import {
24
24
  } from './common';
25
25
  import { InputProps } from './index';
26
26
  import styles from './styles';
27
- import { checkTyping } from './utils';
28
27
  import SystemTextInput from './SystemTextInput';
29
28
  import { ApplicationContext, ComponentContext } from '../Context';
30
29
 
@@ -63,13 +62,14 @@ const Input = forwardRef(
63
62
  onPressFloatingIcon,
64
63
  onPressLeadingIcon,
65
64
  showClearIcon = true,
65
+ defaultValue,
66
66
  ...props
67
67
  }: InputProps,
68
68
  ref,
69
69
  ) => {
70
70
  const { theme } = useContext(ApplicationContext);
71
71
  const [focused, setFocused] = useState(false);
72
- const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
72
+ const haveValue = !!value || !!defaultValue;
73
73
  // TODO: CHECK THIS
74
74
  // const [secureTextInput, setSecureTextInput] = useState(secureTextEntry);
75
75
  const inputRef = useRef<TextInput | null>(null);
@@ -87,7 +87,6 @@ const Input = forwardRef(
87
87
  };
88
88
 
89
89
  const _onChangeText = (text: string) => {
90
- checkTyping(text, haveValue, setHaveValue);
91
90
  onChangeText?.(text);
92
91
  };
93
92
 
@@ -27,7 +27,6 @@ import {
27
27
  import { InputPhoneNumberProps } from './index';
28
28
  import styles from './styles';
29
29
  import SystemTextInput from './SystemTextInput';
30
- import { checkTyping } from './utils';
31
30
  import { Image } from '../Image';
32
31
  import { Typography } from '../Text/types';
33
32
 
@@ -57,13 +56,14 @@ const InputPhoneNumber = forwardRef(
57
56
  hintText,
58
57
  editable = true,
59
58
  showClearIcon = true,
59
+ defaultValue,
60
60
  ...props
61
61
  }: InputPhoneNumberProps,
62
62
  ref,
63
63
  ) => {
64
64
  const { theme } = useContext(ApplicationContext);
65
65
  const [focused, setFocused] = useState(false);
66
- const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
66
+ const haveValue = !!value || !!defaultValue;
67
67
  const inputRef = useRef<TextInput | null>(null);
68
68
  const componentName = 'InputPhoneNumber';
69
69
 
@@ -78,7 +78,6 @@ const InputPhoneNumber = forwardRef(
78
78
  };
79
79
 
80
80
  const _onChangeText = (text: string) => {
81
- checkTyping(text, haveValue, setHaveValue);
82
81
  onChangeText?.(text);
83
82
  };
84
83
 
@@ -22,7 +22,6 @@ import { Icon } from '../Icon';
22
22
  import { Text } from '../Text';
23
23
  import { InputRef, InputSearchProps } from './index';
24
24
  import styles from './styles';
25
- import { checkTyping } from './utils';
26
25
  import { Styles } from '../Consts';
27
26
  import SystemTextInput from './SystemTextInput';
28
27
 
@@ -141,7 +140,7 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
141
140
  const { theme } = useContext(ApplicationContext);
142
141
 
143
142
  const [focused, setFocused] = useState(false);
144
- const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
143
+ const haveValue = !!value || !!defaultValue;
145
144
  const inputRef = useRef<TextInput | null>(null);
146
145
 
147
146
  const componentName = 'InputSearch';
@@ -168,7 +167,6 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
168
167
  };
169
168
 
170
169
  const _onChangeText = (text: string) => {
171
- checkTyping(text, haveValue, setHaveValue);
172
170
  onChangeText?.(text);
173
171
  };
174
172
 
package/Input/utils.ts CHANGED
@@ -59,12 +59,6 @@ const formatMoneyToNumber = (money: string, currencyUnit: string) => {
59
59
 
60
60
  return Number(money);
61
61
  };
62
- const checkTyping = (text: string, value: boolean, setValue: any) => {
63
- let typing = text?.length > 0;
64
- if (typing !== value) {
65
- setValue(typing);
66
- }
67
- };
68
62
 
69
63
  // --- PHONE VALIDATION ---
70
64
  function formatPhoneNumber(phone: string): string {
@@ -100,9 +94,4 @@ function checkValidPhoneNumber(phone: string): {
100
94
  return { phoneFormatted: phoneFormatted, error };
101
95
  }
102
96
 
103
- export {
104
- formatMoneyToNumber,
105
- formatNumberToMoney,
106
- checkTyping,
107
- checkValidPhoneNumber,
108
- };
97
+ export { formatMoneyToNumber, formatNumberToMoney, checkValidPhoneNumber };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.153.1-beta.2",
3
+ "version": "0.153.1-beta.3",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},