@momo-kits/foundation 0.81.8-beta.1 → 0.81.8-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/BottomTab.tsx +9 -2
- package/Application/types.ts +1 -0
- package/Image/index.tsx +9 -8
- package/Popup/PopupNotify.tsx +21 -5
- 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
|
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/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
|