@momo-kits/foundation 0.92.29-beta.1 → 0.92.29-beta.2
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/Application/Components.tsx +2 -10
- package/Application/Navigator.ts +5 -7
- package/Application/StackScreen.tsx +19 -4
- package/Input/Input.tsx +2 -0
- package/Input/InputDropDown.tsx +2 -0
- package/Input/InputMoney.tsx +2 -0
- package/Input/common.tsx +16 -8
- package/Input/index.tsx +3 -1
- package/package.json +44 -44
- package/publish.sh +1 -1
|
@@ -333,15 +333,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
333
333
|
|
|
334
334
|
const onMore = () => {
|
|
335
335
|
onAction?.('onMore');
|
|
336
|
-
navigator?.maxApi?.dispatchFunction?.(
|
|
337
|
-
'showTools',
|
|
338
|
-
{runtimeTools},
|
|
339
|
-
(res: {item: {action?: string; key: string}}) => {
|
|
340
|
-
const {item} = res;
|
|
341
|
-
navigator?.toolkitCallback?.(item.key);
|
|
342
|
-
getToolkitConfig();
|
|
343
|
-
}
|
|
344
|
-
);
|
|
336
|
+
navigator?.maxApi?.dispatchFunction?.('showToolkit', [undefined], () => {});
|
|
345
337
|
};
|
|
346
338
|
|
|
347
339
|
const onClose = () => {
|
|
@@ -385,7 +377,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
385
377
|
onPress={() => {
|
|
386
378
|
navigator?.maxApi?.dispatchFunction?.(
|
|
387
379
|
'onToolAction',
|
|
388
|
-
|
|
380
|
+
{item: pinTool},
|
|
389
381
|
() => {
|
|
390
382
|
getToolkitConfig();
|
|
391
383
|
}
|
package/Application/Navigator.ts
CHANGED
|
@@ -12,7 +12,7 @@ class Navigator {
|
|
|
12
12
|
toolkitConfig?: HeaderToolkitProps;
|
|
13
13
|
maxApi?: any;
|
|
14
14
|
dismissData?: any;
|
|
15
|
-
toolkitCallback?: (
|
|
15
|
+
toolkitCallback?: (key: string) => void;
|
|
16
16
|
|
|
17
17
|
constructor(navigation: any, isReady: any) {
|
|
18
18
|
this.ref = navigation;
|
|
@@ -78,7 +78,7 @@ class Navigator {
|
|
|
78
78
|
StackActions.push('Modal', {
|
|
79
79
|
...params,
|
|
80
80
|
isBottomSheet: true,
|
|
81
|
-
})
|
|
81
|
+
})
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
};
|
|
@@ -103,7 +103,7 @@ class Navigator {
|
|
|
103
103
|
CommonActions.navigate({
|
|
104
104
|
name,
|
|
105
105
|
params,
|
|
106
|
-
})
|
|
106
|
+
})
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
109
|
};
|
|
@@ -124,7 +124,7 @@ class Navigator {
|
|
|
124
124
|
params,
|
|
125
125
|
},
|
|
126
126
|
],
|
|
127
|
-
})
|
|
127
|
+
})
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
};
|
|
@@ -141,9 +141,7 @@ class Navigator {
|
|
|
141
141
|
* set callback function for toolkit
|
|
142
142
|
* @param callback
|
|
143
143
|
*/
|
|
144
|
-
setToolkitCallback = (
|
|
145
|
-
callback: (item: {key: string; action: string}) => void,
|
|
146
|
-
) => {
|
|
144
|
+
setToolkitCallback = (callback: (key: string) => void) => {
|
|
147
145
|
this.toolkitCallback = callback;
|
|
148
146
|
};
|
|
149
147
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {useContext, useEffect, useLayoutEffect, useRef} from 'react';
|
|
2
2
|
import {useHeaderHeight} from '@react-navigation/stack';
|
|
3
|
-
import {InteractionManager, Linking, View} from 'react-native';
|
|
3
|
+
import {Alert, InteractionManager, Linking, View} from 'react-native';
|
|
4
4
|
import {ScreenParams} from './types';
|
|
5
5
|
import Navigation from './Navigation';
|
|
6
6
|
import {ApplicationContext, MiniAppContext, ScreenContext} from './index';
|
|
@@ -146,6 +146,8 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
146
146
|
}, 5000);
|
|
147
147
|
|
|
148
148
|
return () => {
|
|
149
|
+
clearTimeout(tracked.current.timeoutLoad);
|
|
150
|
+
clearTimeout(tracked.current.timeoutInteraction);
|
|
149
151
|
onScreenLoad();
|
|
150
152
|
onScreenInteraction();
|
|
151
153
|
};
|
|
@@ -155,8 +157,10 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
155
157
|
* tracking for screen load
|
|
156
158
|
*/
|
|
157
159
|
const onScreenLoad = () => {
|
|
158
|
-
clearTimeout(tracked.current.timeoutLoad);
|
|
159
160
|
if (!tracked.current?.releaseLoad) {
|
|
161
|
+
if (timeLoad.current === 0) {
|
|
162
|
+
timeLoad.current = endTime.current - startTime.current;
|
|
163
|
+
}
|
|
160
164
|
context.autoTracking?.({
|
|
161
165
|
appId: context.appId,
|
|
162
166
|
code: context.code,
|
|
@@ -170,6 +174,9 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
170
174
|
appId: `auto - ${context.appId}`,
|
|
171
175
|
message: `${screenName} screen_load_time ${timeLoad.current}`,
|
|
172
176
|
});
|
|
177
|
+
if (timeLoad.current === 0 && context.enableAutoId) {
|
|
178
|
+
Alert.alert(screenName, "Can't get screen load time");
|
|
179
|
+
}
|
|
173
180
|
tracked.current.releaseLoad = true;
|
|
174
181
|
}
|
|
175
182
|
};
|
|
@@ -178,8 +185,10 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
178
185
|
* tracking for screen load
|
|
179
186
|
*/
|
|
180
187
|
const onScreenInteraction = () => {
|
|
181
|
-
clearTimeout(tracked.current.timeoutInteraction);
|
|
182
188
|
if (!tracked.current?.releaseInteraction) {
|
|
189
|
+
if (timeLoad.current === 0) {
|
|
190
|
+
timeLoad.current = endTime.current - startTime.current;
|
|
191
|
+
}
|
|
183
192
|
context.autoTracking?.({
|
|
184
193
|
appId: context.appId,
|
|
185
194
|
code: context.code,
|
|
@@ -194,6 +203,12 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
194
203
|
appId: `auto - ${context.appId}`,
|
|
195
204
|
message: `${screenName} screen_interaction_time ${timeInteraction.current}`,
|
|
196
205
|
});
|
|
206
|
+
if (
|
|
207
|
+
timeInteraction.current - timeLoad.current <= 0 &&
|
|
208
|
+
context.enableAutoId
|
|
209
|
+
) {
|
|
210
|
+
Alert.alert(screenName, "Can't get screen interaction time");
|
|
211
|
+
}
|
|
197
212
|
tracked.current.releaseInteraction = true;
|
|
198
213
|
}
|
|
199
214
|
};
|
|
@@ -203,12 +218,12 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
203
218
|
value={{
|
|
204
219
|
screenName,
|
|
205
220
|
onElementLoad: () => {
|
|
221
|
+
clearTimeout(timeoutLoad.current);
|
|
206
222
|
endTime.current = Date.now();
|
|
207
223
|
interaction.current?.cancel?.();
|
|
208
224
|
interaction.current = InteractionManager.runAfterInteractions(() => {
|
|
209
225
|
timeInteraction.current = Date.now() - startTime.current;
|
|
210
226
|
});
|
|
211
|
-
clearTimeout(timeoutLoad.current);
|
|
212
227
|
timeoutLoad.current = setTimeout(() => {
|
|
213
228
|
if (timeLoad.current === 0) {
|
|
214
229
|
timeLoad.current = endTime.current - startTime.current;
|
package/Input/Input.tsx
CHANGED
|
@@ -59,6 +59,7 @@ const Input = forwardRef(
|
|
|
59
59
|
hintText,
|
|
60
60
|
accessibilityLabel,
|
|
61
61
|
editable = true,
|
|
62
|
+
onPressFloatingIcon,
|
|
62
63
|
...props
|
|
63
64
|
}: InputProps,
|
|
64
65
|
ref
|
|
@@ -189,6 +190,7 @@ const Input = forwardRef(
|
|
|
189
190
|
disabled={disabled}
|
|
190
191
|
required={required}
|
|
191
192
|
floatingIcon={floatingIcon}
|
|
193
|
+
onPress={onPressFloatingIcon}
|
|
192
194
|
/>
|
|
193
195
|
<View style={styles.inputView}>
|
|
194
196
|
{!!leadingIcon && (
|
package/Input/InputDropDown.tsx
CHANGED
|
@@ -12,6 +12,7 @@ const InputDropDown = ({
|
|
|
12
12
|
value,
|
|
13
13
|
floatingValue,
|
|
14
14
|
floatingIcon,
|
|
15
|
+
onPressFloatingIcon,
|
|
15
16
|
size = 'small',
|
|
16
17
|
onPress,
|
|
17
18
|
placeholder,
|
|
@@ -57,6 +58,7 @@ const InputDropDown = ({
|
|
|
57
58
|
disabled={disabled}
|
|
58
59
|
required={required}
|
|
59
60
|
floatingIcon={floatingIcon}
|
|
61
|
+
onPress={onPressFloatingIcon}
|
|
60
62
|
/>
|
|
61
63
|
<View style={styles.inputDropDownView}>
|
|
62
64
|
{!!leadingIcon && (
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -50,6 +50,7 @@ const InputMoney = forwardRef(
|
|
|
50
50
|
accessibilityLabel,
|
|
51
51
|
hintText,
|
|
52
52
|
value: _value,
|
|
53
|
+
onPressFloatingIcon,
|
|
53
54
|
...props
|
|
54
55
|
}: InputMoneyProps,
|
|
55
56
|
ref
|
|
@@ -173,6 +174,7 @@ const InputMoney = forwardRef(
|
|
|
173
174
|
disabled={disabled}
|
|
174
175
|
required={required}
|
|
175
176
|
floatingIcon={floatingIcon}
|
|
177
|
+
onPress={onPressFloatingIcon}
|
|
176
178
|
/>
|
|
177
179
|
<View style={styles.inputView}>
|
|
178
180
|
<TextInput
|
package/Input/common.tsx
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React, {FC, useContext} from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
GestureResponderEvent,
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
View,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
} from 'react-native';
|
|
3
8
|
import {ApplicationContext} from '../Application';
|
|
4
9
|
import {Theme} from '../Application/types';
|
|
5
10
|
import {Styles} from '../Consts';
|
|
@@ -14,6 +19,7 @@ type FloatingViewProps = {
|
|
|
14
19
|
floatingIcon?: string;
|
|
15
20
|
required?: boolean;
|
|
16
21
|
style?: ViewStyle;
|
|
22
|
+
onPress?: (e: GestureResponderEvent) => void;
|
|
17
23
|
};
|
|
18
24
|
|
|
19
25
|
export const DEFAULT_HEIGHT = scaleSize(104);
|
|
@@ -81,7 +87,6 @@ export const ErrorView: FC<{
|
|
|
81
87
|
<Text
|
|
82
88
|
style={Styles.flex}
|
|
83
89
|
color={errorMessage ? errorColor : hintColor}
|
|
84
|
-
numberOfLines={2}
|
|
85
90
|
typography={'description_default_regular'}>
|
|
86
91
|
{errorMessage ?? hintTextDefault}
|
|
87
92
|
</Text>
|
|
@@ -101,6 +106,7 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
101
106
|
floatingIcon,
|
|
102
107
|
required,
|
|
103
108
|
style,
|
|
109
|
+
onPress,
|
|
104
110
|
}) => {
|
|
105
111
|
const {theme} = useContext(ApplicationContext);
|
|
106
112
|
|
|
@@ -133,12 +139,14 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
133
139
|
)}
|
|
134
140
|
</Text>
|
|
135
141
|
{!!floatingIcon && (
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
+
<TouchableOpacity activeOpacity={onPress ? 0.6 : 1} onPress={onPress}>
|
|
143
|
+
<Icon
|
|
144
|
+
color={floatingIconTintColor}
|
|
145
|
+
source={floatingIcon}
|
|
146
|
+
size={16}
|
|
147
|
+
style={styles.floatingIcon}
|
|
148
|
+
/>
|
|
149
|
+
</TouchableOpacity>
|
|
142
150
|
)}
|
|
143
151
|
</View>
|
|
144
152
|
);
|
package/Input/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {TextInputProps, ViewStyle} from 'react-native';
|
|
1
|
+
import {GestureResponderEvent, TextInputProps, ViewStyle} from 'react-native';
|
|
2
2
|
import Input from './Input';
|
|
3
3
|
import InputDropDown from './InputDropDown';
|
|
4
4
|
import InputMoney from './InputMoney';
|
|
@@ -116,6 +116,8 @@ export interface InputProps extends TextInputProps {
|
|
|
116
116
|
* Optional. Represents text below the Input component.
|
|
117
117
|
*/
|
|
118
118
|
hintText?: string;
|
|
119
|
+
|
|
120
|
+
onPressFloatingIcon?: (e: GestureResponderEvent) => void;
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
export interface InputTextAreaProps extends Omit<InputProps, 'size'> {
|
package/package.json
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
2
|
+
"name": "@momo-kits/foundation",
|
|
3
|
+
"version": "0.92.29-beta.2",
|
|
4
|
+
"description": "React Native Component Kits",
|
|
5
|
+
"main": "index.ts",
|
|
6
|
+
"scripts": {},
|
|
7
|
+
"keywords": [
|
|
8
|
+
"@momo-kits/foundation"
|
|
9
|
+
],
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@gorhom/bottom-sheet": "2.4.1",
|
|
12
|
+
"react-native-safe-area-context": "3.1.4",
|
|
13
|
+
"react-native-linear-gradient": "2.8.3",
|
|
14
|
+
"react-native-gesture-handler": "1.10.3",
|
|
15
|
+
"react-native-modalize": "2.1.1",
|
|
16
|
+
"react-native-fast-image": "8.1.5",
|
|
17
|
+
"@react-navigation/bottom-tabs": "https://oauth2:5WXQLHPMxxCyvGt_Py4D@gitlab.mservice.com.vn/momo-platform/react-native-bottom-tabs.git",
|
|
18
|
+
"@react-navigation/core": "5.16.1",
|
|
19
|
+
"@react-navigation/native": "5.9.8",
|
|
20
|
+
"@react-navigation/routers": "5.7.4",
|
|
21
|
+
"lottie-react-native": "git+https://gitlab.mservice.com.vn/momo-platform/momo-lottie-react-native.git",
|
|
22
|
+
"@react-navigation/stack": "https://oauth2:eX-jVhzQdLc343AjD3Sc@gitlab.mservice.com.vn/momo-platform/react-navigation-stack.git"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react-native": "*"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@babel/core": "^7.12.9",
|
|
29
|
+
"@babel/runtime": "^7.12.5",
|
|
30
|
+
"@react-native-community/eslint-config": "^2.0.0",
|
|
31
|
+
"@types/jest": "26.0.23",
|
|
32
|
+
"@types/react-native": "0.64.4",
|
|
33
|
+
"@types/react-test-renderer": "16.9.2",
|
|
34
|
+
"@types/d3-shape": "1.3.7",
|
|
35
|
+
"babel-jest": "^26.6.3",
|
|
36
|
+
"eslint": "^7.14.0",
|
|
37
|
+
"jest": "^26.6.3",
|
|
38
|
+
"metro-react-native-babel-preset": "^0.64.0",
|
|
39
|
+
"react-test-renderer": "17.0.1",
|
|
40
|
+
"typescript": "^4.0.3",
|
|
41
|
+
"@momo-platform/versions": "4.1.11",
|
|
42
|
+
"react-scanner": "^1.1.0"
|
|
43
|
+
},
|
|
44
|
+
"author": "@momo-kits/foundation",
|
|
45
|
+
"license": "ISC"
|
|
46
46
|
}
|
package/publish.sh
CHANGED
|
@@ -15,7 +15,7 @@ elif [ "$1" == "latest" ]; then
|
|
|
15
15
|
npm version prerelease --preid=rc
|
|
16
16
|
npm publish --tag latest --access=public
|
|
17
17
|
else
|
|
18
|
-
npm version $(npm view @momo-kits/foundation@beta version)
|
|
18
|
+
# npm version $(npm view @momo-kits/foundation@beta version)
|
|
19
19
|
npm version prerelease --preid=beta
|
|
20
20
|
npm publish --tag beta --access=public
|
|
21
21
|
fi
|