@momo-kits/foundation 0.111.1-beta.21 → 0.111.1-beta.23

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.
@@ -1,8 +1,6 @@
1
1
  import React, {useCallback, useContext, useEffect, useRef} from 'react';
2
2
  import {
3
- Animated,
4
3
  Dimensions,
5
- Easing,
6
4
  KeyboardAvoidingView,
7
5
  Modal,
8
6
  PanResponder,
@@ -19,6 +17,7 @@ import {Colors, Radius, Spacing, Styles} from '../Consts';
19
17
  import {Text} from '../Text';
20
18
  import {Icon} from '../Icon';
21
19
  import {useHeaderHeight} from '@react-navigation/stack';
20
+ import Animated, {Easing, Extrapolate} from 'react-native-reanimated';
22
21
 
23
22
  const BottomSheet: React.FC<BottomSheetParams> = props => {
24
23
  const {theme, navigator} = useContext(ApplicationContext);
@@ -40,37 +39,46 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
40
39
  keyboardVerticalOffset,
41
40
  }: BottomSheetParams = props.route.params;
42
41
 
43
- const pan = useRef(
44
- new Animated.ValueXY({
45
- y: heightDevice,
46
- x: 0,
47
- })
48
- ).current;
49
-
50
42
  const customEasingOpen = Easing.bezier(0.05, 0.7, 0.1, 1);
51
43
  const customEasingClose = Easing.bezier(0.3, 0.0, 0.8, 0.15);
52
44
 
45
+ const translateY = useRef(new Animated.Value(heightDevice)).current;
46
+
47
+ const openAnimation = Animated.timing(translateY, {
48
+ toValue: 0,
49
+ duration: 350,
50
+ easing: customEasingOpen,
51
+ });
52
+
53
+ const closeAnimation = Animated.timing(translateY, {
54
+ toValue: heightDevice,
55
+ duration: 200,
56
+ easing: customEasingClose,
57
+ });
58
+
53
59
  const panResponder = useRef(
54
60
  PanResponder.create({
55
61
  onStartShouldSetPanResponder: () => draggable,
56
- onMoveShouldSetPanResponder: (_, gestureState) => {
57
- return draggable && gestureState.dy > 0;
58
- },
59
- onPanResponderMove: (e, gestureState) => {
60
- gestureState.dy > 0 &&
61
- Animated.event([null, {dy: pan.y}], {useNativeDriver: false})(
62
- e,
63
- gestureState
64
- );
62
+ onMoveShouldSetPanResponder: (_, gestureState) =>
63
+ draggable && gestureState.dy > 0,
64
+ onPanResponderMove: (_, gestureState) => {
65
+ if (gestureState.dy > 0) {
66
+ translateY.setValue(gestureState.dy);
67
+ }
65
68
  },
66
69
  onPanResponderRelease: (_, gestureState) => {
67
70
  if (gestureState.dy > 100) {
68
71
  action.current = 'gesture';
69
72
  onDismiss();
70
73
  } else {
71
- Animated.spring(pan, {
72
- toValue: {x: 0, y: 0},
73
- useNativeDriver: false,
74
+ Animated.spring(translateY, {
75
+ toValue: 0,
76
+ damping: 20,
77
+ mass: 1,
78
+ stiffness: 100,
79
+ overshootClamping: false,
80
+ restSpeedThreshold: 0.001,
81
+ restDisplacementThreshold: 0.001,
74
82
  }).start();
75
83
  }
76
84
  },
@@ -90,13 +98,8 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
90
98
  * emit dismiss event
91
99
  */
92
100
  useEffect(() => {
93
- Animated.timing(pan, {
94
- toValue: {x: 0, y: 0},
95
- useNativeDriver: false,
96
- easing: customEasingOpen,
97
- duration: 350,
98
- }).start();
99
-
101
+ translateY.setValue(heightDevice);
102
+ openAnimation.start();
100
103
  return () => {
101
104
  props.route.params?.onDismiss?.(action.current);
102
105
  };
@@ -109,16 +112,11 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
109
112
  if (barrierDismissible && !force) {
110
113
  return;
111
114
  }
112
- setTimeout(() => {
113
- callback?.();
114
- }, 300);
115
- Animated.timing(pan, {
116
- toValue: {x: 0, y: heightDevice},
117
- useNativeDriver: false,
118
- easing: customEasingClose,
119
- duration: 200,
120
- }).start(() => {
121
- navigator?.pop();
115
+ closeAnimation.start(() => {
116
+ setImmediate(() => {
117
+ navigator?.pop();
118
+ callback?.();
119
+ });
122
120
  });
123
121
  };
124
122
 
@@ -205,10 +203,10 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
205
203
  style={[
206
204
  styles.overlay,
207
205
  {
208
- opacity: pan.y.interpolate({
206
+ opacity: translateY.interpolate({
209
207
  inputRange: [0, heightDevice],
210
208
  outputRange: [1, 0],
211
- extrapolate: 'clamp',
209
+ extrapolate: Extrapolate.CLAMP,
212
210
  }),
213
211
  },
214
212
  ]}
@@ -217,7 +215,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
217
215
 
218
216
  <Animated.View
219
217
  style={{
220
- transform: pan.getTranslateTransform(),
218
+ transform: [{translateY}],
221
219
  }}>
222
220
  {renderHeader()}
223
221
  <View style={{backgroundColor: backgroundColor}}>
@@ -1,8 +1,8 @@
1
1
  import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
2
2
  import {NavigationContainer} from '@react-navigation/native';
3
3
  import {createStackNavigator} from '@react-navigation/stack';
4
- import React, {useContext, useEffect, useState} from 'react';
5
- import {Animated, Dimensions, Platform, StatusBar} from 'react-native';
4
+ import React, {useContext, useEffect} from 'react';
5
+ import {Platform, StatusBar} from 'react-native';
6
6
  import {EventArg} from '@react-navigation/core';
7
7
  import {useSafeAreaInsets} from 'react-native-safe-area-context';
8
8
  import {Colors} from '../../Consts';
@@ -17,38 +17,7 @@ import BottomTabBar from './BottomTabBar';
17
17
  const Tab = createBottomTabNavigator();
18
18
  const Stack = createStackNavigator();
19
19
 
20
- const AnimatedTabView = (props: any, {isPressed = false}) => {
21
- const widthDevice = Dimensions.get('window').width / 2;
22
- const translateAnim = React.useRef(new Animated.Value(widthDevice)).current;
23
-
24
- useEffect(() => {
25
- Animated.timing(translateAnim, {
26
- toValue: 0,
27
- duration: 200,
28
- useNativeDriver: true,
29
- }).start();
30
- return () => {
31
- Animated.timing(translateAnim, {
32
- toValue: 1,
33
- duration: 200,
34
- useNativeDriver: true,
35
- }).start();
36
- };
37
- }, [isPressed]);
38
-
39
- return (
40
- <Animated.View
41
- style={{
42
- flex: 1,
43
- backgroundColor: 'transparent',
44
- transform: [{translateX: translateAnim}],
45
- }}>
46
- {props.children}
47
- </Animated.View>
48
- );
49
- };
50
-
51
- const TabScreen: React.FC<NavigationScreenProps> = ({route, isPressed}) => {
20
+ const TabScreen: React.FC<NavigationScreenProps> = ({route}) => {
52
21
  let options = {};
53
22
  if (route.params?.options) {
54
23
  options = getOptions(route.params?.options);
@@ -65,9 +34,7 @@ const TabScreen: React.FC<NavigationScreenProps> = ({route, isPressed}) => {
65
34
  options,
66
35
  initialParams: route.params?.initialParams,
67
36
  }}
68
- options={{
69
- ...getStackOptions(),
70
- }}
37
+ options={{...getStackOptions()}}
71
38
  />
72
39
  </Stack.Navigator>
73
40
  );
@@ -77,21 +44,13 @@ const TabScreen: React.FC<NavigationScreenProps> = ({route, isPressed}) => {
77
44
  <Stack.Navigator>
78
45
  <Stack.Screen
79
46
  name="Stack"
80
- component={props => (
81
- <AnimatedTabView isPressed={isPressed}>
82
- <StackScreen {...props} />
83
- </AnimatedTabView>
84
- )}
47
+ component={StackScreen}
85
48
  initialParams={{
86
49
  screen: route.params?.screen,
87
50
  options,
88
51
  initialParams: route.params?.initialParams,
89
52
  }}
90
- options={{
91
- ...getStackOptions(),
92
- cardStyle: {backgroundColor: 'transparent'},
93
- ...route.params?.options,
94
- }}
53
+ options={{...getStackOptions(), ...route.params?.options}}
95
54
  />
96
55
  </Stack.Navigator>
97
56
  </NavigationContainer>
@@ -109,8 +68,6 @@ const BottomTab: React.FC<BottomTabProps> = ({
109
68
  const {theme} = useContext(ApplicationContext);
110
69
  const insets = useSafeAreaInsets();
111
70
 
112
- const [isPressed, setIsPressed] = useState(false);
113
-
114
71
  useEffect(() => {
115
72
  navigation?.setOptions({
116
73
  headerShown: false,
@@ -126,7 +83,6 @@ const BottomTab: React.FC<BottomTabProps> = ({
126
83
  } = {
127
84
  tabPress: e => {
128
85
  listeners?.tabPress?.(e);
129
- setIsPressed(true);
130
86
  },
131
87
  focus: e => {
132
88
  StatusBar.setBarStyle('dark-content', true);
@@ -141,9 +97,6 @@ const BottomTab: React.FC<BottomTabProps> = ({
141
97
  <Tab.Navigator
142
98
  initialRouteName={initialRouteName}
143
99
  backBehavior={'firstRoute'}
144
- sceneContainerStyle={{
145
- backgroundColor: 'transparent',
146
- }}
147
100
  tabBar={props => (
148
101
  <BottomTabBar
149
102
  {...props}
@@ -168,7 +121,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
168
121
  <Tab.Screen
169
122
  key={item.name}
170
123
  name={item.name}
171
- component={props => <TabScreen {...props} isPressed={isPressed} />}
124
+ component={TabScreen}
172
125
  initialParams={{...item, nested}}
173
126
  listeners={handler}
174
127
  options={{
@@ -0,0 +1,122 @@
1
+ import React, {FC, useContext} from 'react';
2
+ import {Animated, Platform, StyleSheet} from 'react-native';
3
+ import {Image} from '../../Image';
4
+ import {Colors} from '../../Consts';
5
+ import {ApplicationContext} from '@momo-kits/foundation';
6
+ import AnimatedInterpolation = Animated.AnimatedInterpolation;
7
+
8
+ type BackgroundImageViewProps = {
9
+ useShadowHeader: boolean;
10
+ headerBackground?: string;
11
+ heightHeader: number | string;
12
+ opacityBackground: AnimatedInterpolation;
13
+ };
14
+
15
+ const BackgroundImageView: FC<BackgroundImageViewProps> = ({
16
+ useShadowHeader = true,
17
+ headerBackground = null,
18
+ heightHeader,
19
+ opacityBackground,
20
+ }) => {
21
+ const {theme} = useContext(ApplicationContext);
22
+ if (Platform.OS === 'android') {
23
+ return (
24
+ <Animated.View
25
+ style={[
26
+ useShadowHeader ? styles.shadowHeader : styles.dividerHeader,
27
+ {
28
+ position: 'absolute',
29
+ width: '100%',
30
+ zIndex: 1,
31
+ height: heightHeader,
32
+ backgroundColor: theme.colors.background.surface,
33
+ opacity: opacityBackground,
34
+ overflow: 'hidden',
35
+ },
36
+ ]}>
37
+ {headerBackground && (
38
+ <Image
39
+ style={styles.headerBackground}
40
+ source={{uri: headerBackground}}
41
+ loading={false}
42
+ />
43
+ )}
44
+ </Animated.View>
45
+ );
46
+ }
47
+
48
+ return (
49
+ <>
50
+ <Animated.View
51
+ style={[
52
+ useShadowHeader ? styles.shadowHeader : styles.dividerHeader,
53
+ {
54
+ position: 'absolute',
55
+ width: '100%',
56
+ zIndex: 1,
57
+ height: heightHeader,
58
+ backgroundColor: theme.colors.background.surface,
59
+ opacity: opacityBackground,
60
+ },
61
+ ]}
62
+ />
63
+ <Animated.View
64
+ style={[
65
+ {
66
+ position: 'absolute',
67
+ width: '100%',
68
+ zIndex: 1,
69
+ height: heightHeader,
70
+ opacity: opacityBackground,
71
+ overflow: 'hidden',
72
+ },
73
+ ]}>
74
+ {headerBackground && (
75
+ <Image
76
+ style={styles.headerBackground}
77
+ source={{uri: headerBackground}}
78
+ loading={false}
79
+ />
80
+ )}
81
+ </Animated.View>
82
+ </>
83
+ );
84
+ };
85
+
86
+ export default BackgroundImageView;
87
+
88
+ const styles = StyleSheet.create({
89
+ headerBackground: {
90
+ width: '100%',
91
+ height: undefined,
92
+ position: 'absolute',
93
+ aspectRatio: 375 / 154,
94
+ },
95
+ dividerHeader: {
96
+ borderBottomWidth: 1,
97
+ borderColor: Colors.black_04,
98
+ },
99
+ shadowHeader: {
100
+ ...Platform.select({
101
+ ios: {
102
+ shadowColor: Colors.black_20,
103
+ shadowOffset: {
104
+ width: 3,
105
+ height: 3,
106
+ },
107
+ shadowOpacity: 0.12,
108
+ shadowRadius: 10,
109
+ },
110
+ android: {
111
+ shadowColor: Colors.black_17,
112
+ shadowOffset: {
113
+ width: 3,
114
+ height: 3,
115
+ },
116
+ shadowOpacity: 0.12,
117
+ shadowRadius: 10,
118
+ elevation: 10,
119
+ },
120
+ }),
121
+ },
122
+ });
@@ -1,10 +1,11 @@
1
1
  import LinearGradient from 'react-native-linear-gradient';
2
- import {Animated, Platform, StyleSheet, View} from 'react-native';
2
+ import {Animated, StyleSheet, View} from 'react-native';
3
3
  import React, {useContext} from 'react';
4
4
  import {HeaderBackgroundProps} from '../types';
5
5
  import {ApplicationContext} from '../index';
6
- import {Colors, Styles} from '../../Consts';
6
+ import {Styles} from '../../Consts';
7
7
  import {Image} from '../../Image';
8
+ import BackgroundImageView from './BackgroundImageView';
8
9
 
9
10
  const LinearGradientAnimated = Animated.createAnimatedComponent(LinearGradient);
10
11
 
@@ -33,39 +34,14 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
33
34
  extrapolate: 'clamp',
34
35
  });
35
36
 
36
- if (Platform.OS === 'android' && headerImage) {
37
- useShadowHeader = false;
38
- }
39
-
40
37
  return (
41
38
  <View style={Styles.flex}>
42
- <Animated.View
43
- style={[
44
- useShadowHeader ? styles.shadowHeader : styles.dividerHeader,
45
- {
46
- backgroundColor: theme.colors.background.surface,
47
- opacity: opacityBackground,
48
- height: '100%',
49
- width: '100%',
50
- },
51
- ]}
39
+ <BackgroundImageView
40
+ useShadowHeader={useShadowHeader}
41
+ heightHeader={'100%'}
42
+ opacityBackground={opacityBackground}
43
+ headerBackground={headerImage}
52
44
  />
53
- <Animated.View
54
- style={{
55
- position: 'absolute',
56
- zIndex: 1,
57
- height: '100%',
58
- width: '100%',
59
- overflow: 'hidden',
60
- }}>
61
- {theme?.assets?.headerBackground && (
62
- <Image
63
- style={styles.headerBackground}
64
- source={{uri: theme?.assets?.headerBackground}}
65
- loading={false}
66
- />
67
- )}
68
- </Animated.View>
69
45
  <View style={styles.gradientContainer}>
70
46
  {useGradient && !!gradientColor && (
71
47
  <LinearGradientAnimated
@@ -86,29 +62,6 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
86
62
  };
87
63
 
88
64
  const styles = StyleSheet.create({
89
- shadowHeader: {
90
- ...Platform.select({
91
- ios: {
92
- shadowColor: Colors.black_20,
93
- shadowOffset: {
94
- width: 3,
95
- height: 3,
96
- },
97
- shadowOpacity: 0.12,
98
- shadowRadius: 10,
99
- },
100
- android: {
101
- shadowColor: Colors.black_17,
102
- shadowOffset: {
103
- width: 3,
104
- height: 3,
105
- },
106
- shadowOpacity: 0.12,
107
- shadowRadius: 10,
108
- elevation: 10,
109
- },
110
- }),
111
- },
112
65
  gradientContainer: {
113
66
  width: '100%',
114
67
  height: '100%',
@@ -116,18 +69,14 @@ const styles = StyleSheet.create({
116
69
  overflow: 'hidden',
117
70
  },
118
71
  extendedHeader: {
119
- aspectRatio: 2.43,
72
+ aspectRatio: 375 / 154,
120
73
  position: 'absolute',
121
74
  width: '100%',
122
75
  },
123
76
  headerBackground: {
124
77
  width: '100%',
125
78
  position: 'absolute',
126
- aspectRatio: 375 / 152,
127
- },
128
- dividerHeader: {
129
- borderBottomWidth: 1,
130
- borderColor: Colors.black_04,
79
+ aspectRatio: 375 / 154,
131
80
  },
132
81
  });
133
82
 
@@ -8,6 +8,7 @@ import Navigation from '../Navigation';
8
8
  import {Colors, Radius, Spacing} from '../../Consts';
9
9
  import {Image} from '../../Image';
10
10
  import {SearchHeaderProps} from '../types';
11
+ import BackgroundImageView from './BackgroundImageView';
11
12
 
12
13
  const SCREEN_PADDING = 12;
13
14
  const BACK_WIDTH = 28;
@@ -88,7 +89,7 @@ const HeaderExtendHeader: React.FC<{
88
89
  extrapolate: 'clamp',
89
90
  });
90
91
 
91
- if (Platform.OS === 'android' && headerBackground) {
92
+ if (inputSearchProps && Platform.OS === 'android') {
92
93
  useShadowHeader = false;
93
94
  }
94
95
 
@@ -96,38 +97,12 @@ const HeaderExtendHeader: React.FC<{
96
97
  return (
97
98
  <>
98
99
  <Animated.View style={{height: height}} />
99
- <Animated.View
100
- style={[
101
- useShadowHeader ? styles.shadowHeader : styles.dividerHeader,
102
- {
103
- position: 'absolute',
104
- width: '100%',
105
- zIndex: 1,
106
- height: heightHeader,
107
- backgroundColor: theme.colors.background.surface,
108
- opacity: opacityBackground,
109
- },
110
- ]}
100
+ <BackgroundImageView
101
+ useShadowHeader={useShadowHeader}
102
+ heightHeader={heightHeader}
103
+ opacityBackground={opacityBackground}
104
+ headerBackground={headerBackground}
111
105
  />
112
- <Animated.View
113
- style={[
114
- {
115
- position: 'absolute',
116
- width: '100%',
117
- height: heightHeader,
118
- zIndex: 1,
119
- overflow: 'hidden',
120
- },
121
- ]}>
122
- {headerBackground && (
123
- <Image
124
- style={styles.headerBackground}
125
- source={{uri: headerBackground}}
126
- loading={false}
127
- />
128
- )}
129
- </Animated.View>
130
-
131
106
  <Animated.View
132
107
  style={[
133
108
  styles.headerBox,
@@ -185,37 +160,12 @@ const HeaderExtendHeader: React.FC<{
185
160
  if (headerType === 'extended') {
186
161
  return (
187
162
  <>
188
- <Animated.View
189
- style={[
190
- useShadowHeader ? styles.shadowHeader : styles.dividerHeader,
191
- {
192
- position: 'absolute',
193
- width: '100%',
194
- zIndex: 1,
195
- height: heightHeader,
196
- backgroundColor: theme.colors.background.surface,
197
- opacity: opacityBackground,
198
- },
199
- ]}
163
+ <BackgroundImageView
164
+ useShadowHeader={useShadowHeader}
165
+ heightHeader={heightHeader}
166
+ opacityBackground={opacityBackground}
167
+ headerBackground={headerBackground}
200
168
  />
201
- <Animated.View
202
- style={[
203
- {
204
- position: 'absolute',
205
- width: '100%',
206
- zIndex: 1,
207
- height: heightHeader,
208
- overflow: 'hidden',
209
- },
210
- ]}>
211
- {headerBackground && (
212
- <Image
213
- style={styles.headerBackground}
214
- source={{uri: headerBackground}}
215
- loading={false}
216
- />
217
- )}
218
- </Animated.View>
219
169
  {!!gradientColor && (
220
170
  <LinearGradientAnimated
221
171
  colors={[gradientColor, gradientColor + '00']}
@@ -254,7 +204,7 @@ const styles = StyleSheet.create({
254
204
  aspectRatio: 375 / 154,
255
205
  },
256
206
  extendedHeader: {
257
- aspectRatio: 2.43,
207
+ aspectRatio: 375 / 154,
258
208
  position: 'absolute',
259
209
  width: '100%',
260
210
  },
@@ -271,33 +221,6 @@ const styles = StyleSheet.create({
271
221
  position: 'absolute',
272
222
  alignSelf: 'center',
273
223
  },
274
- dividerHeader: {
275
- borderBottomWidth: 1,
276
- borderColor: Colors.black_04,
277
- },
278
- shadowHeader: {
279
- ...Platform.select({
280
- ios: {
281
- shadowColor: Colors.black_20,
282
- shadowOffset: {
283
- width: 3,
284
- height: 3,
285
- },
286
- shadowOpacity: 0.12,
287
- shadowRadius: 10,
288
- },
289
- android: {
290
- shadowColor: Colors.black_17,
291
- shadowOffset: {
292
- width: 3,
293
- height: 3,
294
- },
295
- shadowOpacity: 0.12,
296
- shadowRadius: 10,
297
- elevation: 10,
298
- },
299
- }),
300
- },
301
224
  });
302
225
 
303
226
  export {HeaderExtendHeader};
@@ -92,7 +92,7 @@ const HeaderToolkitAction: React.FC<any> = ({
92
92
  */
93
93
  const checkAppIsFavorite = useCallback(
94
94
  () =>
95
- navigator?.maxApi?.dispatchFunction(
95
+ navigator?.maxApi?.dispatchFunction?.(
96
96
  'isFavoriteApp',
97
97
  {code: context?.code},
98
98
  (result: boolean) => {
@@ -143,14 +143,15 @@ const HeaderToolkitAction: React.FC<any> = ({
143
143
  */
144
144
  const onPressShortcut = () => {
145
145
  const currentRoute = navigator?.ref?.current?.getCurrentRoute?.();
146
+ const expected = !isFavorite;
146
147
  context?.autoTracking?.({
147
148
  ...context,
148
149
  componentName: 'IconButton',
149
- componentId: 'navigation_shortcut',
150
+ componentId: `${expected ? 'pin' : 'unpin'}_shortcut`,
150
151
  screenName: currentRoute?.params?.screen?.name ?? currentRoute?.name,
151
152
  });
152
153
  setIsLoading(true);
153
- navigator?.maxApi?.dispatchFunction(
154
+ navigator?.maxApi?.dispatchFunction?.(
154
155
  'onToolAction',
155
156
  {
156
157
  item: {
@@ -160,7 +161,7 @@ const HeaderToolkitAction: React.FC<any> = ({
160
161
  },
161
162
  ({success}: {success: boolean}) => {
162
163
  if (success) {
163
- setIsFavorite(!isFavorite);
164
+ setIsFavorite(expected);
164
165
  }
165
166
  }
166
167
  );
@@ -221,7 +222,7 @@ const HeaderToolkitAction: React.FC<any> = ({
221
222
  screenName: currentRoute?.params?.screen?.name ?? currentRoute?.name,
222
223
  });
223
224
 
224
- navigator?.maxApi?.dispatchFunction(
225
+ navigator?.maxApi?.dispatchFunction?.(
225
226
  'showTools',
226
227
  tools,
227
228
  context,
@@ -283,7 +284,14 @@ const HeaderToolkitAction: React.FC<any> = ({
283
284
  showBadge={showBadge}
284
285
  />
285
286
  )}
286
- <View style={[styles.toolkitContainer, buttonStyle]}>
287
+ <View
288
+ style={[
289
+ styles.toolkitContainer,
290
+ buttonStyle,
291
+ {
292
+ width: context.appId !== 'vn.momo.helpcenter' ? 65 : 28,
293
+ },
294
+ ]}>
287
295
  {context.appId !== 'vn.momo.helpcenter' && (
288
296
  <>
289
297
  <TouchableOpacity
@@ -367,7 +375,6 @@ const styles = StyleSheet.create({
367
375
  paddingRight: Spacing.M,
368
376
  },
369
377
  toolkitContainer: {
370
- width: 65,
371
378
  height: 28,
372
379
  borderRadius: 14,
373
380
  justifyContent: 'center',
@@ -8,7 +8,7 @@ import {
8
8
  } from 'react-native';
9
9
  import {ApplicationContext, MiniAppContext} from '../index';
10
10
  import {exportFontFamily, scaleSize, Text} from '../../Text';
11
- import {Colors, Spacing, Radius, Styles} from '../../Consts';
11
+ import {Colors, Radius, Spacing, Styles} from '../../Consts';
12
12
  import {TitleJourneyProps, TitleLocationProps, TitleUserProps} from '../types';
13
13
  import {Image} from '../../Image';
14
14
  import {Icon} from '../../Icon';
@@ -79,7 +79,7 @@ const TitleUser: React.FC<TitleUserProps> = ({
79
79
  isLoading,
80
80
  }) => {
81
81
  const {theme} = useContext(ApplicationContext);
82
- const maxWidth = icons?.length === 2 ? '73%' : '100%';
82
+ const maxWidth = Dimensions.get('window').width - scaleSize(172);
83
83
  const getShortName = (name: string) => {
84
84
  const words = name.split(' ');
85
85
  const lastTwoWords = words.slice(-2);
@@ -246,20 +246,20 @@ const TitleUser: React.FC<TitleUserProps> = ({
246
246
  };
247
247
 
248
248
  const renderVerifyIcon = () => {
249
- const renderIcons = () => {
250
- if (icons && icons.length > 0) {
251
- return icons.map(icon => (
252
- <Image
253
- source={{
254
- uri: icon,
255
- }}
256
- style={styles.verifiedIcon}
257
- />
258
- ));
259
- }
260
- };
261
-
262
- return <View style={Styles.row}>{renderIcons()}</View>;
249
+ if (icons && icons.length > 0) {
250
+ return (
251
+ <View style={[Styles.row]}>
252
+ {icons.map(icon => (
253
+ <Image
254
+ source={{
255
+ uri: icon,
256
+ }}
257
+ style={styles.verifiedIcon}
258
+ />
259
+ ))}
260
+ </View>
261
+ );
262
+ }
263
263
  };
264
264
 
265
265
  const renderShimmer = () => {
@@ -295,19 +295,21 @@ const TitleUser: React.FC<TitleUserProps> = ({
295
295
  if (isLoading) {
296
296
  return renderShimmer();
297
297
  }
298
+
298
299
  return (
299
300
  <TouchableOpacity
300
301
  style={styles.headerTitleContainer}
301
302
  onPress={onPress}
302
303
  disabled={onPress === undefined}>
303
- <View style={[Styles.row, Styles.flex]}>
304
+ <View
305
+ style={[Styles.row, {maxWidth: maxWidth - (icons?.length ?? 0) * 16}]}>
304
306
  <View>
305
307
  {renderImage()}
306
308
  {!!dotColor && (
307
309
  <View style={[styles.dotAvatar, {backgroundColor: dotColor}]} />
308
310
  )}
309
311
  </View>
310
- <View style={[Styles.flex, {marginLeft: 6, maxWidth: maxWidth}]}>
312
+ <View style={[Styles.flex, {marginLeft: 6}]}>
311
313
  <View style={Styles.row}>
312
314
  <Text
313
315
  typography="action_xs_bold"
@@ -493,7 +495,7 @@ const styles = StyleSheet.create({
493
495
  },
494
496
  headerTitleContainer: {
495
497
  justifyContent: 'center',
496
- maxWidth: Dimensions.get('window').width - 190,
498
+ maxWidth: Dimensions.get('window').width - scaleSize(172),
497
499
  },
498
500
  circle: {
499
501
  width: 32,
@@ -105,7 +105,7 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
105
105
  });
106
106
  };
107
107
 
108
- const headerBackground = config?.headerBar || theme.assets?.headerBackground;
108
+ const headerBackground = theme.assets?.headerBackground || config?.headerBar;
109
109
  const headerGradient = config?.headerGradient || theme.colors?.gradient;
110
110
 
111
111
  navigator.current.setCurrentContext = setCurrentContext;
@@ -26,32 +26,6 @@ const getStackOptions = (): StackNavigationOptions => {
26
26
  headerRight: (props: any) => <HeaderRight {...props} />,
27
27
  headerTintColor: Colors.black_17,
28
28
  gestureEnabled: false,
29
- cardStyleInterpolator: ({current: {progress}, layouts}) => ({
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
- },
55
29
  };
56
30
  };
57
31
 
package/Input/Input.tsx CHANGED
@@ -218,6 +218,7 @@ const Input = forwardRef(
218
218
  },
219
219
  secure && haveValue && {fontSize: size === 'small' ? 18 : 22},
220
220
  ]}
221
+ allowFontScaling={false}
221
222
  textBreakStrategy="highQuality"
222
223
  value={value}
223
224
  onChangeText={_onChangeText}
@@ -150,6 +150,7 @@ const InputMoney = forwardRef(
150
150
  editable={!disabled}
151
151
  ref={inputRef}
152
152
  keyboardType={'number-pad'}
153
+ allowFontScaling={false}
153
154
  style={[
154
155
  styles.moneyInput,
155
156
  {
@@ -215,6 +215,7 @@ const InputOTP = forwardRef(
215
215
  value={value}
216
216
  onChangeText={_onChangeText}
217
217
  keyboardType={dataType === 'number' ? 'number-pad' : 'default'}
218
+ allowFontScaling={false}
218
219
  onFocus={onFocusInput}
219
220
  onBlur={onBlurInput}
220
221
  style={styles.otpRealInput}
@@ -107,6 +107,7 @@ const TextTyping: FC<any> = ({
107
107
  autoCorrect={false}
108
108
  pointerEvents={'none'}
109
109
  numberOfLines={1}
110
+ allowFontScaling={false}
110
111
  />
111
112
  );
112
113
  };
@@ -203,6 +204,7 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
203
204
  {...props}
204
205
  accessibilityLabel={accessibilityLabel}
205
206
  textAlignVertical="center"
207
+ allowFontScaling={false}
206
208
  ref={inputRef}
207
209
  style={[
208
210
  styles.searchInput,
@@ -133,6 +133,7 @@ const InputTextArea = forwardRef(
133
133
  ref={inputRef}
134
134
  editable={!disabled}
135
135
  textAlignVertical="top"
136
+ allowFontScaling={false}
136
137
  style={[
137
138
  styles.textArea,
138
139
  {
@@ -95,6 +95,7 @@ const TextTyping: FC<TextTypingProps> = ({
95
95
  autoCorrect={false}
96
96
  pointerEvents={'none'}
97
97
  numberOfLines={1}
98
+ allowFontScaling={false}
98
99
  />
99
100
  );
100
101
  };
package/Text/index.tsx CHANGED
@@ -156,6 +156,7 @@ const Text: React.FC<TextProps> = ({
156
156
  <RNText
157
157
  {...rest}
158
158
  {...setAutomationID(rest.accessibilityLabel)}
159
+ allowFontScaling={false}
159
160
  style={[
160
161
  style,
161
162
  textStyle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.111.1-beta.21",
3
+ "version": "0.111.1-beta.23",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -9,15 +9,16 @@
9
9
  ],
10
10
  "dependencies": {
11
11
  "@gorhom/bottom-sheet": "2.4.1",
12
+ "react-native-modalize": "2.1.1",
12
13
  "react-native-safe-area-context": "3.1.4",
13
14
  "react-native-linear-gradient": "2.8.3",
14
15
  "react-native-gesture-handler": "1.10.3",
15
- "react-native-modalize": "2.1.1",
16
16
  "react-native-fast-image": "8.1.5",
17
17
  "@react-navigation/bottom-tabs": "https://gitlab.mservice.com.vn/momo-platform/react-native-bottom-tabs.git",
18
18
  "@react-navigation/core": "5.16.1",
19
19
  "@react-navigation/native": "5.9.8",
20
20
  "@react-navigation/routers": "5.7.4",
21
+ "react-native-reanimated": "git+https://gitlab.mservice.com.vn/momo-platform/react-native-reanimated.git#v1.13.4_gradle_7",
21
22
  "lottie-react-native": "git+https://gitlab.mservice.com.vn/momo-platform/momo-lottie-react-native.git",
22
23
  "@react-navigation/stack": "https://gitlab.mservice.com.vn/momo-platform/react-navigation-stack.git"
23
24
  },