@momo-kits/foundation 0.114.0-beta.13 → 0.114.0-beta.15
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.
|
@@ -12,8 +12,6 @@ import {PopupNotify} from '../../Popup';
|
|
|
12
12
|
import {Tool, ToolGroup} from '../types';
|
|
13
13
|
import {Icon} from '../../Icon';
|
|
14
14
|
import {scaleSize, Text} from '../../Text';
|
|
15
|
-
import {BottomSheetHelpCenter} from './BottomSheetHelpCenter';
|
|
16
|
-
import {Image} from '../../Image';
|
|
17
15
|
|
|
18
16
|
const DID_SYNC_NEW_HOME = 'did_sync_new_home';
|
|
19
17
|
/**
|
|
@@ -56,7 +54,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
56
54
|
useMore = false,
|
|
57
55
|
tools = [],
|
|
58
56
|
}) => {
|
|
59
|
-
const {navigator
|
|
57
|
+
const {navigator} = useContext(ApplicationContext);
|
|
60
58
|
const context = useContext<any>(MiniAppContext);
|
|
61
59
|
|
|
62
60
|
const [isFavorite, setIsFavorite] = useState<boolean>(false);
|
|
@@ -134,7 +132,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
134
132
|
),
|
|
135
133
|
});
|
|
136
134
|
} else {
|
|
137
|
-
navigator?.maxApi?.
|
|
135
|
+
navigator?.maxApi?.dismiss?.(navigator?.dismissData);
|
|
138
136
|
}
|
|
139
137
|
};
|
|
140
138
|
|
|
@@ -174,8 +172,6 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
174
172
|
* on press help center
|
|
175
173
|
*/
|
|
176
174
|
const onPressHelpCenter = () => {
|
|
177
|
-
const appName = translate?.(context?.name);
|
|
178
|
-
const appDescription = translate?.(context?.description);
|
|
179
175
|
const currentRoute = navigator?.ref?.current?.getCurrentRoute?.();
|
|
180
176
|
context?.autoTracking?.({
|
|
181
177
|
...context,
|
|
@@ -184,30 +180,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
184
180
|
screenName: currentRoute?.params?.screen?.name ?? currentRoute?.name,
|
|
185
181
|
});
|
|
186
182
|
|
|
187
|
-
navigator?.
|
|
188
|
-
options: {
|
|
189
|
-
header: (
|
|
190
|
-
<View style={[Styles.row, {paddingLeft: Spacing.M}]}>
|
|
191
|
-
<Image
|
|
192
|
-
source={{uri: context?.icon}}
|
|
193
|
-
style={{width: 40, height: 40, marginRight: Spacing.S}}
|
|
194
|
-
/>
|
|
195
|
-
<View>
|
|
196
|
-
<Text typography={'label_default_medium'}>{appName}</Text>
|
|
197
|
-
{appDescription !== '{}' && (
|
|
198
|
-
<Text
|
|
199
|
-
typography={'description_default_regular'}
|
|
200
|
-
color={Colors.black_12}>
|
|
201
|
-
{appDescription}
|
|
202
|
-
</Text>
|
|
203
|
-
)}
|
|
204
|
-
</View>
|
|
205
|
-
</View>
|
|
206
|
-
),
|
|
207
|
-
},
|
|
208
|
-
surface: true,
|
|
209
|
-
screen: BottomSheetHelpCenter,
|
|
210
|
-
});
|
|
183
|
+
navigator?.maxApi?.dispatchFunction?.('showHelpCenter', context);
|
|
211
184
|
};
|
|
212
185
|
|
|
213
186
|
/**
|
|
@@ -80,19 +80,33 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
80
80
|
* @param preScreenName
|
|
81
81
|
* @param screenName
|
|
82
82
|
* @param action
|
|
83
|
+
* @param type
|
|
83
84
|
*/
|
|
84
85
|
const onScreenNavigated = (
|
|
85
86
|
preScreenName: string,
|
|
86
87
|
screenName: string,
|
|
87
|
-
action: string
|
|
88
|
+
action: string,
|
|
89
|
+
type: 'Screen' | 'Modal' | 'BottomSheet'
|
|
88
90
|
) => {
|
|
89
|
-
console.log(preScreenName, screenName, action);
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
console.log(preScreenName, screenName, action, type);
|
|
92
|
+
|
|
93
|
+
let data: any = {
|
|
92
94
|
preScreenName,
|
|
93
95
|
screenName,
|
|
94
|
-
componentName:
|
|
96
|
+
componentName: type,
|
|
95
97
|
state: 'navigated',
|
|
98
|
+
};
|
|
99
|
+
if (type !== 'Screen') {
|
|
100
|
+
data = {
|
|
101
|
+
preScreenName,
|
|
102
|
+
screenName,
|
|
103
|
+
componentName: type,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
context?.autoTracking?.({
|
|
108
|
+
...context,
|
|
109
|
+
...data,
|
|
96
110
|
action,
|
|
97
111
|
});
|
|
98
112
|
|
|
@@ -149,15 +163,19 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
149
163
|
isReady.current = true;
|
|
150
164
|
routes.current = navigationRef.current?.getRootState?.()?.routes;
|
|
151
165
|
maxApi?.getDataObserver('CURRENT_SCREEN', (data: any) => {
|
|
152
|
-
onScreenNavigated(
|
|
166
|
+
onScreenNavigated(
|
|
167
|
+
data?.screenName,
|
|
168
|
+
screen?.name,
|
|
169
|
+
'push',
|
|
170
|
+
'Screen'
|
|
171
|
+
);
|
|
153
172
|
maxApi?.setObserver('CURRENT_SCREEN', {
|
|
154
173
|
screenName: screen?.name,
|
|
155
174
|
});
|
|
156
175
|
});
|
|
157
176
|
}}
|
|
158
177
|
onStateChange={state => {
|
|
159
|
-
const lastedRoute: any =
|
|
160
|
-
state?.routes?.[state?.routes?.length - 1];
|
|
178
|
+
const lastedRoute: any = state?.routes?.[state?.index];
|
|
161
179
|
const oldRoute: any =
|
|
162
180
|
routes.current?.[routes.current?.length - 1];
|
|
163
181
|
const lasted = lastedRoute?.params?.screen;
|
|
@@ -165,13 +183,35 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
165
183
|
const preScreenName = previous?.name ?? previous?.type?.name;
|
|
166
184
|
const screenName = lasted?.name ?? lasted?.type?.name;
|
|
167
185
|
|
|
168
|
-
let action
|
|
169
|
-
|
|
170
|
-
|
|
186
|
+
let action: string;
|
|
187
|
+
let type: 'Screen' | 'Modal' | 'BottomSheet';
|
|
188
|
+
|
|
189
|
+
if (lastedRoute?.name === 'Modal') {
|
|
190
|
+
type = 'Modal';
|
|
191
|
+
action = 'open';
|
|
192
|
+
if (lastedRoute?.params?.isBottomSheet) {
|
|
193
|
+
type = 'BottomSheet';
|
|
194
|
+
}
|
|
195
|
+
} else if (oldRoute?.name === 'Modal') {
|
|
196
|
+
action = 'close';
|
|
197
|
+
type = 'Modal';
|
|
198
|
+
if (oldRoute?.params?.isBottomSheet) {
|
|
199
|
+
type = 'BottomSheet';
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
202
|
+
type = 'Screen';
|
|
203
|
+
if (routes.current?.length > (state?.routes?.length ?? 0)) {
|
|
204
|
+
action = 'back';
|
|
205
|
+
} else {
|
|
206
|
+
action = 'push';
|
|
207
|
+
}
|
|
171
208
|
}
|
|
172
|
-
|
|
173
|
-
|
|
209
|
+
|
|
210
|
+
onScreenNavigated(preScreenName, screenName, action, type);
|
|
211
|
+
|
|
174
212
|
routes.current = state?.routes;
|
|
213
|
+
maxApi?.of?.({screenName});
|
|
214
|
+
maxApi?.setObserver('CURRENT_SCREEN', {screenName});
|
|
175
215
|
}}
|
|
176
216
|
independent={true}>
|
|
177
217
|
<Stack.Navigator initialRouteName="Stack" headerMode="screen">
|
|
@@ -6,6 +6,7 @@ import Navigation from './Navigation';
|
|
|
6
6
|
import {ApplicationContext, MiniAppContext, ScreenContext} from './index';
|
|
7
7
|
import {GridSystem} from '../Layout';
|
|
8
8
|
import {version} from '../package.json';
|
|
9
|
+
|
|
9
10
|
const runAfterInteractions = InteractionManager.runAfterInteractions;
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -69,10 +70,6 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
const subscription = props.navigation?.addListener?.('focus', () => {
|
|
73
|
-
navigator?.maxApi?.of?.({screenName});
|
|
74
|
-
navigator?.maxApi?.setObserver('CURRENT_SCREEN', {screenName});
|
|
75
|
-
});
|
|
76
73
|
navigator?.maxApi?.startTraceScreenLoad?.(
|
|
77
74
|
screenName,
|
|
78
75
|
context,
|
|
@@ -97,7 +94,6 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
97
94
|
onScreenLoad();
|
|
98
95
|
onScreenInteraction();
|
|
99
96
|
clearTimeout(tracking.current.timeoutTracking);
|
|
100
|
-
subscription?.();
|
|
101
97
|
};
|
|
102
98
|
}, []);
|
|
103
99
|
|
|
@@ -139,12 +135,11 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
139
135
|
});
|
|
140
136
|
if (
|
|
141
137
|
context.debugLastElement &&
|
|
142
|
-
lastElement.current?.children?.length > 0
|
|
138
|
+
lastElement.current?.children?.current?.length > 0
|
|
143
139
|
) {
|
|
144
|
-
console.log(JSON.stringify(lastElement.current));
|
|
145
140
|
Alert.alert(
|
|
146
141
|
`${screenName}- load ${timeLoad}ms`,
|
|
147
|
-
JSON.stringify(lastElement.current?.children)
|
|
142
|
+
JSON.stringify(lastElement.current?.children?.current?.length)
|
|
148
143
|
);
|
|
149
144
|
}
|
|
150
145
|
}
|
package/Input/Input.tsx
CHANGED
|
@@ -241,7 +241,7 @@ const Input = forwardRef(
|
|
|
241
241
|
params,
|
|
242
242
|
state: inputState,
|
|
243
243
|
}}>
|
|
244
|
-
<View style={[style, styles.wrapper]}
|
|
244
|
+
<View style={[style, styles.wrapper]}>
|
|
245
245
|
{renderInputView()}
|
|
246
246
|
<ErrorView
|
|
247
247
|
errorMessage={errorMessage}
|
package/Tag/index.tsx
CHANGED
|
@@ -37,7 +37,7 @@ const Tag: FC<TagProps> = ({
|
|
|
37
37
|
let labelColor = textColor[color];
|
|
38
38
|
let tagColor = backgroundColor[color];
|
|
39
39
|
let sizeStyle = styles.mediumContainer;
|
|
40
|
-
const componentName = '
|
|
40
|
+
const componentName = 'Tag';
|
|
41
41
|
|
|
42
42
|
const {componentId} = useComponentId(
|
|
43
43
|
`${componentName}/${label}`,
|