@momo-kits/foundation 0.162.2-beta.22 → 0.162.2-rn.86.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/BottomSheet.tsx +2 -2
- package/Application/ModalScreen.tsx +2 -2
- package/Application/StackScreen.tsx +1 -0
- package/Divider/index.tsx +3 -3
- package/Image/index.tsx +46 -1
- package/Layout/Screen.tsx +7 -32
- package/package.json +16 -16
|
@@ -255,7 +255,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
255
255
|
onRequestClose={() => {
|
|
256
256
|
onDismiss();
|
|
257
257
|
}}
|
|
258
|
-
style={StyleSheet.
|
|
258
|
+
style={StyleSheet.absoluteFill}
|
|
259
259
|
isModalKit={true}
|
|
260
260
|
>
|
|
261
261
|
<KeyboardAvoidingView
|
|
@@ -269,7 +269,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
269
269
|
style={styles.container}
|
|
270
270
|
>
|
|
271
271
|
<Pressable
|
|
272
|
-
style={StyleSheet.
|
|
272
|
+
style={StyleSheet.absoluteFill}
|
|
273
273
|
onPress={() => {
|
|
274
274
|
action.current = 'touch';
|
|
275
275
|
onDismiss();
|
|
@@ -128,7 +128,7 @@ const Modal: React.FC<ModalParams> = props => {
|
|
|
128
128
|
transparent
|
|
129
129
|
visible={true}
|
|
130
130
|
onRequestClose={onDismiss}
|
|
131
|
-
style={StyleSheet.
|
|
131
|
+
style={StyleSheet.absoluteFill}
|
|
132
132
|
isModalKit={true}
|
|
133
133
|
>
|
|
134
134
|
<KeyboardAvoidingView
|
|
@@ -136,7 +136,7 @@ const Modal: React.FC<ModalParams> = props => {
|
|
|
136
136
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
|
137
137
|
>
|
|
138
138
|
<Pressable
|
|
139
|
-
style={StyleSheet.
|
|
139
|
+
style={StyleSheet.absoluteFill}
|
|
140
140
|
onPress={() => onDismiss(undefined, barrierDismissible)}
|
|
141
141
|
>
|
|
142
142
|
<Animated.View style={[styles.overlayContent, { opacity }]} />
|
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/Layout/Screen.tsx
CHANGED
|
@@ -25,10 +25,7 @@ import {
|
|
|
25
25
|
View,
|
|
26
26
|
ViewProps,
|
|
27
27
|
} from 'react-native';
|
|
28
|
-
import {
|
|
29
|
-
useSharedValue,
|
|
30
|
-
withTiming,
|
|
31
|
-
} from 'react-native-reanimated';
|
|
28
|
+
import { useSharedValue, withTiming } from 'react-native-reanimated';
|
|
32
29
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
33
30
|
import { ApplicationContext, ScreenContext } from '../Context';
|
|
34
31
|
import Navigation from '../Application/Navigation';
|
|
@@ -166,13 +163,6 @@ export interface ScreenProps extends ViewProps {
|
|
|
166
163
|
trackingParams?: ScreenTrackingParams;
|
|
167
164
|
}
|
|
168
165
|
|
|
169
|
-
/**
|
|
170
|
-
* Scroll distance (px) over which the animated search header collapses from its
|
|
171
|
-
* expanded to its docked state — the input range consumed by `HeaderExtendHeader`
|
|
172
|
-
* and the settle threshold in `handleScrollEnd`.
|
|
173
|
-
*/
|
|
174
|
-
const SEARCH_HEADER_COLLAPSE_DISTANCE = 100;
|
|
175
|
-
|
|
176
166
|
const Screen = forwardRef(
|
|
177
167
|
(
|
|
178
168
|
{
|
|
@@ -202,8 +192,8 @@ const Screen = forwardRef(
|
|
|
202
192
|
ref: any,
|
|
203
193
|
) => {
|
|
204
194
|
const screenRef = useRef<View | ScrollView>(null);
|
|
205
|
-
const { width: widthDevice
|
|
206
|
-
const { theme } = useContext(ApplicationContext);
|
|
195
|
+
const { width: widthDevice } = useWindowDimensions();
|
|
196
|
+
const { theme, navigator } = useContext(ApplicationContext);
|
|
207
197
|
const screen: any = useContext(ScreenContext);
|
|
208
198
|
const insets = useSafeAreaInsets();
|
|
209
199
|
const heightHeader = useHeaderHeight();
|
|
@@ -242,7 +232,8 @@ const Screen = forwardRef(
|
|
|
242
232
|
}, [customAnimatedValue, internalShared]);
|
|
243
233
|
|
|
244
234
|
const currentTint = useRef<string | undefined>(undefined);
|
|
245
|
-
|
|
235
|
+
|
|
236
|
+
const isTab = !!screen?.bottomTab;
|
|
246
237
|
|
|
247
238
|
let handleScroll;
|
|
248
239
|
let Component: any = View;
|
|
@@ -657,23 +648,9 @@ const Screen = forwardRef(
|
|
|
657
648
|
onScroll={handleScroll}
|
|
658
649
|
onScrollEndDrag={handleScrollEnd}
|
|
659
650
|
scrollEventThrottle={16}
|
|
660
|
-
style={[
|
|
661
|
-
Styles.flex,
|
|
662
|
-
!scrollable && !Footer && !isTab && { paddingBottom: bottomInset },
|
|
663
|
-
]}
|
|
651
|
+
style={[Styles.flex]}
|
|
664
652
|
contentContainerStyle={[
|
|
665
653
|
scrollable && !Footer && !isTab && { paddingBottom: bottomInset },
|
|
666
|
-
// The animated search header collapses as the body scrolls. When the
|
|
667
|
-
// body is short (e.g. no search history) the ScrollView is barely
|
|
668
|
-
// scrollable, so overscroll bounce feeds the scroll-driven animation
|
|
669
|
-
// and the input jitters on its way up to the header. A ScrollView
|
|
670
|
-
// frame can never exceed the window, so forcing the content to be at
|
|
671
|
-
// least one screen plus the collapse distance guarantees the animation
|
|
672
|
-
// always has room to complete smoothly, independent of body content.
|
|
673
|
-
scrollable &&
|
|
674
|
-
inputSearchProps && {
|
|
675
|
-
minHeight: heightDevice + SEARCH_HEADER_COLLAPSE_DISTANCE,
|
|
676
|
-
},
|
|
677
654
|
scrollViewProps?.contentContainerStyle,
|
|
678
655
|
]}
|
|
679
656
|
>
|
|
@@ -687,9 +664,7 @@ const Screen = forwardRef(
|
|
|
687
664
|
<FloatingButton
|
|
688
665
|
{...floatingButtonProps}
|
|
689
666
|
animatedValue={sharedValue}
|
|
690
|
-
bottom={
|
|
691
|
-
Footer || isTab ? 12 : bottomInset + Spacing.S
|
|
692
|
-
}
|
|
667
|
+
bottom={Footer || isTab ? 12 : bottomInset + Spacing.S}
|
|
693
668
|
/>
|
|
694
669
|
</View>
|
|
695
670
|
)}
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.162.2-
|
|
3
|
+
"version": "0.162.2-rn.86.2",
|
|
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-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",
|
|
12
15
|
"@react-navigation/bottom-tabs": "7.4.2",
|
|
13
16
|
"@react-navigation/core": "7.12.1",
|
|
14
17
|
"@react-navigation/elements": "2.5.2",
|
|
15
18
|
"@react-navigation/native": "7.1.14",
|
|
16
19
|
"@react-navigation/routers": "7.4.1",
|
|
17
20
|
"@react-navigation/stack": "7.4.2",
|
|
18
|
-
"react-native-gesture-handler": "2.27.1",
|
|
19
|
-
"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",
|
|
20
|
-
"react-native-reanimated": "4.1.3",
|
|
21
|
-
"react-native-safe-area-context": "5.5.2",
|
|
22
21
|
"@shopify/flash-list": "2.1.0",
|
|
23
|
-
"lottie-react-native": "7.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"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": "2.31.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.2.2",
|
|
27
|
+
"react-native-safe-area-context": "5.7.0"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@types/color": "3.0.6"
|
|
30
31
|
},
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
}
|
|
34
|
-
"license": "MoMo"
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react-native": "*"
|
|
34
|
+
}
|
|
35
35
|
}
|