@momo-kits/foundation 0.92.26-beta.25 → 0.92.26-beta.26

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
@@ -1,5 +1,6 @@
1
1
  import React, {
2
2
  forwardRef,
3
+ ReactNode,
3
4
  useContext,
4
5
  useImperativeHandle,
5
6
  useRef,
@@ -121,22 +122,26 @@ const Input = forwardRef(
121
122
  );
122
123
  }
123
124
  if (icon || trailing) {
124
- const trailingValue = icon || trailing;
125
- if (trailingValue?.includes('_') || trailingValue?.includes('http')) {
125
+ const renderIconTouchable = (icon: ReactNode) => {
126
126
  return (
127
127
  <TouchableOpacity
128
- onPress={onPressIcon}
129
- disabled={!onPressIcon}
128
+ onPress={onPressTrailing ?? onPressIcon}
130
129
  style={styles.icon}>
131
- <Icon
132
- color={color}
133
- source={(icon || trailing) as string}
134
- size={24}
135
- />
130
+ {icon}
136
131
  </TouchableOpacity>
137
132
  );
133
+ };
134
+ const trailingValue = icon || trailing;
135
+ if (trailingValue?.includes('_') || trailingValue?.includes('http')) {
136
+ return renderIconTouchable(
137
+ <Icon
138
+ color={color}
139
+ source={(icon || trailing) as string}
140
+ size={24}
141
+ />
142
+ );
138
143
  }
139
- return (
144
+ return renderIconTouchable(
140
145
  <Text
141
146
  typography="action_xs_bold"
142
147
  color={color ?? theme.colors.primary}
@@ -155,7 +160,7 @@ const Input = forwardRef(
155
160
  const secure = secureTextInput && secureTextEntry;
156
161
  let textColor = theme.colors.text.default;
157
162
  let placeholderColor = theme.colors.text.hint;
158
- let iconTintColor = iconColor;
163
+ let iconTintColor = trailingColor ?? iconColor;
159
164
 
160
165
  if (disabled) {
161
166
  textColor = disabledColor;
@@ -1,4 +1,4 @@
1
- import React, {useContext} from 'react';
1
+ import React, {ReactNode, useContext} from 'react';
2
2
  import {TextInput, TouchableOpacity, View} from 'react-native';
3
3
  import {ApplicationContext, ComponentContext} from '../Application';
4
4
  import {Styles} from '../Consts';
@@ -20,7 +20,7 @@ const InputDropDown = ({
20
20
  icon = 'arrow_chevron_down_small',
21
21
  iconColor,
22
22
  onPressIcon,
23
- trailing,
23
+ trailing = 'arrow_chevron_down_small',
24
24
  trailingColor,
25
25
  onPressTrailing,
26
26
  disabled = false,
@@ -46,24 +46,23 @@ const InputDropDown = ({
46
46
  if (loading) {
47
47
  return <Loader type={'spinner'} color={color} style={styles.icon} />;
48
48
  }
49
-
50
49
  if (icon || trailing) {
51
- const trailingValue = icon || trailing;
52
- if (trailingValue?.includes('_') || trailingValue?.includes('http')) {
50
+ const renderIconTouchable = (icon: ReactNode) => {
53
51
  return (
54
52
  <TouchableOpacity
55
- onPress={onPressIcon}
56
- disabled={!onPressIcon}
53
+ onPress={onPressTrailing ?? onPressIcon}
57
54
  style={styles.icon}>
58
- <Icon
59
- color={color}
60
- source={(icon || trailing) as string}
61
- size={24}
62
- />
55
+ {icon}
63
56
  </TouchableOpacity>
64
57
  );
58
+ };
59
+ const trailingValue = icon || trailing;
60
+ if (trailingValue?.includes('_') || trailingValue?.includes('http')) {
61
+ return renderIconTouchable(
62
+ <Icon color={color} source={(icon || trailing) as string} size={24} />
63
+ );
65
64
  }
66
- return (
65
+ return renderIconTouchable(
67
66
  <Text
68
67
  typography="action_xs_bold"
69
68
  color={color ?? theme.colors.primary}
@@ -81,7 +80,7 @@ const InputDropDown = ({
81
80
  const disabledColor = theme.colors.text.disable;
82
81
  let textColor = theme.colors.text.default;
83
82
  let placeholderColor = theme.colors.text.hint;
84
- let iconTintColor = iconColor;
83
+ let iconTintColor = trailingColor ?? iconColor;
85
84
 
86
85
  if (disabled) {
87
86
  textColor = disabledColor;
@@ -1,5 +1,6 @@
1
1
  import React, {
2
2
  forwardRef,
3
+ ReactNode,
3
4
  useContext,
4
5
  useEffect,
5
6
  useImperativeHandle,
@@ -116,22 +117,26 @@ const InputMoney = forwardRef(
116
117
  }
117
118
 
118
119
  if (icon || trailing) {
119
- const trailingValue = icon || trailing;
120
- if (trailingValue?.includes('_') || trailingValue?.includes('http')) {
120
+ const renderIconTouchable = (icon: ReactNode) => {
121
121
  return (
122
122
  <TouchableOpacity
123
- onPress={onPressIcon}
124
- disabled={!onPressIcon}
123
+ onPress={onPressTrailing ?? onPressIcon}
125
124
  style={styles.icon}>
126
- <Icon
127
- color={color}
128
- source={(icon || trailing) as string}
129
- size={24}
130
- />
125
+ {icon}
131
126
  </TouchableOpacity>
132
127
  );
128
+ };
129
+ const trailingValue = icon || trailing;
130
+ if (trailingValue?.includes('_') || trailingValue?.includes('http')) {
131
+ return renderIconTouchable(
132
+ <Icon
133
+ color={color}
134
+ source={(icon || trailing) as string}
135
+ size={24}
136
+ />
137
+ );
133
138
  }
134
- return (
139
+ return renderIconTouchable(
135
140
  <Text
136
141
  typography="action_xs_bold"
137
142
  color={color ?? theme.colors.primary}
@@ -146,7 +151,7 @@ const InputMoney = forwardRef(
146
151
  const disabledColor = theme.colors.text.disable;
147
152
  let textColor = theme.colors.text.default;
148
153
  let placeholderColor = theme.colors.text.hint;
149
- let iconTintColor = iconColor;
154
+ let iconTintColor = trailingColor ?? iconColor;
150
155
 
151
156
  if (disabled) {
152
157
  textColor = disabledColor;
@@ -125,8 +125,7 @@ const InputSearch = forwardRef(
125
125
  {!!(icon || trailing) && (
126
126
  <TouchableOpacity
127
127
  style={Styles.row}
128
- disabled={!!onPressTrailing}
129
- onPress={onPressTrailing}>
128
+ onPress={onPressTrailing ?? onPressIcon}>
130
129
  <View
131
130
  style={[
132
131
  styles.divider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.26-beta.25",
3
+ "version": "0.92.26-beta.26",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
package/verify.js CHANGED
@@ -19,6 +19,12 @@ const miniInfo = JSON.parse(fs.readFileSync(miniJson, 'utf8'));
19
19
  const iOSAppTarget = appInfo?.client?.ios.deploymentTarget;
20
20
  const androidAppTarget = appInfo?.client?.android.deploymentTarget;
21
21
 
22
+ if (
23
+ miniInfo?.dependencies?.['@momo-platform/momo-core']?.includes('optimize')
24
+ ) {
25
+ return;
26
+ }
27
+
22
28
  if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
23
29
  throw new Error(
24
30
  `\x1b[41m Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`