@momo-kits/template 0.169.4 → 0.169.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.
@@ -1,10 +1,14 @@
1
- import React, {FC} from 'react';
2
- import {Animated, TouchableOpacity} from 'react-native';
3
- import {Carousel} from '@momo-kits/carousel';
4
- import {Image, Pagination, Spacing} from '@momo-kits/foundation';
5
- import {HeaderSliderBannerProps} from './types';
1
+ import React, { FC } from 'react';
2
+ import { Animated, TouchableOpacity } from 'react-native';
3
+ import { Carousel } from '@momo-kits/carousel';
4
+ import { Image, Pagination, Spacing } from '@momo-kits/foundation';
5
+ import { HeaderSliderBannerProps } from './types';
6
6
  import styles from './styles';
7
7
 
8
+ /**
9
+ * Full-width image carousel for a screen header. Driven by the scroll offset
10
+ * `animatedValue`: zooms on pull-down, fades and lifts on scroll-up.
11
+ */
8
12
  const HeaderSliderBanner: FC<HeaderSliderBannerProps> = ({
9
13
  animatedValue = new Animated.Value(0),
10
14
  paginationBottom = 56,
@@ -37,8 +41,8 @@ const HeaderSliderBanner: FC<HeaderSliderBannerProps> = ({
37
41
  outputRange: [0, 1],
38
42
  });
39
43
 
40
- const renderItem = (info: {item: any; index: number}) => {
41
- const {item, index} = info;
44
+ const renderItem = (info: { item: any; index: number }) => {
45
+ const { item, index } = info;
42
46
  return (
43
47
  <TouchableOpacity disabled={!onPressItem} onPress={onPressItem}>
44
48
  <Image
@@ -58,9 +62,10 @@ const HeaderSliderBanner: FC<HeaderSliderBannerProps> = ({
58
62
  styles.container,
59
63
  {
60
64
  opacity: opacity,
61
- transform: [{scale}, {translateY}],
65
+ transform: [{ scale }, { translateY }],
62
66
  },
63
- ]}>
67
+ ]}
68
+ >
64
69
  <Carousel
65
70
  {...carouselProps}
66
71
  full={true}
@@ -75,7 +80,8 @@ const HeaderSliderBanner: FC<HeaderSliderBannerProps> = ({
75
80
  bottom: paginationBottom - Spacing.S,
76
81
  opacity: paginationOpacity,
77
82
  },
78
- ]}>
83
+ ]}
84
+ >
79
85
  <Pagination
80
86
  {...paginationProps}
81
87
  activeIndex={activeIndex}
@@ -1,24 +1,26 @@
1
- import React, {FC, useContext} from 'react';
2
- import {View} from 'react-native';
1
+ import React, { FC, useContext } from 'react';
2
+ import { View } from 'react-native';
3
3
  import styles from './styles';
4
- import {ApplicationContext, Colors, Image, Text} from '@momo-kits/foundation';
5
- import {CustomAvatarProps} from './types';
4
+ import { ApplicationContext, Colors, Image, Text } from '@momo-kits/foundation';
5
+ import { CustomAvatarProps } from './types';
6
6
 
7
- const CustomAvatar: FC<CustomAvatarProps> = ({image, text, style}) => {
8
- const {theme} = useContext(ApplicationContext);
7
+ /** Bordered circle showing `text` when set, else `image`. */
8
+ const CustomAvatar: FC<CustomAvatarProps> = ({ image, text, style }) => {
9
+ const { theme } = useContext(ApplicationContext);
9
10
 
10
11
  const renderContent = () => {
11
12
  if (text) {
12
13
  return (
13
14
  <Text
14
15
  color={theme.colors.primary}
15
- typography={'description_xs_regular'}>
16
+ typography={'description_xs_regular'}
17
+ >
16
18
  {text}
17
19
  </Text>
18
20
  );
19
21
  }
20
22
 
21
- return <Image style={styles.avatarImage} source={{uri: image}} />;
23
+ return <Image style={styles.avatarImage} source={{ uri: image }} />;
22
24
  };
23
25
 
24
26
  return (
@@ -30,7 +32,8 @@ const CustomAvatar: FC<CustomAvatarProps> = ({image, text, style}) => {
30
32
  borderColor: theme.colors.border.default,
31
33
  },
32
34
  style,
33
- ]}>
35
+ ]}
36
+ >
34
37
  {renderContent()}
35
38
  </View>
36
39
  );
@@ -37,6 +37,11 @@ const defaultData = {
37
37
  },
38
38
  };
39
39
 
40
+ /**
41
+ * MoMo security banner with content from the remote design-system config, else
42
+ * defaults. A press is tracked, then opens `urlConfig` as a web page or a
43
+ * feature code.
44
+ */
40
45
  const TrustBanner: FC<TrustBannerProps> = ({
41
46
  style,
42
47
  screenName = '',
@@ -1,4 +1,4 @@
1
- import {ViewStyle} from 'react-native';
1
+ import { ViewStyle } from 'react-native';
2
2
 
3
3
  export type TrustBannerCallbackParams = {
4
4
  service_name: string;
@@ -15,30 +15,25 @@ export type TrustBannerProps = {
15
15
  style?: ViewStyle | ViewStyle[];
16
16
 
17
17
  /**
18
- * Optional. The name of the screen where the banner is displayed. This can be
19
- * used to identify the context in which the banner appears.
18
+ * Optional. The name of the screen where the banner is displayed, sent as
19
+ * `screen_name` in the display and click tracking events.
20
20
  */
21
21
  screenName?: string;
22
22
 
23
23
  /**
24
- * Optional. The name of the service or feature the banner is associated with.
25
- * This helps in providing contextual information within the banner content.
24
+ * Optional. The name of the service or feature the banner is associated with,
25
+ * sent as `service_name` in the display and click tracking events.
26
26
  */
27
27
  serviceName?: string;
28
28
 
29
29
  /**
30
- * Optional. A callback function can be openWeb or startFeatureCode,
31
- * return params:
32
- * service_name,
33
- * screen_name,
34
- * component_name,
35
- * url_config,
36
- * feature_code,
30
+ * Optional. Not called: the banner opens `urlConfig` itself through
31
+ * `navigator.maxApi` (openWeb or startFeatureCode).
37
32
  */
38
33
  onPress?: (params: TrustBannerCallbackParams) => void;
39
34
 
40
35
  /**
41
- * Optional. instance of maxApi trackEvent function.
36
+ * Optional. Not called: the banner tracks via `navigator.maxApi.trackEvent`.
42
37
  */
43
38
  trackEvent?: (eventName: string, params: TrustBannerCallbackParams) => void;
44
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/template",
3
- "version": "0.169.4",
3
+ "version": "0.169.5",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "peerDependencies": {