@momo-kits/foundation 0.168.1-beta.1 → 0.168.1-rn.88.0
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/BottomSheet.tsx +2 -2
- package/Application/ModalScreen.tsx +2 -2
- package/Application/StackScreen.tsx +7 -2
- package/Divider/index.tsx +3 -3
- package/Image/index.tsx +46 -1
- package/package.json +28 -26
|
@@ -333,7 +333,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
333
333
|
onRequestClose={() => {
|
|
334
334
|
onDismiss();
|
|
335
335
|
}}
|
|
336
|
-
style={StyleSheet.
|
|
336
|
+
style={StyleSheet.absoluteFill}
|
|
337
337
|
isModalKit={true}
|
|
338
338
|
>
|
|
339
339
|
<KeyboardAvoidingView
|
|
@@ -347,7 +347,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
347
347
|
style={styles.container}
|
|
348
348
|
>
|
|
349
349
|
<Pressable
|
|
350
|
-
style={StyleSheet.
|
|
350
|
+
style={StyleSheet.absoluteFill}
|
|
351
351
|
onPress={() => {
|
|
352
352
|
action.current = 'touch';
|
|
353
353
|
onDismiss();
|
|
@@ -133,7 +133,7 @@ const Modal: React.FC<ModalParams> = props => {
|
|
|
133
133
|
transparent
|
|
134
134
|
visible={true}
|
|
135
135
|
onRequestClose={onDismiss}
|
|
136
|
-
style={StyleSheet.
|
|
136
|
+
style={StyleSheet.absoluteFill}
|
|
137
137
|
isModalKit={true}
|
|
138
138
|
>
|
|
139
139
|
<KeyboardAvoidingView
|
|
@@ -141,7 +141,7 @@ const Modal: React.FC<ModalParams> = props => {
|
|
|
141
141
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
|
142
142
|
>
|
|
143
143
|
<Pressable
|
|
144
|
-
style={StyleSheet.
|
|
144
|
+
style={StyleSheet.absoluteFill}
|
|
145
145
|
onPress={() => onDismiss(undefined, barrierDismissible)}
|
|
146
146
|
>
|
|
147
147
|
<Animated.View style={[styles.overlayContent, { opacity }]} />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useLayoutEffect, useRef } from 'react';
|
|
2
|
-
import { Alert
|
|
2
|
+
import { Alert } from 'react-native';
|
|
3
3
|
import { useHeaderHeight } from '@react-navigation/elements';
|
|
4
4
|
import { ScreenTrackingParams } from './types';
|
|
5
5
|
import Navigation from './Navigation';
|
|
@@ -8,7 +8,12 @@ import { version } from '../package.json';
|
|
|
8
8
|
import { SwipeBackHaptic, useAppState } from './utils';
|
|
9
9
|
import { TooltipPortalHost, TooltipPortalProvider } from './TooltipPortal';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// RN 0.87+: InteractionManager đã bị xoá khỏi react-native → thay bằng requestIdleCallback.
|
|
12
|
+
// Giữ nguyên shape trả về { cancel } để code bên dưới (timeoutInteraction?.cancel?.()) không đổi.
|
|
13
|
+
const runAfterInteractions = (task: () => void) => {
|
|
14
|
+
const handle = requestIdleCallback(() => task());
|
|
15
|
+
return { cancel: () => cancelIdleCallback(handle) };
|
|
16
|
+
};
|
|
12
17
|
|
|
13
18
|
/**
|
|
14
19
|
* container for stack screen
|
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,
|
|
@@ -43,6 +47,7 @@ const Image: React.FC<ImageProps> = ({
|
|
|
43
47
|
const [status, setStatus] = useState<Status>('success');
|
|
44
48
|
|
|
45
49
|
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
50
|
+
const useFastImage = !isDataUriSource(source);
|
|
46
51
|
|
|
47
52
|
let accessibilityLabel: any = `img|${getImageName(source)}`;
|
|
48
53
|
if (component?.componentId) {
|
|
@@ -79,6 +84,46 @@ const Image: React.FC<ImageProps> = ({
|
|
|
79
84
|
return children;
|
|
80
85
|
};
|
|
81
86
|
|
|
87
|
+
if (!useFastImage) {
|
|
88
|
+
return (
|
|
89
|
+
<RNImage
|
|
90
|
+
{...rest}
|
|
91
|
+
{...{
|
|
92
|
+
accessibilityLabel: rest.accessibilityLabel ?? accessibilityLabel,
|
|
93
|
+
}}
|
|
94
|
+
source={source}
|
|
95
|
+
style={[
|
|
96
|
+
styles.container,
|
|
97
|
+
style,
|
|
98
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
99
|
+
]}
|
|
100
|
+
onLoadStart={() => {
|
|
101
|
+
error.current = false;
|
|
102
|
+
if (status !== 'loading' && loading) {
|
|
103
|
+
setStatus('loading');
|
|
104
|
+
}
|
|
105
|
+
}}
|
|
106
|
+
onLoad={() => {
|
|
107
|
+
error.current = false;
|
|
108
|
+
}}
|
|
109
|
+
onLoadEnd={() => {
|
|
110
|
+
let current: Status = 'success';
|
|
111
|
+
if (error.current) {
|
|
112
|
+
current = 'error';
|
|
113
|
+
}
|
|
114
|
+
setStatus(prevState =>
|
|
115
|
+
prevState !== current ? current : prevState,
|
|
116
|
+
);
|
|
117
|
+
}}
|
|
118
|
+
onError={() => {
|
|
119
|
+
error.current = true;
|
|
120
|
+
}}
|
|
121
|
+
>
|
|
122
|
+
{renderContent()}
|
|
123
|
+
</RNImage>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
82
127
|
return (
|
|
83
128
|
<FastImage
|
|
84
129
|
{...rest}
|
package/package.json
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.168.1-
|
|
3
|
+
"version": "0.168.1-rn.88.0",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
|
-
"main": "index.ts",
|
|
6
|
-
"scripts": {},
|
|
7
5
|
"keywords": [
|
|
8
6
|
"@momo-kits/foundation"
|
|
9
7
|
],
|
|
8
|
+
"license": "MoMo",
|
|
9
|
+
"main": "index.ts",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"registry": "https://registry.npmjs.org/"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {},
|
|
10
14
|
"dependencies": {
|
|
11
|
-
"react-
|
|
12
|
-
"@react-navigation/
|
|
13
|
-
"@react-navigation/
|
|
14
|
-
"@react-navigation/
|
|
15
|
-
"@react-navigation/
|
|
16
|
-
"@react-navigation/
|
|
17
|
-
"@react-navigation/stack": "7.4.2",
|
|
18
|
-
"react-native-gesture-handler": "2.27.1",
|
|
19
|
-
"react-native-linear-gradient": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-linear-gradient#v3.0.0",
|
|
20
|
-
"react-native-reanimated": "4.2.2",
|
|
21
|
-
"react-native-worklets": "0.6.1",
|
|
22
|
-
"react-native-safe-area-context": "5.5.2",
|
|
23
|
-
"react-native-reserved-regions": "0.2.0",
|
|
15
|
+
"@react-navigation/bottom-tabs": "7.21.0",
|
|
16
|
+
"@react-navigation/core": "7.24.0",
|
|
17
|
+
"@react-navigation/elements": "2.9.45",
|
|
18
|
+
"@react-navigation/native": "7.5.1",
|
|
19
|
+
"@react-navigation/routers": "7.6.5",
|
|
20
|
+
"@react-navigation/stack": "7.12.1",
|
|
24
21
|
"@shopify/flash-list": "2.1.0",
|
|
25
|
-
"lottie-react-native": "7.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"react-native": "
|
|
29
|
-
"react-native-
|
|
22
|
+
"lottie-react-native": "7.3.6",
|
|
23
|
+
"react-native-fast-image": "git+https://oauth2:k_r5y_gV6sX9-TqQxgcd@gitlab.mservice.com.vn/momo-platform/public/react-native-fast-image.git#v8.11.0",
|
|
24
|
+
"react-native-gesture-handler": "3.4.0",
|
|
25
|
+
"react-native-linear-gradient": "git+https://oauth2:k_r5y_gV6sX9-TqQxgcd@gitlab.mservice.com.vn/momo-platform/public/react-native-linear-gradient#v3.0.0",
|
|
26
|
+
"react-native-reanimated": "4.7.1",
|
|
27
|
+
"react-native-safe-area-context": "5.7.0",
|
|
28
|
+
"react-native-reserved-regions": "0.2.0"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"@types/color": "3.0.6"
|
|
31
|
+
"@types/color": "3.0.6",
|
|
32
|
+
"react-native-reanimated": "4.7.1",
|
|
33
|
+
"react-native-worklets": "0.13.0"
|
|
33
34
|
},
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"react-native": "*",
|
|
37
|
+
"react-native-reanimated": ">=4.7.0",
|
|
38
|
+
"react-native-worklets": ">=0.13.0"
|
|
39
|
+
}
|
|
38
40
|
}
|