@momo-kits/foundation 0.110.1-beta.13 → 0.110.1-beta.15

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.
@@ -55,8 +55,8 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
55
55
  style={{
56
56
  width: '100%',
57
57
  height: '100%',
58
- aspectRatio: 4,
59
58
  }}
59
+ resizeMode={'stretch'}
60
60
  source={{uri: theme?.assets?.headerBackgroundWhite}}
61
61
  loading={false}
62
62
  />
@@ -113,8 +113,8 @@ const HeaderExtendHeader: React.FC<{
113
113
  style={{
114
114
  width: '100%',
115
115
  height: '100%',
116
- aspectRatio: 4,
117
116
  }}
117
+ resizeMode={'stretch'}
118
118
  source={{uri: headerBackgroundWhite}}
119
119
  loading={false}
120
120
  />
@@ -194,8 +194,8 @@ const HeaderExtendHeader: React.FC<{
194
194
  style={{
195
195
  width: '100%',
196
196
  height: '100%',
197
- aspectRatio: 4,
198
197
  }}
198
+ resizeMode={'stretch'}
199
199
  source={{uri: headerBackgroundWhite}}
200
200
  loading={false}
201
201
  />
@@ -8,10 +8,11 @@ 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, Styles} from '../../Consts';
11
+ import {Colors, Spacing, Radius, Styles} from '../../Consts';
12
12
  import {TitleJourneyProps, TitleLocationProps, TitleUserProps} from '../types';
13
13
  import {Image} from '../../Image';
14
14
  import {Icon} from '../../Icon';
15
+ import {Skeleton} from '../../Skeleton';
15
16
 
16
17
  /**
17
18
  * default header title used for nav
@@ -73,8 +74,9 @@ const TitleUser: React.FC<TitleUserProps> = ({
73
74
  tintColor,
74
75
  dotColor,
75
76
  onPress,
76
- icon1,
77
- icon2,
77
+ verify,
78
+ icons,
79
+ isLoading,
78
80
  }) => {
79
81
  const {theme} = useContext(ApplicationContext);
80
82
  const getShortName = (name: string) => {
@@ -96,35 +98,55 @@ const TitleUser: React.FC<TitleUserProps> = ({
96
98
  };
97
99
 
98
100
  const renderVerifyIcon = () => {
99
- if (icon1 && icon2) {
100
- return (
101
- <View style={Styles.row}>
102
- <Image
103
- source={{
104
- uri: icon1,
105
- }}
106
- style={styles.verifiedIcon}
107
- />
101
+ const renderIcons = () => {
102
+ if (icons && icons.length > 0) {
103
+ return icons.map(icon => (
108
104
  <Image
109
105
  source={{
110
- uri: icon2,
106
+ uri: icon,
111
107
  }}
112
108
  style={styles.verifiedIcon}
113
109
  />
110
+ ));
111
+ }
112
+ };
113
+
114
+ return <View style={Styles.row}>{renderIcons()}</View>;
115
+ };
116
+
117
+ const renderShimmer = () => {
118
+ return (
119
+ <View style={Styles.row}>
120
+ <View
121
+ style={[
122
+ styles.imageContainer,
123
+ {
124
+ borderColor: theme.colors.border.default,
125
+ marginRight: Spacing.M / 2,
126
+ },
127
+ ]}>
128
+ <Skeleton />
114
129
  </View>
115
- );
116
- } else if (icon1 || icon2) {
117
- return (
118
- <Image
119
- source={{
120
- uri: icon1 || icon2,
121
- }}
122
- style={styles.verifiedIcon}
123
- />
124
- );
125
- }
130
+ <View style={Styles.flex}>
131
+ <View style={styles.shimmerTitle}>
132
+ <Skeleton />
133
+ </View>
134
+ <View style={{height: Spacing.XXS}} />
135
+ <View style={styles.shimmerDescription}>
136
+ <Skeleton />
137
+ </View>
138
+ </View>
139
+ </View>
140
+ );
126
141
  };
127
142
 
143
+ if (verify) {
144
+ console.warn(`Warning: The verify value "${verify}" is deprecated.`);
145
+ }
146
+
147
+ if (isLoading) {
148
+ return renderShimmer();
149
+ }
128
150
  return (
129
151
  <TouchableOpacity
130
152
  style={styles.headerTitleContainer}
@@ -150,7 +172,7 @@ const TitleUser: React.FC<TitleUserProps> = ({
150
172
  color={tintColor}
151
173
  numberOfLines={1}>
152
174
  {title}
153
- </Text>
175
+ </Text>
154
176
  {renderVerifyIcon()}
155
177
  </View>
156
178
  {!!subTitle && (
@@ -177,7 +199,24 @@ const TitleLocation: React.FC<TitleLocationProps> = ({
177
199
  location,
178
200
  description,
179
201
  onPress,
202
+ isLoading,
180
203
  }) => {
204
+ const renderShimmer = () => {
205
+ return (
206
+ <View style={Styles.flex}>
207
+ <View style={styles.shimmerDescription}>
208
+ <Skeleton />
209
+ </View>
210
+ <View style={{height: Spacing.XXS}} />
211
+ <View style={styles.shimmerTitle}>
212
+ <Skeleton />
213
+ </View>
214
+ </View>
215
+ );
216
+ };
217
+ if (isLoading) {
218
+ return renderShimmer();
219
+ }
181
220
  return (
182
221
  <TouchableOpacity
183
222
  style={[styles.headerTitleContainer, {alignItems: 'flex-start'}]}
@@ -217,10 +256,27 @@ const TitleJourney: React.FC<TitleJourneyProps> = ({
217
256
  iconColor,
218
257
  tintColor,
219
258
  onPress,
259
+ isLoading,
220
260
  }) => {
221
261
  const {width} = Dimensions.get('screen');
222
262
  const startWidth = width * 0.25;
223
263
  const endWidth = width * 0.75 - 212;
264
+ const renderShimmer = () => {
265
+ return (
266
+ <View style={Styles.flex}>
267
+ <View style={styles.shimmerTitle}>
268
+ <Skeleton />
269
+ </View>
270
+ <View style={{height: Spacing.XXS}} />
271
+ <View style={styles.shimmerDescription}>
272
+ <Skeleton />
273
+ </View>
274
+ </View>
275
+ );
276
+ };
277
+ if (isLoading) {
278
+ return renderShimmer();
279
+ }
224
280
  return (
225
281
  <TouchableOpacity style={styles.headerTitleContainer} onPress={onPress}>
226
282
  <View style={styles.rowJourney}>
@@ -322,6 +378,18 @@ const styles = StyleSheet.create({
322
378
  borderColor: Colors.black_01,
323
379
  },
324
380
  verifiedIcon: {width: 16, height: 16, marginLeft: Spacing.XS},
381
+ shimmerTitle: {
382
+ height: 18,
383
+ width: 120,
384
+ borderRadius: Radius.XS,
385
+ overflow: 'hidden',
386
+ },
387
+ shimmerDescription: {
388
+ height: 12,
389
+ width: 120,
390
+ borderRadius: Radius.XS,
391
+ overflow: 'hidden',
392
+ },
325
393
  });
326
394
 
327
395
  export {HeaderTitle, TitleCustom};
@@ -34,7 +34,8 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
34
34
  const [showGrid, setShowGrid] = useState(false);
35
35
  const [configHeader, setConfigHeader] = useState({
36
36
  header: undefined,
37
- headerWhite: undefined,
37
+ headerWhite:
38
+ 'https://static.momocdn.net/app/img/kits/background/header/header_Tet_2024_white.png',
38
39
  });
39
40
  /**
40
41
  * inject data for navigator
@@ -199,8 +199,8 @@ export type TitleUserProps = {
199
199
  verify?: boolean;
200
200
  tintColor?: string;
201
201
  onPress?: () => void;
202
- icon1?: string;
203
- icon2?: string;
202
+ icons?: string[];
203
+ isLoading?: boolean;
204
204
  };
205
205
 
206
206
  export type TitleLocationProps = {
@@ -208,6 +208,7 @@ export type TitleLocationProps = {
208
208
  location: string;
209
209
  tintColor?: string;
210
210
  onPress?: () => void;
211
+ isLoading?: boolean;
211
212
  };
212
213
 
213
214
  export type TitleJourneyProps = {
@@ -218,6 +219,7 @@ export type TitleJourneyProps = {
218
219
  iconColor?: string;
219
220
  tintColor?: string;
220
221
  onPress?: () => void;
222
+ isLoading?: boolean;
221
223
  };
222
224
 
223
225
  export type HeaderToolkitProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.110.1-beta.13",
3
+ "version": "0.110.1-beta.15",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},