@momo-kits/foundation 0.109.1-optimize.3 → 0.109.1-optimize.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.
@@ -11,13 +11,16 @@ import {Colors} from '../../Consts';
11
11
  const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
12
12
  animatedValue,
13
13
  image,
14
+ useScale = true,
14
15
  children,
15
16
  }) => {
16
- const scale = animatedValue.interpolate({
17
- inputRange: [-300, 0, 300],
18
- outputRange: [4, 1, 1],
19
- extrapolate: 'clamp',
20
- });
17
+ const scale = useScale
18
+ ? animatedValue.interpolate({
19
+ inputRange: [-300, 0, 300],
20
+ outputRange: [4, 1, 1],
21
+ extrapolate: 'clamp',
22
+ })
23
+ : 1;
21
24
  const opacity = animatedValue.interpolate({
22
25
  inputRange: [0, 150, 300],
23
26
  outputRange: [1, 0.5, 0],
@@ -11,7 +11,7 @@ import {Colors, Spacing, Styles} from '../../Consts';
11
11
  import {PopupNotify} from '../../Popup';
12
12
  import {Tool} from '../types';
13
13
  import {Icon} from '../../Icon';
14
- import {scaleSize} from '../../Text';
14
+ import {scaleSize, Text} from '../../Text';
15
15
 
16
16
  const WHITE_LIST = [
17
17
  'vn.momo.appx',
@@ -25,7 +25,14 @@ const HELP_CENTER_ICON = 'help_center';
25
25
  * main component for header right
26
26
  */
27
27
  const HeaderRight: React.FC<any> = props => {
28
+ const {headerRight} = props;
29
+ const {
30
+ useOnBoarding = false,
31
+ buttonOnBoarding,
32
+ onPressButtonOnBoarding,
33
+ } = headerRight;
28
34
  const context = useContext<any>(MiniAppContext);
35
+ const {translate} = useContext(ApplicationContext);
29
36
  if (
30
37
  WHITE_LIST.includes(context?.appId) &&
31
38
  typeof props.headerRight === 'function'
@@ -37,6 +44,18 @@ const HeaderRight: React.FC<any> = props => {
37
44
  return <View />;
38
45
  }
39
46
 
47
+ if (useOnBoarding && onPressButtonOnBoarding) {
48
+ return (
49
+ <TouchableOpacity
50
+ onPress={onPressButtonOnBoarding}
51
+ style={styles.onBoarding}>
52
+ <Text typography={'action_s_bold'}>
53
+ {buttonOnBoarding || translate?.('skip')}
54
+ </Text>
55
+ </TouchableOpacity>
56
+ );
57
+ }
58
+
40
59
  return (
41
60
  <View style={styles.headerRightButton}>
42
61
  <HeaderToolkitAction {...props.headerRight} tintColor={props.tintColor} />
@@ -177,14 +196,16 @@ const HeaderToolkitAction: React.FC<any> = ({
177
196
  <TouchableOpacity
178
197
  accessibilityLabel={'btn_navigation_help_center'}
179
198
  style={styles.toolkitButton}
180
- onPress={onPressHelpCenter}>
199
+ onPress={onPressHelpCenter}
200
+ hitSlop={{top: 7, bottom: 7, left: 7, right: 0}}>
181
201
  <Icon color={tintColor} source={HELP_CENTER_ICON} size={20} />
182
202
  </TouchableOpacity>
183
203
  <View style={[styles.divider, {backgroundColor: tintColor}]} />
184
204
  <TouchableOpacity
185
205
  accessibilityLabel={'btn_navigation_close'}
186
206
  onPress={onClose}
187
- style={styles.toolkitButton}>
207
+ style={styles.toolkitButton}
208
+ hitSlop={{top: 7, bottom: 7, left: 0, right: 7}}>
188
209
  <Icon
189
210
  color={tintColor}
190
211
  source="16_navigation_close_circle"
@@ -264,6 +285,7 @@ const styles = StyleSheet.create({
264
285
  },
265
286
  toolkitButton: {
266
287
  padding: 4,
288
+ backgroundColor: 'red',
267
289
  },
268
290
  divider: {
269
291
  width: 0.5,
@@ -334,6 +356,9 @@ const styles = StyleSheet.create({
334
356
  },
335
357
  }),
336
358
  },
359
+ onBoarding: {
360
+ marginRight: Spacing.M,
361
+ },
337
362
  });
338
363
 
339
364
  export {HeaderRight};
@@ -72,7 +72,10 @@ const TitleUser: React.FC<TitleUserProps> = ({
72
72
  onPress,
73
73
  }) => {
74
74
  return (
75
- <TouchableOpacity style={styles.headerTitleContainer} onPress={onPress}>
75
+ <TouchableOpacity
76
+ style={styles.headerTitleContainer}
77
+ onPress={onPress}
78
+ disabled={onPress === undefined}>
76
79
  <View style={Styles.row}>
77
80
  <View>
78
81
  <Image source={{uri: image}} style={styles.circle} />
@@ -140,7 +143,7 @@ const TitleLocation: React.FC<TitleLocationProps> = ({
140
143
  {location}
141
144
  </Text>
142
145
  <Icon
143
- source={'16_arrow_chevron_down'}
146
+ source={'16_arrow_chevron_down_small'}
144
147
  size={16}
145
148
  style={{marginHorizontal: Spacing.XS}}
146
149
  />
@@ -32,7 +32,8 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
32
32
  disabled={disabled}
33
33
  accessibilityLabel={accessibilityLabel}
34
34
  style={[styles.navigationButton, buttonStyle]}
35
- onPress={onPress}>
35
+ onPress={onPress}
36
+ hitSlop={{top: 7, bottom: 7, left: 7, right: 7}}>
36
37
  <Icon
37
38
  source={icon}
38
39
  color={tintColor ?? theme.colors.text.default}
@@ -16,9 +16,8 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
16
16
  (
17
17
  {
18
18
  animatedValue,
19
- headerRightWidth = 73,
20
19
  buttonText = 'Huỷ',
21
- showButtonText,
20
+ showButtonText = true,
22
21
  onPressButtonText,
23
22
  ...props
24
23
  },
@@ -68,7 +67,6 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
68
67
  <Text typography={'action_default_bold'}>{buttonText}</Text>
69
68
  </TouchableOpacity>
70
69
  )}
71
- <View style={{marginRight: headerRightWidth}} />
72
70
  </View>
73
71
  );
74
72
  }
@@ -154,9 +154,15 @@ export interface NavigationOptions
154
154
  onPressLeftHeader?: () => void;
155
155
  hiddenBack?: boolean;
156
156
  headerTitle?: HeaderTitleProps | string;
157
- headerRight?: HeaderRightToolkit | any;
157
+ headerRight?: OnBoarding | HeaderRightToolkit | any;
158
158
  }
159
159
 
160
+ export type OnBoarding = {
161
+ useOnBoarding?: boolean;
162
+ buttonText?: string;
163
+ onPressButtonOnBoarding?: () => void;
164
+ };
165
+
160
166
  export type HeaderRightToolkit = {
161
167
  useShortcut?: boolean;
162
168
  tools?: Tool[];
@@ -214,6 +220,7 @@ export type HeaderToolkitProps = {
214
220
  export interface HeaderAnimatedProps extends ViewProps {
215
221
  animatedValue: Animated.Value;
216
222
  image: string;
223
+ useScale?: boolean;
217
224
  }
218
225
 
219
226
  export type BottomTabItemProps = {
@@ -97,7 +97,8 @@
97
97
  "information": "Thông tin chung",
98
98
  "tutorial": "Hướng dẫn sử dụng",
99
99
  "question": "Câu hỏi thường gặp",
100
- "support": "Trung tâm hỗ trợ"
100
+ "support": "Trung tâm hỗ trợ",
101
+ "skip": "Bỏ qua"
101
102
  },
102
103
  "en": {
103
104
  "seeMore": "See more",
@@ -197,6 +198,7 @@
197
198
  "tutorial": "Instruction",
198
199
  "question": "FAQ",
199
200
  "support": "Support center",
200
- "errorCode": "Error code: "
201
+ "errorCode": "Error code: ",
202
+ "skip": "Skip"
201
203
  }
202
204
  }
package/Layout/Screen.tsx CHANGED
@@ -341,12 +341,12 @@ const Screen = forwardRef(
341
341
  */
342
342
  const setSearchHeader = (params: SearchHeaderProps) => {
343
343
  const options: StackNavigationOptions = {
344
+ headerRight: undefined,
344
345
  headerTitle: (props: any) => (
345
346
  <SearchHeader
346
347
  {...props}
347
348
  {...params}
348
349
  animatedValue={animatedValue.current}
349
- headerRightWidth={headerRightWidth}
350
350
  />
351
351
  ),
352
352
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.109.1-optimize.3",
3
+ "version": "0.109.1-optimize.5",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},