@momo-kits/foundation 0.158.1-beta.4 → 0.160.1-rn.84
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/Divider/index.tsx +3 -3
- package/Image/index.tsx +46 -1
- package/package.json +34 -34
package/Divider/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import { View, ViewStyle } from 'react-native';
|
|
2
|
+
import { StyleProp, View, ViewStyle } from 'react-native';
|
|
3
3
|
import { ApplicationContext } from '../Context';
|
|
4
4
|
import { Spacing } from '../Consts';
|
|
5
5
|
import { DashDivider } from './DashDivider';
|
|
@@ -8,7 +8,7 @@ export interface DividerProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* Custom styles for divider
|
|
10
10
|
*/
|
|
11
|
-
style?: ViewStyle
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Enable margin vertical 4px
|
|
@@ -30,13 +30,13 @@ const Divider: React.FC<DividerProps> = ({
|
|
|
30
30
|
return (
|
|
31
31
|
<View
|
|
32
32
|
style={[
|
|
33
|
-
style,
|
|
34
33
|
{
|
|
35
34
|
height: 1,
|
|
36
35
|
width: '100%',
|
|
37
36
|
backgroundColor: theme.colors.border.default,
|
|
38
37
|
marginVertical: useMargin ? Spacing.XS : 0,
|
|
39
38
|
},
|
|
39
|
+
style,
|
|
40
40
|
]}
|
|
41
41
|
/>
|
|
42
42
|
);
|
package/Image/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useRef, useState } from 'react';
|
|
2
|
-
import { StyleSheet, View } from 'react-native';
|
|
2
|
+
import { Image as RNImage, StyleSheet, View } from 'react-native';
|
|
3
3
|
import FastImage from 'react-native-fast-image';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import {
|
|
@@ -23,6 +23,10 @@ export const getImageName = (source: any): string => {
|
|
|
23
23
|
return '';
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
const isDataUriSource = (source: any): boolean => {
|
|
27
|
+
return typeof source?.uri === 'string' && source.uri.startsWith('data:');
|
|
28
|
+
};
|
|
29
|
+
|
|
26
30
|
const Image: React.FC<ImageProps> = ({
|
|
27
31
|
style,
|
|
28
32
|
source,
|
|
@@ -38,6 +42,7 @@ const Image: React.FC<ImageProps> = ({
|
|
|
38
42
|
const [status, setStatus] = useState<Status>('success');
|
|
39
43
|
|
|
40
44
|
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
45
|
+
const useFastImage = !isDataUriSource(source);
|
|
41
46
|
|
|
42
47
|
let accessibilityLabel: any = `img|${getImageName(source)}`;
|
|
43
48
|
if (component?.componentId) {
|
|
@@ -74,6 +79,46 @@ const Image: React.FC<ImageProps> = ({
|
|
|
74
79
|
return children;
|
|
75
80
|
};
|
|
76
81
|
|
|
82
|
+
if (!useFastImage) {
|
|
83
|
+
return (
|
|
84
|
+
<RNImage
|
|
85
|
+
{...rest}
|
|
86
|
+
{...{
|
|
87
|
+
accessibilityLabel: rest.accessibilityLabel ?? accessibilityLabel,
|
|
88
|
+
}}
|
|
89
|
+
source={source}
|
|
90
|
+
style={[
|
|
91
|
+
styles.container,
|
|
92
|
+
style,
|
|
93
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
94
|
+
]}
|
|
95
|
+
onLoadStart={() => {
|
|
96
|
+
error.current = false;
|
|
97
|
+
if (status !== 'loading' && loading) {
|
|
98
|
+
setStatus('loading');
|
|
99
|
+
}
|
|
100
|
+
}}
|
|
101
|
+
onLoad={() => {
|
|
102
|
+
error.current = false;
|
|
103
|
+
}}
|
|
104
|
+
onLoadEnd={() => {
|
|
105
|
+
let current: Status = 'success';
|
|
106
|
+
if (error.current) {
|
|
107
|
+
current = 'error';
|
|
108
|
+
}
|
|
109
|
+
setStatus(prevState =>
|
|
110
|
+
prevState !== current ? current : prevState,
|
|
111
|
+
);
|
|
112
|
+
}}
|
|
113
|
+
onError={() => {
|
|
114
|
+
error.current = true;
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
{renderContent()}
|
|
118
|
+
</RNImage>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
77
122
|
return (
|
|
78
123
|
<FastImage
|
|
79
124
|
{...rest}
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
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
|
-
}
|
|
2
|
+
"name": "@momo-kits/foundation",
|
|
3
|
+
"version": "0.160.1-rn.84",
|
|
4
|
+
"description": "React Native Component Kits",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"@momo-kits/foundation"
|
|
7
|
+
],
|
|
8
|
+
"license": "MoMo",
|
|
9
|
+
"main": "index.ts",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"registry": "https://registry.npmjs.org/"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@react-navigation/bottom-tabs": "7.4.2",
|
|
16
|
+
"@react-navigation/core": "7.12.1",
|
|
17
|
+
"@react-navigation/elements": "2.5.2",
|
|
18
|
+
"@react-navigation/native": "7.1.14",
|
|
19
|
+
"@react-navigation/routers": "7.4.1",
|
|
20
|
+
"@react-navigation/stack": "7.4.2",
|
|
21
|
+
"@shopify/flash-list": "2.1.0",
|
|
22
|
+
"lottie-react-native": "7.3.4",
|
|
23
|
+
"react-native-fast-image": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-fast-image.git#v8.11.0",
|
|
24
|
+
"react-native-gesture-handler": "2.31.0",
|
|
25
|
+
"react-native-linear-gradient": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-linear-gradient#v3.0.0",
|
|
26
|
+
"react-native-reanimated": "4.2.2",
|
|
27
|
+
"react-native-safe-area-context": "5.7.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/color": "3.0.6"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react-native": "*"
|
|
34
|
+
}
|
|
35
|
+
}
|