@momo-kits/foundation 0.150.2-phuc.13 → 0.150.2-scaleSize.35
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 +39 -114
- 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 +82 -87
- 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 +2 -2
- package/Application/Components/HeaderRight.tsx +24 -20
- package/Application/Components/HeaderTitle.tsx +19 -7
- package/Application/Components/NavigationButton.tsx +12 -11
- package/Application/Components/SearchHeader.tsx +20 -3
- package/Application/ModalScreen.tsx +14 -1
- package/Application/NavigationContainer.tsx +13 -7
- package/Application/StackScreen.tsx +100 -155
- package/Application/WidgetContainer.tsx +1 -1
- package/Application/index.ts +12 -31
- package/Application/types.ts +66 -18
- package/Application/utils.tsx +41 -17
- package/Assets/language.json +6 -2
- package/Assets/lottie_circle_loader.json +1 -0
- package/Badge/Badge.tsx +14 -11
- package/Badge/BadgeRibbon.tsx +1 -1
- package/Button/index.tsx +47 -32
- package/CheckBox/index.tsx +23 -19
- package/CheckBox/styles.ts +1 -0
- package/Context/index.ts +23 -0
- package/Divider/DashDivider.tsx +10 -9
- package/Divider/index.tsx +7 -7
- package/FoundationList/index.tsx +7 -4
- package/Icon/index.tsx +9 -9
- package/IconButton/index.tsx +12 -10
- package/Image/index.tsx +9 -2
- package/Input/Input.tsx +3 -5
- package/Input/InputDropDown.tsx +31 -23
- package/Input/InputMoney.tsx +3 -5
- package/Input/InputOTP.tsx +7 -7
- package/Input/InputPhoneNumber.tsx +271 -0
- package/Input/InputSearch.tsx +3 -5
- package/Input/InputTextArea.tsx +2 -1
- package/Input/TextTyping.tsx +8 -2
- package/Input/common.tsx +31 -24
- package/Input/index.tsx +21 -1
- package/Input/styles.ts +17 -12
- package/Input/utils.ts +42 -1
- package/Layout/Card.tsx +4 -3
- package/Layout/FloatingButton.tsx +1 -1
- package/Layout/GridSystem.tsx +15 -14
- package/Layout/Item.tsx +1 -1
- package/Layout/Screen.tsx +8 -5
- 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 +4 -4
- package/Text/styles.ts +37 -36
- package/Text/types.ts +1 -0
- package/Text/utils.ts +33 -4
- package/Title/index.tsx +48 -29
- package/index.ts +1 -0
- package/package.json +35 -34
- package/Application/Components/index.ts +0 -7
|
@@ -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
|
|
|
@@ -86,7 +86,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
86
86
|
|
|
87
87
|
const styles = StyleSheet.create({
|
|
88
88
|
headerLeft: {
|
|
89
|
-
marginLeft:
|
|
89
|
+
marginLeft: 8,
|
|
90
90
|
},
|
|
91
91
|
});
|
|
92
92
|
|
|
@@ -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 {
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import { Image } from '../../Image';
|
|
18
18
|
import { Icon } from '../../Icon';
|
|
19
19
|
import { Skeleton } from '../../Skeleton';
|
|
20
|
+
import { useScaleSize } from '../../Text/utils.ts';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* default header title used for nav
|
|
@@ -31,13 +32,23 @@ const HeaderTitle: React.FC<any> = props => {
|
|
|
31
32
|
);
|
|
32
33
|
|
|
33
34
|
return (
|
|
34
|
-
<View
|
|
35
|
+
<View
|
|
36
|
+
pointerEvents={'none'}
|
|
37
|
+
style={[
|
|
38
|
+
styles.headerTitleContainer,
|
|
39
|
+
{
|
|
40
|
+
maxWidth: Dimensions.get('window').width - useScaleSize(172),
|
|
41
|
+
},
|
|
42
|
+
]}
|
|
43
|
+
>
|
|
35
44
|
<Animated.Text
|
|
36
45
|
{...props}
|
|
37
46
|
accessibilityLabel={'title_navigation_header'}
|
|
38
47
|
style={[
|
|
39
48
|
styles.title,
|
|
40
49
|
{
|
|
50
|
+
fontSize: useScaleSize(15),
|
|
51
|
+
lineHeight: useScaleSize(22),
|
|
41
52
|
fontFamily: exportFontFamily('bold', 'action_xs_bold'),
|
|
42
53
|
opacity,
|
|
43
54
|
color: props.tintColor,
|
|
@@ -83,7 +94,7 @@ const TitleUser: React.FC<TitleUserProps> = ({
|
|
|
83
94
|
isLoading,
|
|
84
95
|
}) => {
|
|
85
96
|
const { theme } = useContext(ApplicationContext);
|
|
86
|
-
const maxWidth = Dimensions.get('window').width -
|
|
97
|
+
const maxWidth = Dimensions.get('window').width - useScaleSize(172);
|
|
87
98
|
const getShortName = (name: string) => {
|
|
88
99
|
const words = name.split(' ');
|
|
89
100
|
const lastTwoWords = words.slice(-2);
|
|
@@ -96,7 +107,11 @@ const TitleUser: React.FC<TitleUserProps> = ({
|
|
|
96
107
|
switch (image.length) {
|
|
97
108
|
case 1: {
|
|
98
109
|
return image.map((i: string) => (
|
|
99
|
-
<Image
|
|
110
|
+
<Image
|
|
111
|
+
key={`avatar-${i}`}
|
|
112
|
+
source={{ uri: i }}
|
|
113
|
+
style={styles.circle}
|
|
114
|
+
/>
|
|
100
115
|
));
|
|
101
116
|
}
|
|
102
117
|
case 2: {
|
|
@@ -498,8 +513,6 @@ const Verified: React.FC<any> = () => {
|
|
|
498
513
|
|
|
499
514
|
const styles = StyleSheet.create({
|
|
500
515
|
title: {
|
|
501
|
-
fontSize: scaleSize(15),
|
|
502
|
-
lineHeight: scaleSize(22),
|
|
503
516
|
fontWeight: 'bold',
|
|
504
517
|
},
|
|
505
518
|
rowJourney: { flexDirection: 'row', width: '100%', alignItems: 'flex-start' },
|
|
@@ -513,7 +526,6 @@ const styles = StyleSheet.create({
|
|
|
513
526
|
},
|
|
514
527
|
headerTitleContainer: {
|
|
515
528
|
justifyContent: 'center',
|
|
516
|
-
maxWidth: Dimensions.get('window').width - scaleSize(172),
|
|
517
529
|
},
|
|
518
530
|
circle: {
|
|
519
531
|
width: 32,
|
|
@@ -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 };
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { Radius, Spacing, Styles } from '../../Consts';
|
|
2
2
|
import { InputRef, InputSearch } from '../../Input';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Animated,
|
|
5
|
+
Dimensions,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
View,
|
|
9
|
+
} from 'react-native';
|
|
4
10
|
import React, { useContext, useEffect, useRef } from 'react';
|
|
5
11
|
import { SearchHeaderProps } from '../types';
|
|
6
|
-
import { ApplicationContext, MiniAppContext } from '
|
|
12
|
+
import { ApplicationContext, MiniAppContext } from '../../Context';
|
|
7
13
|
import { Text } from '../../Text';
|
|
8
14
|
|
|
9
15
|
const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
|
|
@@ -19,8 +25,12 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
|
|
|
19
25
|
) => {
|
|
20
26
|
const { theme, navigator } = useContext(ApplicationContext);
|
|
21
27
|
const context = useContext<any>(MiniAppContext);
|
|
28
|
+
const BACK_WIDTH = 28;
|
|
29
|
+
const { width: screenWidth } = Dimensions.get('window');
|
|
22
30
|
|
|
23
31
|
const animated = useRef(new Animated.Value(0));
|
|
32
|
+
const leftPosition = props?.leftPosition || BACK_WIDTH + 20;
|
|
33
|
+
const headerRightWidth = props?.headerRightWidth || 73;
|
|
24
34
|
|
|
25
35
|
useEffect(() => {
|
|
26
36
|
const listener = animatedValue?.addListener(({ value }) => {
|
|
@@ -69,7 +79,14 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
|
|
|
69
79
|
|
|
70
80
|
return (
|
|
71
81
|
<View style={styles.container}>
|
|
72
|
-
<View
|
|
82
|
+
<View
|
|
83
|
+
style={[
|
|
84
|
+
Styles.flex,
|
|
85
|
+
renderButtons && {
|
|
86
|
+
maxWidth: screenWidth - leftPosition - 12 - headerRightWidth,
|
|
87
|
+
},
|
|
88
|
+
]}
|
|
89
|
+
>
|
|
73
90
|
<Animated.View style={{ backgroundColor, borderRadius: Radius.XL }}>
|
|
74
91
|
<InputSearch
|
|
75
92
|
ref={ref}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
Modal as ModalRN,
|
|
11
11
|
} from 'react-native';
|
|
12
12
|
|
|
13
|
-
import { ApplicationContext } 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,6 +18,18 @@ import BottomSheet from './BottomSheet';
|
|
|
18
18
|
import { runOnJS } from 'react-native-reanimated';
|
|
19
19
|
|
|
20
20
|
const ModalScreen: React.FC<any> = props => {
|
|
21
|
+
const context: any = useContext(MiniAppContext);
|
|
22
|
+
const { navigator } = useContext(ApplicationContext);
|
|
23
|
+
|
|
24
|
+
useEffect(
|
|
25
|
+
() => {
|
|
26
|
+
if (context?.enableHapticDialog) {
|
|
27
|
+
navigator?.maxApi?.triggerEventVibration?.('light');
|
|
28
|
+
}
|
|
29
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
+
[],
|
|
31
|
+
);
|
|
32
|
+
|
|
21
33
|
if (props.route?.params?.isBottomSheet) {
|
|
22
34
|
return <BottomSheet {...props} />;
|
|
23
35
|
}
|
|
@@ -95,6 +107,7 @@ const Modal: React.FC<ModalParams> = props => {
|
|
|
95
107
|
visible={true}
|
|
96
108
|
onRequestClose={onDismiss}
|
|
97
109
|
style={StyleSheet.absoluteFillObject}
|
|
110
|
+
isModalKit={true}
|
|
98
111
|
>
|
|
99
112
|
<KeyboardAvoidingView
|
|
100
113
|
style={Styles.flexCenter}
|
|
@@ -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
|
|
|
@@ -37,6 +35,13 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
37
35
|
maxApi,
|
|
38
36
|
initialParams,
|
|
39
37
|
localize = new Localize({ vi: {}, en: {} }),
|
|
38
|
+
features = {
|
|
39
|
+
enableBottomTabAnimation: true,
|
|
40
|
+
enableHapticDialog: true,
|
|
41
|
+
enableForceFoundationList: false,
|
|
42
|
+
enableHapticBottomTab: true,
|
|
43
|
+
scaleSizeMaxRate: 1,
|
|
44
|
+
},
|
|
40
45
|
}) => {
|
|
41
46
|
const context = useContext<any>(MiniAppContext);
|
|
42
47
|
const [currentContext, setCurrentContext] = useState({});
|
|
@@ -46,6 +51,7 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
46
51
|
value={{
|
|
47
52
|
...context,
|
|
48
53
|
...currentContext,
|
|
54
|
+
features,
|
|
49
55
|
}}
|
|
50
56
|
>
|
|
51
57
|
<Navigation
|