@momo-kits/foundation 0.81.8 → 0.81.9-beta.1
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/BottomTab.tsx +9 -2
- package/Application/Components.tsx +10 -0
- package/Application/ModalScreen.tsx +25 -0
- package/Application/NavigationContainer.tsx +1 -1
- package/Application/StackScreen.tsx +13 -1
- package/Application/types.ts +1 -0
- package/Image/index.tsx +9 -8
- package/Input/Input.tsx +3 -1
- package/Input/InputSearch.tsx +1 -1
- package/Input/index.tsx +2 -0
- package/Layout/Card.tsx +1 -2
- package/Layout/GridSystem.tsx +1 -2
- package/Layout/Screen.tsx +0 -1
- package/Layout/Section.tsx +1 -3
- package/Layout/index.ts +0 -1
- package/Layout/types.ts +0 -5
- package/Popup/PopupNotify.tsx +21 -5
- package/Title/index.tsx +16 -4
- package/Title/styles.ts +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,12 @@ import {ApplicationContext} from './index';
|
|
|
8
8
|
|
|
9
9
|
const Tab = createBottomTabNavigator();
|
|
10
10
|
|
|
11
|
-
const BottomTab: React.FC<BottomTabProps> = ({
|
|
11
|
+
const BottomTab: React.FC<BottomTabProps> = ({
|
|
12
|
+
tabs,
|
|
13
|
+
listeners,
|
|
14
|
+
navigation,
|
|
15
|
+
initialRouteName,
|
|
16
|
+
}) => {
|
|
12
17
|
const {theme} = useContext(ApplicationContext);
|
|
13
18
|
|
|
14
19
|
const defaultListener = {
|
|
@@ -21,7 +26,9 @@ const BottomTab: React.FC<BottomTabProps> = ({tabs, listeners, navigation}) => {
|
|
|
21
26
|
};
|
|
22
27
|
|
|
23
28
|
return (
|
|
24
|
-
<Tab.Navigator
|
|
29
|
+
<Tab.Navigator
|
|
30
|
+
initialRouteName={initialRouteName}
|
|
31
|
+
backBehavior={'firstRoute'}>
|
|
25
32
|
{tabs.map(item => {
|
|
26
33
|
return (
|
|
27
34
|
<Tab.Screen
|
|
@@ -165,6 +165,16 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
165
165
|
const currentRoute = navigator?.ref?.current.getCurrentRoute();
|
|
166
166
|
|
|
167
167
|
if (navigator?.trackingInfo) {
|
|
168
|
+
alert(
|
|
169
|
+
JSON.stringify({
|
|
170
|
+
feature_code: navigator.trackingInfo.code,
|
|
171
|
+
app_id: navigator.trackingInfo.appId,
|
|
172
|
+
miniapp_version: navigator.trackingInfo.buildNumber,
|
|
173
|
+
screen_name: currentRoute?.params?.screen?.name ?? currentRoute?.name,
|
|
174
|
+
trigger_id: '111154000000000000',
|
|
175
|
+
icon_name: 'back',
|
|
176
|
+
}),
|
|
177
|
+
);
|
|
168
178
|
navigator?.maxApi?.trackEvent('service_icon_clicked', {
|
|
169
179
|
feature_code: navigator.trackingInfo.code,
|
|
170
180
|
app_id: navigator.trackingInfo.appId,
|
|
@@ -65,6 +65,18 @@ const Modal: React.FC<ModalParams> = props => {
|
|
|
65
65
|
screen_name = navigationRoutes[routesLength - 2]?.params?.screen?.name;
|
|
66
66
|
}
|
|
67
67
|
const error_code = (screen as Function)?.()?.props?.information;
|
|
68
|
+
alert(
|
|
69
|
+
JSON.stringify({
|
|
70
|
+
feature_code: navigator.trackingInfo.code,
|
|
71
|
+
app_id: navigator.trackingInfo.appId,
|
|
72
|
+
miniapp_version: navigator.trackingInfo.buildNumber,
|
|
73
|
+
screen_name,
|
|
74
|
+
trigger_id: '111012100000000000',
|
|
75
|
+
component_type: 'popup',
|
|
76
|
+
component_name: modalName,
|
|
77
|
+
error_code,
|
|
78
|
+
}),
|
|
79
|
+
);
|
|
68
80
|
navigator?.maxApi?.trackEvent('service_component_displayed', {
|
|
69
81
|
feature_code: navigator.trackingInfo.code,
|
|
70
82
|
app_id: navigator.trackingInfo.appId,
|
|
@@ -77,6 +89,19 @@ const Modal: React.FC<ModalParams> = props => {
|
|
|
77
89
|
});
|
|
78
90
|
|
|
79
91
|
return () => {
|
|
92
|
+
alert(
|
|
93
|
+
JSON.stringify({
|
|
94
|
+
feature_code: navigator?.trackingInfo?.code,
|
|
95
|
+
app_id: navigator?.trackingInfo?.appId,
|
|
96
|
+
miniapp_version: navigator?.trackingInfo?.buildNumber,
|
|
97
|
+
screen_name,
|
|
98
|
+
trigger_id: '111154100000000001',
|
|
99
|
+
component_type: 'popup',
|
|
100
|
+
component_name: modalName,
|
|
101
|
+
error_code,
|
|
102
|
+
icon_name: 'close',
|
|
103
|
+
}),
|
|
104
|
+
);
|
|
80
105
|
navigator?.maxApi?.trackEvent('service_icon_clicked', {
|
|
81
106
|
feature_code: navigator?.trackingInfo?.code,
|
|
82
107
|
app_id: navigator?.trackingInfo?.appId,
|
|
@@ -3,11 +3,13 @@ import {ScreenParams} from './types';
|
|
|
3
3
|
import Navigation from './Navigation';
|
|
4
4
|
import {ApplicationContext} from './index';
|
|
5
5
|
import {GridSystem} from '../Layout';
|
|
6
|
+
import {useHeaderHeight} from '@react-navigation/stack';
|
|
6
7
|
|
|
7
8
|
const StackScreen: React.FC<ScreenParams> = props => {
|
|
8
9
|
const {screen: Component, options}: ScreenParams = props.route.params;
|
|
9
10
|
const {theme, showGrid, navigator} = useContext(ApplicationContext);
|
|
10
11
|
const navigation = new Navigation(props.navigation, theme);
|
|
12
|
+
const heightHeader = useHeaderHeight();
|
|
11
13
|
|
|
12
14
|
const params = {
|
|
13
15
|
...props.route.params,
|
|
@@ -37,6 +39,16 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
37
39
|
pre_screen_name =
|
|
38
40
|
navigationRoutes[routesLength - 2]?.params?.screen?.name;
|
|
39
41
|
}
|
|
42
|
+
alert(
|
|
43
|
+
JSON.stringify({
|
|
44
|
+
feature_code: navigator.trackingInfo.code,
|
|
45
|
+
app_id: navigator.trackingInfo.appId,
|
|
46
|
+
miniapp_version: navigator.trackingInfo.buildNumber,
|
|
47
|
+
screen_name: Component.name,
|
|
48
|
+
pre_screen_name,
|
|
49
|
+
trigger_id: '111378000000000000',
|
|
50
|
+
}),
|
|
51
|
+
);
|
|
40
52
|
navigator?.maxApi?.trackEvent('service_frame_displayed', {
|
|
41
53
|
feature_code: navigator.trackingInfo.code,
|
|
42
54
|
app_id: navigator.trackingInfo.appId,
|
|
@@ -50,7 +62,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
50
62
|
|
|
51
63
|
return (
|
|
52
64
|
<>
|
|
53
|
-
<Component {...params} />
|
|
65
|
+
<Component heightHeader={heightHeader} {...params} />
|
|
54
66
|
{showGrid && <GridSystem />}
|
|
55
67
|
</>
|
|
56
68
|
);
|
package/Application/types.ts
CHANGED
package/Image/index.tsx
CHANGED
|
@@ -20,13 +20,12 @@ const Image: React.FC<ImageProps> = ({
|
|
|
20
20
|
style,
|
|
21
21
|
source,
|
|
22
22
|
accessibilityLabel,
|
|
23
|
+
loading,
|
|
23
24
|
...rest
|
|
24
25
|
}) => {
|
|
25
26
|
const {theme} = useContext(ApplicationContext);
|
|
26
27
|
const error = useRef(false);
|
|
27
|
-
const [status, setStatus] = useState<Status>(
|
|
28
|
-
rest.loading ? 'loading' : 'success',
|
|
29
|
-
);
|
|
28
|
+
const [status, setStatus] = useState<Status>('success');
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
31
|
* render content loading | fail | rendered
|
|
@@ -65,16 +64,18 @@ const Image: React.FC<ImageProps> = ({
|
|
|
65
64
|
<FastImage
|
|
66
65
|
{...rest}
|
|
67
66
|
source={source}
|
|
67
|
+
fallback={false}
|
|
68
68
|
style={styles.image}
|
|
69
|
+
onProgress={() => {
|
|
70
|
+
if (status != 'loading' && loading) setStatus('loading');
|
|
71
|
+
}}
|
|
69
72
|
onLoadStart={() => {
|
|
70
73
|
error.current = false;
|
|
71
74
|
}}
|
|
72
75
|
onLoadEnd={() => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
setStatus('success');
|
|
77
|
-
}
|
|
76
|
+
let current: Status = 'success';
|
|
77
|
+
if (error.current) current = 'error';
|
|
78
|
+
if (status != current) setStatus(current);
|
|
78
79
|
}}
|
|
79
80
|
onError={() => {
|
|
80
81
|
error.current = true;
|
package/Input/Input.tsx
CHANGED
|
@@ -35,6 +35,7 @@ const Input = forwardRef(
|
|
|
35
35
|
loading,
|
|
36
36
|
leadingIcon,
|
|
37
37
|
leadingIconColor,
|
|
38
|
+
fontWeight = 'normal',
|
|
38
39
|
style,
|
|
39
40
|
...props
|
|
40
41
|
}: InputProps,
|
|
@@ -80,6 +81,7 @@ const Input = forwardRef(
|
|
|
80
81
|
let textColor = theme.colors.text.default;
|
|
81
82
|
let placeholderColor = theme.colors.text.hint;
|
|
82
83
|
let iconTintColor = iconColor;
|
|
84
|
+
const inputTextWeight = fontWeight === 'bold' ? 'Bold' : 'Regular';
|
|
83
85
|
|
|
84
86
|
if (disabled) {
|
|
85
87
|
textColor = disabledColor;
|
|
@@ -122,7 +124,7 @@ const Input = forwardRef(
|
|
|
122
124
|
styles.input,
|
|
123
125
|
{
|
|
124
126
|
color: textColor,
|
|
125
|
-
fontFamily: `${theme.font}
|
|
127
|
+
fontFamily: `${theme.font}-${inputTextWeight}`,
|
|
126
128
|
},
|
|
127
129
|
]}
|
|
128
130
|
textBreakStrategy="highQuality"
|
package/Input/InputSearch.tsx
CHANGED
package/Input/index.tsx
CHANGED
package/Layout/Card.tsx
CHANGED
|
@@ -41,7 +41,6 @@ const Card: React.FC<CardProps> = ({
|
|
|
41
41
|
const gridContext: GridContextProps = {
|
|
42
42
|
numberOfColumns,
|
|
43
43
|
gutterSize,
|
|
44
|
-
margin,
|
|
45
44
|
sizePerSpan,
|
|
46
45
|
getSizeSpan: span => {
|
|
47
46
|
return span * sizePerSpan + (span - 1) * gutterSize;
|
|
@@ -149,7 +148,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
149
148
|
styles.card,
|
|
150
149
|
{
|
|
151
150
|
width: widthSection,
|
|
152
|
-
marginHorizontal:
|
|
151
|
+
marginHorizontal: margin,
|
|
153
152
|
backgroundColor: theme.colors.background.surface,
|
|
154
153
|
},
|
|
155
154
|
useShadow && Shadow.Light,
|
package/Layout/GridSystem.tsx
CHANGED
|
@@ -24,7 +24,6 @@ const GridSystem: React.FC<any> = ({
|
|
|
24
24
|
const grid: GridContextProps = {
|
|
25
25
|
numberOfColumns,
|
|
26
26
|
gutterSize,
|
|
27
|
-
margin,
|
|
28
27
|
sizePerSpan,
|
|
29
28
|
getSizeSpan: span => {
|
|
30
29
|
return span * sizePerSpan + (span - 1) * gutterSize;
|
|
@@ -46,7 +45,7 @@ const GridSystem: React.FC<any> = ({
|
|
|
46
45
|
screenGrid && insets,
|
|
47
46
|
{
|
|
48
47
|
borderColor: theme.colors.error.primary,
|
|
49
|
-
marginHorizontal:
|
|
48
|
+
marginHorizontal: margin,
|
|
50
49
|
top: Spacing.M,
|
|
51
50
|
bottom: Spacing.M,
|
|
52
51
|
},
|
package/Layout/Screen.tsx
CHANGED
package/Layout/Section.tsx
CHANGED
|
@@ -50,7 +50,6 @@ const Section: React.FC<SectionProps> = ({
|
|
|
50
50
|
const gridContext: GridContextProps = {
|
|
51
51
|
numberOfColumns,
|
|
52
52
|
gutterSize,
|
|
53
|
-
margin,
|
|
54
53
|
sizePerSpan,
|
|
55
54
|
getSizeSpan: span => {
|
|
56
55
|
return span * sizePerSpan + (span - 1) * gutterSize;
|
|
@@ -143,7 +142,6 @@ const Section: React.FC<SectionProps> = ({
|
|
|
143
142
|
value={{
|
|
144
143
|
numberOfColumns,
|
|
145
144
|
gutterSize,
|
|
146
|
-
margin,
|
|
147
145
|
sizePerSpan,
|
|
148
146
|
getSizeSpan: span => {
|
|
149
147
|
return span * sizePerSpan + (span - 1) * gutterSize;
|
|
@@ -156,7 +154,7 @@ const Section: React.FC<SectionProps> = ({
|
|
|
156
154
|
styles.protectedStyle,
|
|
157
155
|
{
|
|
158
156
|
width: widthSection,
|
|
159
|
-
marginHorizontal:
|
|
157
|
+
marginHorizontal: margin,
|
|
160
158
|
flexDirection: 'row',
|
|
161
159
|
flexWrap: 'wrap',
|
|
162
160
|
},
|
package/Layout/index.ts
CHANGED
package/Layout/types.ts
CHANGED
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
2
|
-
import {StyleSheet, TouchableOpacity, View} from 'react-native';
|
|
1
|
+
import React, {useContext, useState} from 'react';
|
|
2
|
+
import {ScrollView, StyleSheet, TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {PopupNotifyProps} from './types';
|
|
4
4
|
import {Radius, Spacing, Styles} from '../Consts';
|
|
5
5
|
import {Image} from '../Image';
|
|
@@ -19,6 +19,14 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
19
19
|
onIconClose,
|
|
20
20
|
}) => {
|
|
21
21
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
22
|
+
const [scrollContent, setScrollContent] = useState(false);
|
|
23
|
+
|
|
24
|
+
let descriptionStyle = {};
|
|
25
|
+
let Description: any = View;
|
|
26
|
+
if (scrollContent) {
|
|
27
|
+
Description = ScrollView;
|
|
28
|
+
descriptionStyle = {height: 80};
|
|
29
|
+
}
|
|
22
30
|
|
|
23
31
|
/**
|
|
24
32
|
* on action popup
|
|
@@ -143,11 +151,19 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
143
151
|
<Text typography={'title_xs'} numberOfLines={1}>
|
|
144
152
|
{title}
|
|
145
153
|
</Text>
|
|
146
|
-
<
|
|
147
|
-
<Text
|
|
154
|
+
<Description style={[styles.description, descriptionStyle]}>
|
|
155
|
+
<Text
|
|
156
|
+
typography={'paragraph_default'}
|
|
157
|
+
numberOfLines={4}
|
|
158
|
+
onTextLayout={({nativeEvent: {lines}}) => {
|
|
159
|
+
const enableScroll = lines.length > 3;
|
|
160
|
+
if (enableScroll != scrollContent) {
|
|
161
|
+
setScrollContent(enableScroll);
|
|
162
|
+
}
|
|
163
|
+
}}>
|
|
148
164
|
{description}
|
|
149
165
|
</Text>
|
|
150
|
-
</
|
|
166
|
+
</Description>
|
|
151
167
|
{!!information && (
|
|
152
168
|
<View style={styles.information}>
|
|
153
169
|
<Text
|
package/Title/index.tsx
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import React, {FC, useContext, useState} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
LayoutChangeEvent,
|
|
4
|
+
Text as RNText,
|
|
5
|
+
TouchableOpacity,
|
|
6
|
+
View,
|
|
7
|
+
} from 'react-native';
|
|
3
8
|
import {TitleProps} from './types';
|
|
4
9
|
import {Icon} from '../Icon';
|
|
5
10
|
import styles from './styles';
|
|
@@ -19,6 +24,7 @@ const Title: FC<TitleProps> = ({
|
|
|
19
24
|
description,
|
|
20
25
|
}) => {
|
|
21
26
|
const {theme} = useContext(ApplicationContext);
|
|
27
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
22
28
|
const flexStyle = titleFlex ? {flex: 1} : {};
|
|
23
29
|
const typeStyle =
|
|
24
30
|
type === 'screen' ? styles.screen : styles[`${type}_${size}`];
|
|
@@ -31,7 +37,7 @@ const Title: FC<TitleProps> = ({
|
|
|
31
37
|
const actionSize = titleFlex ? scaleSize(22) : scaleSize(18);
|
|
32
38
|
const titleWeight = type === 'screen' ? 'Semibold' : 'Bold';
|
|
33
39
|
const marginStyle = type === 'section' ? {marginTop: Spacing.M} : {};
|
|
34
|
-
|
|
40
|
+
const numberOfLines = type === 'section' ? 1 : 2;
|
|
35
41
|
const renderAction = () => {
|
|
36
42
|
return !!actionTitle && titleFlex ? (
|
|
37
43
|
<TouchableOpacity onPress={onPressAction}>
|
|
@@ -56,13 +62,18 @@ const Title: FC<TitleProps> = ({
|
|
|
56
62
|
);
|
|
57
63
|
};
|
|
58
64
|
|
|
65
|
+
const onLayout = (e: LayoutChangeEvent) => {
|
|
66
|
+
setContainerWidth(e.nativeEvent.layout.width);
|
|
67
|
+
};
|
|
68
|
+
|
|
59
69
|
return (
|
|
60
|
-
<View style={styles.wrapper}>
|
|
70
|
+
<View onLayout={onLayout} style={styles.wrapper}>
|
|
61
71
|
<View style={[styles.container, marginStyle]}>
|
|
62
72
|
{!!icon && type !== 'screen' && (
|
|
63
73
|
<Icon style={styles.icon} source={icon} />
|
|
64
74
|
)}
|
|
65
75
|
<RNText
|
|
76
|
+
numberOfLines={numberOfLines}
|
|
66
77
|
style={[
|
|
67
78
|
typeStyle,
|
|
68
79
|
flexStyle,
|
|
@@ -70,6 +81,7 @@ const Title: FC<TitleProps> = ({
|
|
|
70
81
|
{
|
|
71
82
|
fontFamily: `${theme.font}-${titleWeight}`,
|
|
72
83
|
color: theme.colors.text.default,
|
|
84
|
+
maxWidth: containerWidth - scaleSize(22),
|
|
73
85
|
},
|
|
74
86
|
]}>
|
|
75
87
|
{title}
|
package/Title/styles.ts
CHANGED