@momo-kits/foundation 0.112.1-beta.2 → 0.112.1-beta.5
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/index.tsx +8 -7
- package/Application/NavigationContainer.tsx +4 -13
- package/Application/utils.tsx +1 -26
- package/Consts/colors+spacing+radius.ts +31 -1
- package/Layout/Screen.tsx +18 -1
- package/index.ts +10 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
|
|
|
2
2
|
import {NavigationContainer} from '@react-navigation/native';
|
|
3
3
|
import {createStackNavigator} from '@react-navigation/stack';
|
|
4
4
|
import React, {useContext, useEffect} from 'react';
|
|
5
|
-
import {Animated,
|
|
5
|
+
import {Animated, Platform, StatusBar} from 'react-native';
|
|
6
6
|
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
7
7
|
import {Colors} from '../../Consts';
|
|
8
8
|
import {Icon} from '../../Icon';
|
|
@@ -19,8 +19,10 @@ const Stack = createStackNavigator();
|
|
|
19
19
|
const TabScreen: React.FC<any> = ({route, navigation}) => {
|
|
20
20
|
const {nested, options, screen, initialParams} = route?.params;
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
const
|
|
22
|
+
const opacityValue = 0.3;
|
|
23
|
+
const scaleValue = 0.97;
|
|
24
|
+
const opacity = new Animated.Value(opacityValue);
|
|
25
|
+
const scale = new Animated.Value(scaleValue);
|
|
24
26
|
|
|
25
27
|
useEffect(() => {
|
|
26
28
|
const unsubscribeFocus = navigation.addListener('focus', () => {
|
|
@@ -32,8 +34,7 @@ const TabScreen: React.FC<any> = ({route, navigation}) => {
|
|
|
32
34
|
}),
|
|
33
35
|
Animated.timing(scale, {
|
|
34
36
|
toValue: 1,
|
|
35
|
-
duration:
|
|
36
|
-
easing: Easing.bezier(0.4, 0.0, 0.2, 1),
|
|
37
|
+
duration: 200,
|
|
37
38
|
useNativeDriver: true,
|
|
38
39
|
}),
|
|
39
40
|
]).start();
|
|
@@ -42,12 +43,12 @@ const TabScreen: React.FC<any> = ({route, navigation}) => {
|
|
|
42
43
|
const unsubscribeBlur = navigation.addListener('blur', () => {
|
|
43
44
|
Animated.parallel([
|
|
44
45
|
Animated.timing(opacity, {
|
|
45
|
-
toValue:
|
|
46
|
+
toValue: opacityValue,
|
|
46
47
|
duration: 200,
|
|
47
48
|
useNativeDriver: true,
|
|
48
49
|
}),
|
|
49
50
|
Animated.timing(scale, {
|
|
50
|
-
toValue:
|
|
51
|
+
toValue: scaleValue,
|
|
51
52
|
duration: 200,
|
|
52
53
|
useNativeDriver: true,
|
|
53
54
|
}),
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
createStackNavigator,
|
|
9
9
|
StackNavigationOptions,
|
|
10
10
|
} from '@react-navigation/stack';
|
|
11
|
-
import {DeviceEventEmitter
|
|
11
|
+
import {DeviceEventEmitter} from 'react-native';
|
|
12
12
|
import StackScreen from './StackScreen';
|
|
13
13
|
import ModalScreen from './ModalScreen';
|
|
14
14
|
import Navigator from './Navigator';
|
|
@@ -16,7 +16,7 @@ import {getDialogOptions, getModalOptions, getStackOptions} from './utils';
|
|
|
16
16
|
import {NavigationContainerProps} from './types';
|
|
17
17
|
import {ApplicationContext, MiniAppContext} from './index';
|
|
18
18
|
import Localize from './Localize';
|
|
19
|
-
import {defaultTheme} from '../Consts';
|
|
19
|
+
import {defaultTheme, Configs} from '../Consts';
|
|
20
20
|
|
|
21
21
|
const Stack = createStackNavigator();
|
|
22
22
|
|
|
@@ -36,15 +36,6 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
36
36
|
const [showGrid, setShowGrid] = useState(false);
|
|
37
37
|
const [currentContext, setCurrentContext] = useState({});
|
|
38
38
|
|
|
39
|
-
let config: any = null;
|
|
40
|
-
try {
|
|
41
|
-
config = JSON.parse(
|
|
42
|
-
NativeModules?.ConfigsModule?.getConfigSync?.('DESIGN_SYSTEM') || ''
|
|
43
|
-
);
|
|
44
|
-
} catch (e) {
|
|
45
|
-
console.log(e);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
39
|
/**
|
|
49
40
|
* inject data for navigator
|
|
50
41
|
*/
|
|
@@ -105,8 +96,8 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
105
96
|
});
|
|
106
97
|
};
|
|
107
98
|
|
|
108
|
-
const headerBackground = theme.assets?.headerBackground ||
|
|
109
|
-
const headerGradient =
|
|
99
|
+
const headerBackground = theme.assets?.headerBackground || Configs.headerBar;
|
|
100
|
+
const headerGradient = Configs?.headerGradient || theme.colors?.gradient;
|
|
110
101
|
|
|
111
102
|
navigator.current.setCurrentContext = setCurrentContext;
|
|
112
103
|
|
package/Application/utils.tsx
CHANGED
|
@@ -26,32 +26,7 @@ const getStackOptions = (): StackNavigationOptions => {
|
|
|
26
26
|
headerRight: (props: any) => <HeaderRight {...props} />,
|
|
27
27
|
headerTintColor: Colors.black_17,
|
|
28
28
|
gestureEnabled: false,
|
|
29
|
-
|
|
30
|
-
cardStyle: {
|
|
31
|
-
transform: [
|
|
32
|
-
{
|
|
33
|
-
translateX: progress.interpolate({
|
|
34
|
-
inputRange: [0, 1],
|
|
35
|
-
outputRange: [layouts.screen.width, 0],
|
|
36
|
-
}),
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
}),
|
|
41
|
-
transitionSpec: {
|
|
42
|
-
open: {
|
|
43
|
-
animation: 'timing',
|
|
44
|
-
config: {
|
|
45
|
-
duration: 300,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
close: {
|
|
49
|
-
animation: 'timing',
|
|
50
|
-
config: {
|
|
51
|
-
duration: 300,
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
29
|
+
...TransitionPresets.SlideFromRightIOS,
|
|
55
30
|
};
|
|
56
31
|
};
|
|
57
32
|
|
|
@@ -229,4 +229,34 @@ const Shadow = {
|
|
|
229
229
|
}),
|
|
230
230
|
};
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
const Configs = {
|
|
233
|
+
headerGradient: '',
|
|
234
|
+
headerBar: '',
|
|
235
|
+
trustBanner: {
|
|
236
|
+
content: {
|
|
237
|
+
vi: 'Bảo mật thông tin & An toàn tài sản của bạn là ưu tiên hàng đầu của MoMo.',
|
|
238
|
+
en: "Your data security and money safety are MoMo's top priorities.",
|
|
239
|
+
},
|
|
240
|
+
subContent: {
|
|
241
|
+
vi: 'Tìm hiểu thêm',
|
|
242
|
+
en: 'Learn more',
|
|
243
|
+
},
|
|
244
|
+
pciImage: 'https://static.momocdn.net/app/img/kits/trustBanner/pci_dss.png',
|
|
245
|
+
sslImage: 'https://static.momocdn.net/app/img/kits/trustBanner/ssl.png',
|
|
246
|
+
momoImage:
|
|
247
|
+
'https://static.momocdn.net/app/img/kits/trustBanner/ic_secu.png',
|
|
248
|
+
urlConfig: 'login_and_security',
|
|
249
|
+
icons: [
|
|
250
|
+
'https://static.momocdn.net/app/img/kits/trustBanner/ic_viettinbank.png',
|
|
251
|
+
'https://static.momocdn.net/app/img/kits/trustBanner/ic_agribank.png',
|
|
252
|
+
'https://static.momocdn.net/app/img/kits/trustBanner/ic_vietcombank.png',
|
|
253
|
+
'https://static.momocdn.net/app/img/kits/trustBanner/ic_bidv.png',
|
|
254
|
+
],
|
|
255
|
+
titleWeb: {
|
|
256
|
+
vi: 'Thông tin',
|
|
257
|
+
en: 'Information',
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export {Colors, Spacing, Radius, Shadow, Configs};
|
package/Layout/Screen.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {StackNavigationOptions, useHeaderHeight} from '@react-navigation/stack';
|
|
2
2
|
import React, {
|
|
3
|
+
Children,
|
|
3
4
|
forwardRef,
|
|
4
5
|
Fragment,
|
|
5
6
|
ReactNode,
|
|
@@ -43,6 +44,7 @@ import {
|
|
|
43
44
|
HeaderTitle,
|
|
44
45
|
} from '../Application/Components';
|
|
45
46
|
import {SearchHeader} from '../Application/Components/SearchHeader';
|
|
47
|
+
import {Skeleton} from '@momo-kits/foundation';
|
|
46
48
|
|
|
47
49
|
export interface ScreenProps extends ViewProps {
|
|
48
50
|
/**
|
|
@@ -174,6 +176,7 @@ const Screen = forwardRef(
|
|
|
174
176
|
animatedValue: customAnimatedValue,
|
|
175
177
|
headerBackground,
|
|
176
178
|
gradientColor,
|
|
179
|
+
isLoading,
|
|
177
180
|
}: ScreenProps,
|
|
178
181
|
ref: any
|
|
179
182
|
) => {
|
|
@@ -504,6 +507,16 @@ const Screen = forwardRef(
|
|
|
504
507
|
}
|
|
505
508
|
};
|
|
506
509
|
|
|
510
|
+
const generateSkeleton = () => {
|
|
511
|
+
if (children) {
|
|
512
|
+
return Children.toArray(children).map((item, index) => {
|
|
513
|
+
return (
|
|
514
|
+
<Skeleton key={`Skeleton${index}`} style={{marginTop: Spacing.M}} />
|
|
515
|
+
);
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
|
|
507
520
|
return (
|
|
508
521
|
<View
|
|
509
522
|
style={[
|
|
@@ -543,7 +556,11 @@ const Screen = forwardRef(
|
|
|
543
556
|
style={Styles.flex}>
|
|
544
557
|
{renderAnimatedHeader()}
|
|
545
558
|
|
|
546
|
-
{
|
|
559
|
+
{isLoading
|
|
560
|
+
? generateSkeleton()
|
|
561
|
+
: useGridLayout
|
|
562
|
+
? renderContent(children)
|
|
563
|
+
: children}
|
|
547
564
|
</Component>
|
|
548
565
|
|
|
549
566
|
{floatingButtonProps && (
|
package/index.ts
CHANGED
|
@@ -4,6 +4,16 @@ import {
|
|
|
4
4
|
useSafeAreaInsets,
|
|
5
5
|
} from 'react-native-safe-area-context';
|
|
6
6
|
import LinearGradient from 'react-native-linear-gradient';
|
|
7
|
+
import {Configs} from './Consts';
|
|
8
|
+
|
|
9
|
+
if (typeof (global as any)?.miniAppApi?.dispatch === 'function') {
|
|
10
|
+
const features = (global as any)?.miniAppApi?.dispatch?.('platform_config');
|
|
11
|
+
const designSystemJson = features[0].designSystem;
|
|
12
|
+
const config = JSON.parse(designSystemJson);
|
|
13
|
+
Configs.trustBanner = config?.trustBanner;
|
|
14
|
+
Configs.headerBar = config?.headerBar;
|
|
15
|
+
Configs.headerGradient = config?.headerGradient;
|
|
16
|
+
}
|
|
7
17
|
|
|
8
18
|
/**
|
|
9
19
|
* native export
|