@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.
@@ -8,7 +8,12 @@ import {ApplicationContext} from './index';
8
8
 
9
9
  const Tab = createBottomTabNavigator();
10
10
 
11
- const BottomTab: React.FC<BottomTabProps> = ({tabs, listeners, navigation}) => {
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 backBehavior={'firstRoute'}>
29
+ <Tab.Navigator
30
+ initialRouteName={initialRouteName}
31
+ backBehavior={'firstRoute'}>
25
32
  {tabs.map(item => {
26
33
  return (
27
34
  <Tab.Screen
@@ -186,6 +186,7 @@ export type BottomTabItemProps = {
186
186
 
187
187
  export type BottomTabProps = {
188
188
  tabs: BottomTabItemProps[];
189
+ initialRouteName?: string;
189
190
  navigation: Navigation;
190
191
  listeners?: {
191
192
  tabPress?: any;
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
- if (error.current) {
74
- setStatus('error');
75
- } else {
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;
@@ -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
- <View style={styles.description}>
147
- <Text typography={'paragraph_default'} numberOfLines={3}>
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
- </View>
166
+ </Description>
151
167
  {!!information && (
152
168
  <View style={styles.information}>
153
169
  <Text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.81.8-beta.1",
3
+ "version": "0.81.8-beta.2",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {