@momo-kits/foundation 0.151.2-beta.1 → 0.152.1-beta.1
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 +1 -1
- package/Application/BottomTab/Badge.tsx +15 -2
- package/Application/BottomTab/BottomTabBar.tsx +1 -1
- package/Application/BottomTab/CustomBottomTabItem.tsx +5 -3
- package/Application/BottomTab/TabBarIcon.tsx +8 -6
- package/Application/BottomTab/index.tsx +8 -14
- package/Application/Components/BackgroundImageView.tsx +1 -1
- package/Application/Components/HeaderAnimated.tsx +12 -11
- package/Application/Components/HeaderBackground.tsx +1 -1
- package/Application/Components/HeaderExtendHeader.tsx +31 -26
- package/Application/Components/HeaderLeft.tsx +1 -1
- package/Application/Components/HeaderRight.tsx +24 -20
- package/Application/Components/HeaderTitle.tsx +6 -2
- package/Application/Components/NavigationButton.tsx +12 -11
- package/Application/Components/SearchHeader.tsx +1 -1
- package/Application/ModalScreen.tsx +1 -1
- package/Application/NavigationContainer.tsx +5 -7
- package/Application/StackScreen.tsx +27 -23
- package/Application/WidgetContainer.tsx +1 -1
- package/Application/index.ts +12 -31
- package/Application/types.ts +45 -8
- package/Application/utils.tsx +41 -17
- package/Badge/Badge.tsx +14 -11
- package/Badge/BadgeRibbon.tsx +1 -1
- package/Button/index.tsx +32 -27
- package/CheckBox/index.tsx +23 -19
- package/Context/index.ts +23 -0
- package/Divider/DashDivider.tsx +10 -9
- package/Divider/index.tsx +7 -7
- package/Icon/index.tsx +9 -9
- package/IconButton/index.tsx +12 -10
- package/Image/index.tsx +9 -2
- package/Input/Input.tsx +2 -5
- package/Input/InputDropDown.tsx +31 -23
- package/Input/InputMoney.tsx +2 -5
- package/Input/InputOTP.tsx +2 -5
- package/Input/InputPhoneNumber.tsx +2 -5
- package/Input/InputSearch.tsx +2 -5
- package/Input/InputTextArea.tsx +1 -1
- package/Input/common.tsx +31 -24
- package/Layout/Card.tsx +1 -1
- package/Layout/FloatingButton.tsx +1 -1
- package/Layout/GridSystem.tsx +15 -14
- package/Layout/Item.tsx +1 -1
- package/Layout/Screen.tsx +5 -4
- package/Layout/Section.tsx +1 -1
- package/Layout/TrackingScope.tsx +3 -3
- package/Loader/DotLoader.tsx +7 -7
- package/Loader/ProgressBar.tsx +10 -9
- package/Loader/Spinner.tsx +7 -7
- package/Pagination/Dot.tsx +10 -7
- package/Pagination/PaginationDot.tsx +8 -8
- package/Pagination/PaginationScroll.tsx +12 -10
- package/Popup/PopupNotify.tsx +2 -2
- package/Popup/PopupPromotion.tsx +1 -1
- package/Radio/index.tsx +18 -18
- package/Skeleton/index.tsx +1 -1
- package/Switch/index.tsx +17 -12
- package/Text/index.tsx +1 -1
- package/Title/index.tsx +48 -29
- package/index.ts +1 -0
- package/package.json +1 -1
- package/Application/Components/index.ts +0 -7
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
View,
|
|
12
12
|
} from 'react-native';
|
|
13
13
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
14
|
-
import { ApplicationContext } from '
|
|
14
|
+
import { ApplicationContext } from '../Context';
|
|
15
15
|
import { BottomSheetParams } from './types';
|
|
16
16
|
import { Colors, Radius, Spacing, Styles } from '../Consts';
|
|
17
17
|
import { Text } from '../Text';
|
|
@@ -77,6 +77,18 @@ export function Badge({
|
|
|
77
77
|
const borderRadius = size / 2;
|
|
78
78
|
const fontSize = Math.floor((size * 3) / 4);
|
|
79
79
|
|
|
80
|
+
const isNumber = () => {
|
|
81
|
+
const numberRegex = /^\d+$/;
|
|
82
|
+
return numberRegex.test(String(children));
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const formatTitle = () => {
|
|
86
|
+
if (isNumber() && Number(children) > 99) {
|
|
87
|
+
return '99+';
|
|
88
|
+
}
|
|
89
|
+
return children;
|
|
90
|
+
};
|
|
91
|
+
|
|
80
92
|
return (
|
|
81
93
|
<Animated.Text
|
|
82
94
|
numberOfLines={1}
|
|
@@ -103,8 +115,9 @@ export function Badge({
|
|
|
103
115
|
styles.container,
|
|
104
116
|
restStyle,
|
|
105
117
|
]}
|
|
106
|
-
{...rest}
|
|
107
|
-
|
|
118
|
+
{...rest}
|
|
119
|
+
>
|
|
120
|
+
{formatTitle()}
|
|
108
121
|
</Animated.Text>
|
|
109
122
|
);
|
|
110
123
|
}
|
|
@@ -14,8 +14,8 @@ import { Colors, Radius, Styles } from '../../Consts';
|
|
|
14
14
|
import { Icon } from '../../Icon';
|
|
15
15
|
import { Text } from '../../Text';
|
|
16
16
|
import { FloatingButtonProps } from '../types';
|
|
17
|
-
import { ApplicationContext } from '../index';
|
|
18
17
|
import CustomBottomTabItem from './CustomBottomTabItem';
|
|
18
|
+
import { ApplicationContext } from '../../Context';
|
|
19
19
|
|
|
20
20
|
type Props = BottomTabBarProps & {
|
|
21
21
|
activeTintColor?: string;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TouchableOpacity, StyleSheet, Platform } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
BottomTabBarButtonProps,
|
|
5
|
+
BottomTabNavigationOptions,
|
|
6
|
+
} from '@react-navigation/bottom-tabs';
|
|
7
|
+
import { Route } from '@react-navigation/native';
|
|
3
8
|
import { TabBarIcon } from './TabBarIcon';
|
|
4
9
|
import { Text } from '../../Text';
|
|
5
10
|
|
|
6
|
-
import { Route } from '@react-navigation/native';
|
|
7
|
-
import { BottomTabBarButtonProps, BottomTabNavigationOptions } from '@react-navigation/bottom-tabs';
|
|
8
|
-
|
|
9
11
|
type LabelType = NonNullable<BottomTabNavigationOptions['tabBarLabel']>;
|
|
10
12
|
|
|
11
13
|
interface CustomBottomTabItemProps {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {Route} from '@react-navigation/native';
|
|
1
|
+
import type { Route } from '@react-navigation/native';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import {
|
|
4
4
|
type StyleProp,
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
type ViewStyle,
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
|
|
11
|
-
import {Badge} from './Badge';
|
|
12
|
-
import {Colors} from '../../Consts';
|
|
11
|
+
import { Badge } from './Badge';
|
|
12
|
+
import { Colors } from '../../Consts';
|
|
13
13
|
|
|
14
14
|
type Props = {
|
|
15
15
|
route: Route<string>;
|
|
@@ -60,14 +60,15 @@ export function TabBarIcon({
|
|
|
60
60
|
// Workaround for react-native >= 0.54 layout bug
|
|
61
61
|
minWidth: iconSize,
|
|
62
62
|
},
|
|
63
|
-
]}
|
|
63
|
+
]}
|
|
64
|
+
>
|
|
64
65
|
{renderIcon({
|
|
65
66
|
focused: true,
|
|
66
67
|
size: iconSize,
|
|
67
68
|
color: activeTintColor ?? Colors.black_20,
|
|
68
69
|
})}
|
|
69
70
|
</View>
|
|
70
|
-
<View style={[styles.icon, {opacity: inactiveOpacity}]}>
|
|
71
|
+
<View style={[styles.icon, { opacity: inactiveOpacity }]}>
|
|
71
72
|
{renderIcon({
|
|
72
73
|
focused: false,
|
|
73
74
|
size: iconSize,
|
|
@@ -78,7 +79,8 @@ export function TabBarIcon({
|
|
|
78
79
|
visible={badge != null}
|
|
79
80
|
size={badge === '' ? 12 : iconSize * 0.75}
|
|
80
81
|
allowFontScaling={allowFontScaling}
|
|
81
|
-
style={[styles.badge, badgeStyle]}
|
|
82
|
+
style={[styles.badge, badgeStyle]}
|
|
83
|
+
>
|
|
82
84
|
{badge}
|
|
83
85
|
</Badge>
|
|
84
86
|
</View>
|
|
@@ -5,13 +5,7 @@ import {
|
|
|
5
5
|
useFocusEffect,
|
|
6
6
|
} from '@react-navigation/native';
|
|
7
7
|
import { createStackNavigator } from '@react-navigation/stack';
|
|
8
|
-
import React, {
|
|
9
|
-
useCallback,
|
|
10
|
-
useContext,
|
|
11
|
-
useEffect,
|
|
12
|
-
useLayoutEffect,
|
|
13
|
-
useRef,
|
|
14
|
-
} from 'react';
|
|
8
|
+
import React, { useContext, useEffect, useLayoutEffect, useRef } from 'react';
|
|
15
9
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
16
10
|
import {
|
|
17
11
|
Animated,
|
|
@@ -24,11 +18,11 @@ import {
|
|
|
24
18
|
import { Colors } from '../../Consts';
|
|
25
19
|
import { Icon } from '../../Icon';
|
|
26
20
|
import { exportFontFamily, Text } from '../../Text';
|
|
27
|
-
import { ApplicationContext, MiniAppContext } from '../index';
|
|
28
21
|
import StackScreen from '../StackScreen';
|
|
29
22
|
import { BottomTabProps } from '../types';
|
|
30
|
-
import { getOptions, getStackOptions } from '../utils';
|
|
23
|
+
import { getOptions, getStackOptions, useAppState } from '../utils';
|
|
31
24
|
import BottomTabBar from './BottomTabBar';
|
|
25
|
+
import { ApplicationContext, MiniAppContext } from '../../Context';
|
|
32
26
|
|
|
33
27
|
const Tab = createBottomTabNavigator();
|
|
34
28
|
const Stack = createStackNavigator();
|
|
@@ -44,9 +38,10 @@ const TabScreen: React.FC<any> = ({ route, navigation }) => {
|
|
|
44
38
|
const opacity = useRef(new Animated.Value(opacityValue)).current;
|
|
45
39
|
const scale = useRef(new Animated.Value(scaleValue)).current;
|
|
46
40
|
const screenName = screen?.name || screen?.type?.name || 'Invalid';
|
|
41
|
+
const { isBackgroundToForeground } = useAppState();
|
|
47
42
|
|
|
48
|
-
const onScreenNavigated =
|
|
49
|
-
(
|
|
43
|
+
const onScreenNavigated = (pre: string, current: string) => {
|
|
44
|
+
if (!isBackgroundToForeground) {
|
|
50
45
|
const data: any = {
|
|
51
46
|
preScreenName: pre,
|
|
52
47
|
screenName: current,
|
|
@@ -68,9 +63,8 @@ const TabScreen: React.FC<any> = ({ route, navigation }) => {
|
|
|
68
63
|
message: `${screenName} screen_navigated`,
|
|
69
64
|
type: 'ERROR',
|
|
70
65
|
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
74
68
|
|
|
75
69
|
useFocusEffect(
|
|
76
70
|
React.useCallback(
|
|
@@ -2,7 +2,7 @@ import React, { FC, useContext } from 'react';
|
|
|
2
2
|
import { Animated, Platform, StyleSheet } from 'react-native';
|
|
3
3
|
import { Image } from '../../Image';
|
|
4
4
|
import { Colors } from '../../Consts';
|
|
5
|
-
import { ApplicationContext } from '
|
|
5
|
+
import { ApplicationContext } from '../../Context';
|
|
6
6
|
|
|
7
7
|
type BackgroundImageViewProps = {
|
|
8
8
|
useShadowHeader: boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {Animated, StyleSheet, View} from 'react-native';
|
|
2
|
-
import {HeaderAnimatedProps} from '../types';
|
|
3
|
-
import React, {useContext} from 'react';
|
|
4
|
-
import {Image} from '../../Image';
|
|
5
|
-
import {MiniAppContext} from '
|
|
6
|
-
import {Colors} from '../../Consts';
|
|
1
|
+
import { Animated, StyleSheet, View } from 'react-native';
|
|
2
|
+
import { type HeaderAnimatedProps } from '../types';
|
|
3
|
+
import React, { useContext } from 'react';
|
|
4
|
+
import { Image } from '../../Image';
|
|
5
|
+
import { MiniAppContext } from '../../Context';
|
|
6
|
+
import { Colors } from '../../Consts';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* default header banner for header animated
|
|
@@ -38,9 +38,10 @@ const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
|
|
|
38
38
|
styles.container,
|
|
39
39
|
{
|
|
40
40
|
opacity: opacity,
|
|
41
|
-
transform: [{scale}, {translateY}],
|
|
41
|
+
transform: [{ scale }, { translateY }],
|
|
42
42
|
},
|
|
43
|
-
]}
|
|
43
|
+
]}
|
|
44
|
+
>
|
|
44
45
|
{children ?? (
|
|
45
46
|
<Image
|
|
46
47
|
source={{
|
|
@@ -63,7 +64,7 @@ const Verified: React.FC<any> = () => {
|
|
|
63
64
|
};
|
|
64
65
|
|
|
65
66
|
const styles = StyleSheet.create({
|
|
66
|
-
container: {width: '100%', aspectRatio: 16 / 9},
|
|
67
|
+
container: { width: '100%', aspectRatio: 16 / 9 },
|
|
67
68
|
verifiedDot: {
|
|
68
69
|
width: 4,
|
|
69
70
|
height: 4,
|
|
@@ -72,7 +73,7 @@ const styles = StyleSheet.create({
|
|
|
72
73
|
position: 'absolute',
|
|
73
74
|
alignSelf: 'center',
|
|
74
75
|
},
|
|
75
|
-
full: {width: '100%', height: '100%'},
|
|
76
|
+
full: { width: '100%', height: '100%' },
|
|
76
77
|
});
|
|
77
78
|
|
|
78
|
-
export {HeaderAnimated};
|
|
79
|
+
export { HeaderAnimated };
|
|
@@ -2,7 +2,7 @@ import LinearGradient from 'react-native-linear-gradient';
|
|
|
2
2
|
import { Animated, StyleSheet, View } from 'react-native';
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
4
|
import { HeaderBackgroundProps } from '../types';
|
|
5
|
-
import { ApplicationContext } from '
|
|
5
|
+
import { ApplicationContext } from '../../Context';
|
|
6
6
|
import { Styles } from '../../Consts';
|
|
7
7
|
import { Image } from '../../Image';
|
|
8
8
|
import BackgroundImageView from './BackgroundImageView';
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import React, {Ref, useContext, useEffect, useRef} from 'react';
|
|
1
|
+
import React, { Ref, useContext, useEffect, useRef } from 'react';
|
|
2
2
|
import LinearGradient from 'react-native-linear-gradient';
|
|
3
|
-
import {ApplicationContext, MiniAppContext} from '
|
|
4
|
-
import {Animated, Dimensions, Platform, StyleSheet, View} from 'react-native';
|
|
5
|
-
import {HeaderType} from '../../Layout/types';
|
|
6
|
-
import {InputRef, InputSearch} from '../../Input';
|
|
3
|
+
import { ApplicationContext, MiniAppContext } from '../../Context';
|
|
4
|
+
import { Animated, Dimensions, Platform, StyleSheet, View } from 'react-native';
|
|
5
|
+
import { HeaderType } from '../../Layout/types';
|
|
6
|
+
import { InputRef, InputSearch } from '../../Input';
|
|
7
7
|
import Navigation from '../Navigation';
|
|
8
|
-
import {Colors, Radius, Spacing} from '../../Consts';
|
|
9
|
-
import {Image} from '../../Image';
|
|
10
|
-
import {SearchHeaderProps} from '../types';
|
|
8
|
+
import { Colors, Radius, Spacing } from '../../Consts';
|
|
9
|
+
import { Image } from '../../Image';
|
|
10
|
+
import { SearchHeaderProps } from '../types';
|
|
11
11
|
import BackgroundImageView from './BackgroundImageView';
|
|
12
12
|
|
|
13
13
|
const SCREEN_PADDING = 12;
|
|
14
14
|
const BACK_WIDTH = 28;
|
|
15
15
|
|
|
16
|
-
const {width: screenWidth} = Dimensions.get('window');
|
|
16
|
+
const { width: screenWidth } = Dimensions.get('window');
|
|
17
17
|
const LinearGradientAnimated = Animated.createAnimatedComponent(LinearGradient);
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -42,7 +42,7 @@ const HeaderExtendHeader: React.FC<{
|
|
|
42
42
|
gradientColor: customGradientColor,
|
|
43
43
|
headerBackground: customBackground,
|
|
44
44
|
}) => {
|
|
45
|
-
const {theme} = useContext(ApplicationContext);
|
|
45
|
+
const { theme } = useContext(ApplicationContext);
|
|
46
46
|
const animated = useRef(new Animated.Value(0));
|
|
47
47
|
const gradientColor = customGradientColor ?? theme.colors.gradient;
|
|
48
48
|
const headerBackground = customBackground ?? theme.assets?.headerBackground;
|
|
@@ -60,7 +60,7 @@ const HeaderExtendHeader: React.FC<{
|
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
useEffect(() => {
|
|
63
|
-
const listener = animatedValue.addListener(({value}) => {
|
|
63
|
+
const listener = animatedValue.addListener(({ value }) => {
|
|
64
64
|
animated.current.setValue(value);
|
|
65
65
|
});
|
|
66
66
|
return () => {
|
|
@@ -95,8 +95,8 @@ const HeaderExtendHeader: React.FC<{
|
|
|
95
95
|
|
|
96
96
|
if (inputSearchProps) {
|
|
97
97
|
return (
|
|
98
|
-
<View style={{zIndex: 0}}>
|
|
99
|
-
<Animated.View style={{height: height}} />
|
|
98
|
+
<View style={{ zIndex: 0 }}>
|
|
99
|
+
<Animated.View style={{ height: height }} />
|
|
100
100
|
<BackgroundImageView
|
|
101
101
|
useShadowHeader={useShadowHeader}
|
|
102
102
|
heightHeader={heightHeader}
|
|
@@ -106,16 +106,18 @@ const HeaderExtendHeader: React.FC<{
|
|
|
106
106
|
<Animated.View
|
|
107
107
|
style={[
|
|
108
108
|
styles.headerBox,
|
|
109
|
-
{height: headerType === 'extended' ? height : heightHeader},
|
|
110
|
-
]}
|
|
109
|
+
{ height: headerType === 'extended' ? height : heightHeader },
|
|
110
|
+
]}
|
|
111
|
+
>
|
|
111
112
|
{!!gradientColor && (
|
|
112
113
|
<LinearGradientAnimated
|
|
113
114
|
colors={[gradientColor, gradientColor + '00']}
|
|
114
|
-
style={[styles.extendedHeader, {opacity: opacityGradient}]}
|
|
115
|
+
style={[styles.extendedHeader, { opacity: opacityGradient }]}
|
|
116
|
+
>
|
|
115
117
|
{!!theme.assets?.headerBackground && (
|
|
116
118
|
<Image
|
|
117
119
|
style={styles.headerBackground}
|
|
118
|
-
source={{uri: theme.assets?.headerBackground}}
|
|
120
|
+
source={{ uri: theme.assets?.headerBackground }}
|
|
119
121
|
loading={false}
|
|
120
122
|
/>
|
|
121
123
|
)}
|
|
@@ -128,10 +130,11 @@ const HeaderExtendHeader: React.FC<{
|
|
|
128
130
|
height,
|
|
129
131
|
position: 'absolute',
|
|
130
132
|
zIndex: 2,
|
|
131
|
-
}}
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
132
135
|
<Animated.View
|
|
133
136
|
style={{
|
|
134
|
-
transform: [{translateX}],
|
|
137
|
+
transform: [{ translateX }],
|
|
135
138
|
marginVertical: Spacing.S,
|
|
136
139
|
width: animated.current.interpolate({
|
|
137
140
|
inputRange: [0, 100],
|
|
@@ -141,8 +144,9 @@ const HeaderExtendHeader: React.FC<{
|
|
|
141
144
|
],
|
|
142
145
|
extrapolate: 'clamp',
|
|
143
146
|
}),
|
|
144
|
-
}}
|
|
145
|
-
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
<Animated.View style={{ backgroundColor, borderRadius: Radius.XL }}>
|
|
146
150
|
<InputSearch
|
|
147
151
|
{...inputSearchProps}
|
|
148
152
|
ref={inputSearchRef}
|
|
@@ -159,7 +163,7 @@ const HeaderExtendHeader: React.FC<{
|
|
|
159
163
|
|
|
160
164
|
if (headerType === 'extended') {
|
|
161
165
|
return (
|
|
162
|
-
<View style={{zIndex: 0}}>
|
|
166
|
+
<View style={{ zIndex: 0 }}>
|
|
163
167
|
<BackgroundImageView
|
|
164
168
|
useShadowHeader={useShadowHeader}
|
|
165
169
|
heightHeader={heightHeader}
|
|
@@ -169,17 +173,18 @@ const HeaderExtendHeader: React.FC<{
|
|
|
169
173
|
{!!gradientColor && (
|
|
170
174
|
<LinearGradientAnimated
|
|
171
175
|
colors={[gradientColor, gradientColor + '00']}
|
|
172
|
-
style={[styles.extendedHeader, {opacity: opacityGradient}]}
|
|
176
|
+
style={[styles.extendedHeader, { opacity: opacityGradient }]}
|
|
177
|
+
>
|
|
173
178
|
{!!headerBackground && (
|
|
174
179
|
<Image
|
|
175
180
|
style={styles.headerBackground}
|
|
176
|
-
source={{uri: headerBackground}}
|
|
181
|
+
source={{ uri: headerBackground }}
|
|
177
182
|
loading={false}
|
|
178
183
|
/>
|
|
179
184
|
)}
|
|
180
185
|
</LinearGradientAnimated>
|
|
181
186
|
)}
|
|
182
|
-
<View style={{height: heightHeader}} />
|
|
187
|
+
<View style={{ height: heightHeader }} />
|
|
183
188
|
<Verified />
|
|
184
189
|
</View>
|
|
185
190
|
);
|
|
@@ -223,4 +228,4 @@ const styles = StyleSheet.create({
|
|
|
223
228
|
},
|
|
224
229
|
});
|
|
225
230
|
|
|
226
|
-
export {HeaderExtendHeader};
|
|
231
|
+
export { HeaderExtendHeader };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BackHandler, StyleSheet, View } from 'react-native';
|
|
2
2
|
import { HeaderBackProps } from '../types';
|
|
3
3
|
import React, { useCallback, useContext, useEffect } from 'react';
|
|
4
|
-
import { ApplicationContext, MiniAppContext } from '
|
|
4
|
+
import { ApplicationContext, MiniAppContext } from '../../Context';
|
|
5
5
|
import { PopupNotify } from '../../Popup';
|
|
6
6
|
import { NavigationButton } from './NavigationButton';
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {useCallback, useContext, useEffect, useState} from 'react';
|
|
1
|
+
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Platform,
|
|
4
4
|
StyleSheet,
|
|
@@ -6,12 +6,13 @@ import {
|
|
|
6
6
|
View,
|
|
7
7
|
ViewStyle,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
9
|
+
import { NavigationButton } from './NavigationButton';
|
|
10
|
+
import { ApplicationContext, MiniAppContext } from '../../Context';
|
|
11
|
+
import { Colors, Spacing, Styles } from '../../Consts';
|
|
12
|
+
import { PopupNotify } from '../../Popup';
|
|
13
|
+
import { Tool, ToolGroup } from '../types';
|
|
14
|
+
import { Icon } from '../../Icon';
|
|
15
|
+
import { scaleSize, Text } from '../../Text';
|
|
15
16
|
|
|
16
17
|
const DID_SYNC_NEW_HOME = 'did_sync_new_home';
|
|
17
18
|
|
|
@@ -19,9 +20,9 @@ const DID_SYNC_NEW_HOME = 'did_sync_new_home';
|
|
|
19
20
|
* main component for header right
|
|
20
21
|
*/
|
|
21
22
|
const HeaderRight: React.FC<any> = props => {
|
|
22
|
-
const {translate} = useContext(ApplicationContext);
|
|
23
|
-
const {headerRight = {}} = props;
|
|
24
|
-
const {useOnBoarding = false, buttonOnBoarding, onPress} = headerRight;
|
|
23
|
+
const { translate } = useContext(ApplicationContext);
|
|
24
|
+
const { headerRight = {} } = props;
|
|
25
|
+
const { useOnBoarding = false, buttonOnBoarding, onPress } = headerRight;
|
|
25
26
|
|
|
26
27
|
if (typeof props.headerRight === 'function') {
|
|
27
28
|
return props.headerRight(props);
|
|
@@ -57,7 +58,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
57
58
|
tools = [],
|
|
58
59
|
useCloseIcon = false,
|
|
59
60
|
}) => {
|
|
60
|
-
const {navigator} = useContext(ApplicationContext);
|
|
61
|
+
const { navigator } = useContext(ApplicationContext);
|
|
61
62
|
const context = useContext<any>(MiniAppContext);
|
|
62
63
|
|
|
63
64
|
const [isFavorite, setIsFavorite] = useState<boolean>(false);
|
|
@@ -71,7 +72,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
71
72
|
() =>
|
|
72
73
|
navigator?.maxApi?.dispatchFunction?.(
|
|
73
74
|
'isFavoriteApp',
|
|
74
|
-
{code: context?.code},
|
|
75
|
+
{ code: context?.code },
|
|
75
76
|
(result: boolean) => {
|
|
76
77
|
setIsFavorite(result);
|
|
77
78
|
},
|
|
@@ -109,7 +110,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
109
110
|
navigator?.maxApi?.dispatchFunction?.(
|
|
110
111
|
'dismiss',
|
|
111
112
|
navigator?.dismissData,
|
|
112
|
-
undefined
|
|
113
|
+
undefined,
|
|
113
114
|
);
|
|
114
115
|
} else {
|
|
115
116
|
navigator?.maxApi?.dispatchFunction?.('dismissAll');
|
|
@@ -169,7 +170,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
169
170
|
},
|
|
170
171
|
context,
|
|
171
172
|
},
|
|
172
|
-
({success}: {success: boolean}) => {
|
|
173
|
+
({ success }: { success: boolean }) => {
|
|
173
174
|
if (success) {
|
|
174
175
|
setIsFavorite(expected);
|
|
175
176
|
}
|
|
@@ -279,24 +280,27 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
279
280
|
{
|
|
280
281
|
width: context.appId !== 'vn.momo.helpcenter' ? 65 : 28,
|
|
281
282
|
},
|
|
282
|
-
]}
|
|
283
|
+
]}
|
|
284
|
+
>
|
|
283
285
|
{context.appId !== 'vn.momo.helpcenter' && (
|
|
284
286
|
<>
|
|
285
287
|
<TouchableOpacity
|
|
286
288
|
accessibilityLabel={'btn_navigation_help_center'}
|
|
287
289
|
style={styles.toolkitButton}
|
|
288
290
|
onPress={onPressHelpCenter}
|
|
289
|
-
hitSlop={{top: 7, bottom: 7, left: 7, right: 0}}
|
|
291
|
+
hitSlop={{ top: 7, bottom: 7, left: 7, right: 0 }}
|
|
292
|
+
>
|
|
290
293
|
<Icon color={tintColor} source={'help_center'} size={20} />
|
|
291
294
|
</TouchableOpacity>
|
|
292
|
-
<View style={[styles.divider, {backgroundColor: tintColor}]} />
|
|
295
|
+
<View style={[styles.divider, { backgroundColor: tintColor }]} />
|
|
293
296
|
</>
|
|
294
297
|
)}
|
|
295
298
|
<TouchableOpacity
|
|
296
299
|
accessibilityLabel={'btn_navigation_close'}
|
|
297
300
|
onPress={onClose}
|
|
298
301
|
style={styles.toolkitButton}
|
|
299
|
-
hitSlop={{top: 7, bottom: 7, left: 0, right: 7}}
|
|
302
|
+
hitSlop={{ top: 7, bottom: 7, left: 0, right: 7 }}
|
|
303
|
+
>
|
|
300
304
|
<Icon
|
|
301
305
|
color={tintColor}
|
|
302
306
|
source={
|
|
@@ -359,7 +363,7 @@ const styles = StyleSheet.create({
|
|
|
359
363
|
borderWidth: 2,
|
|
360
364
|
borderColor: Colors.black_01,
|
|
361
365
|
},
|
|
362
|
-
headerButton: {paddingHorizontal: 4},
|
|
366
|
+
headerButton: { paddingHorizontal: 4 },
|
|
363
367
|
headerRightButton: {
|
|
364
368
|
flexDirection: 'row',
|
|
365
369
|
justifyContent: 'center',
|
|
@@ -454,4 +458,4 @@ const styles = StyleSheet.create({
|
|
|
454
458
|
},
|
|
455
459
|
});
|
|
456
460
|
|
|
457
|
-
export {HeaderRight};
|
|
461
|
+
export { HeaderRight };
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
TouchableOpacity,
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
import { ApplicationContext, MiniAppContext } from '
|
|
9
|
+
import { ApplicationContext, MiniAppContext } from '../../Context';
|
|
10
10
|
import { exportFontFamily, scaleSize, Text } from '../../Text';
|
|
11
11
|
import { Colors, Radius, Spacing, Styles } from '../../Consts';
|
|
12
12
|
import {
|
|
@@ -96,7 +96,11 @@ const TitleUser: React.FC<TitleUserProps> = ({
|
|
|
96
96
|
switch (image.length) {
|
|
97
97
|
case 1: {
|
|
98
98
|
return image.map((i: string) => (
|
|
99
|
-
<Image
|
|
99
|
+
<Image
|
|
100
|
+
key={`avatar-${i}`}
|
|
101
|
+
source={{ uri: i }}
|
|
102
|
+
style={styles.circle}
|
|
103
|
+
/>
|
|
100
104
|
));
|
|
101
105
|
}
|
|
102
106
|
case 2: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {NavigationButtonProps} from '../types';
|
|
2
|
-
import React, {useContext} from 'react';
|
|
3
|
-
import {ApplicationContext, MiniAppContext} from '
|
|
4
|
-
import {StyleSheet, TouchableOpacity, View, ViewStyle} from 'react-native';
|
|
5
|
-
import {Colors, Spacing} from '../../Consts';
|
|
6
|
-
import {Icon} from '../../Icon';
|
|
7
|
-
import {BadgeDot} from '../../Badge';
|
|
1
|
+
import { NavigationButtonProps } from '../types';
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import { ApplicationContext, MiniAppContext } from '../../Context';
|
|
4
|
+
import { StyleSheet, TouchableOpacity, View, ViewStyle } from 'react-native';
|
|
5
|
+
import { Colors, Spacing } from '../../Consts';
|
|
6
|
+
import { Icon } from '../../Icon';
|
|
7
|
+
import { BadgeDot } from '../../Badge';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* default navigation button used header nav
|
|
@@ -15,7 +15,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
15
15
|
showBadge = false,
|
|
16
16
|
...props
|
|
17
17
|
}) => {
|
|
18
|
-
const {theme} = useContext(ApplicationContext);
|
|
18
|
+
const { theme } = useContext(ApplicationContext);
|
|
19
19
|
let buttonStyle: ViewStyle = {};
|
|
20
20
|
if (tintColor === Colors.black_01) {
|
|
21
21
|
buttonStyle = {
|
|
@@ -25,11 +25,12 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
<View style={{width: 28}}>
|
|
28
|
+
<View style={{ width: 28 }}>
|
|
29
29
|
<TouchableOpacity
|
|
30
30
|
{...props}
|
|
31
31
|
style={[styles.navigationButton, buttonStyle]}
|
|
32
|
-
hitSlop={{top: 7, bottom: 7, left: 7, right: 7}}
|
|
32
|
+
hitSlop={{ top: 7, bottom: 7, left: 7, right: 7 }}
|
|
33
|
+
>
|
|
33
34
|
<Icon
|
|
34
35
|
source={icon}
|
|
35
36
|
color={tintColor ?? theme.colors.text.default}
|
|
@@ -81,4 +82,4 @@ const styles = StyleSheet.create({
|
|
|
81
82
|
},
|
|
82
83
|
});
|
|
83
84
|
|
|
84
|
-
export {NavigationButton};
|
|
85
|
+
export { NavigationButton };
|
|
@@ -3,7 +3,7 @@ import { InputRef, InputSearch } from '../../Input';
|
|
|
3
3
|
import { Animated, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
4
4
|
import React, { useContext, useEffect, useRef } from 'react';
|
|
5
5
|
import { SearchHeaderProps } from '../types';
|
|
6
|
-
import { ApplicationContext, MiniAppContext } from '
|
|
6
|
+
import { ApplicationContext, MiniAppContext } from '../../Context';
|
|
7
7
|
import { Text } from '../../Text';
|
|
8
8
|
|
|
9
9
|
const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
Modal as ModalRN,
|
|
11
11
|
} from 'react-native';
|
|
12
12
|
|
|
13
|
-
import { ApplicationContext, MiniAppContext } from '
|
|
13
|
+
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
14
14
|
import { Styles } from '../Consts';
|
|
15
15
|
import Navigation from './Navigation';
|
|
16
16
|
import { ModalParams } from './types';
|
|
@@ -18,15 +18,13 @@ import ModalScreen from './ModalScreen';
|
|
|
18
18
|
import Navigator from './Navigator';
|
|
19
19
|
import { getModalOptions, getStackOptions } from './utils';
|
|
20
20
|
import { NavigationContainerProps } from './types';
|
|
21
|
-
import {
|
|
22
|
-
ApplicationContext,
|
|
23
|
-
HeaderBackground,
|
|
24
|
-
HeaderTitle,
|
|
25
|
-
MiniAppContext,
|
|
26
|
-
} from './index';
|
|
21
|
+
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
27
22
|
import Localize from './Localize';
|
|
28
23
|
import { Colors, defaultTheme } from '../Consts';
|
|
29
|
-
import { HeaderLeft
|
|
24
|
+
import { HeaderLeft } from './Components/HeaderLeft';
|
|
25
|
+
import { HeaderRight } from './Components/HeaderRight';
|
|
26
|
+
import { HeaderTitle } from './Components/HeaderTitle';
|
|
27
|
+
import { HeaderBackground } from './Components/HeaderBackground';
|
|
30
28
|
|
|
31
29
|
const Stack = createStackNavigator();
|
|
32
30
|
|