@momo-kits/foundation 0.112.1-beta.7 → 0.112.1-beta.8

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/Layout/Screen.tsx CHANGED
@@ -1,5 +1,6 @@
1
1
  import {StackNavigationOptions, useHeaderHeight} from '@react-navigation/stack';
2
2
  import React, {
3
+ Children,
3
4
  forwardRef,
4
5
  Fragment,
5
6
  ReactNode,
@@ -43,6 +44,7 @@ import {
43
44
  HeaderTitle,
44
45
  } from '../Application/Components';
45
46
  import {SearchHeader} from '../Application/Components/SearchHeader';
47
+ import {Skeleton} from '@momo-kits/foundation';
46
48
 
47
49
  export interface ScreenProps extends ViewProps {
48
50
  /**
@@ -174,6 +176,7 @@ const Screen = forwardRef(
174
176
  animatedValue: customAnimatedValue,
175
177
  headerBackground,
176
178
  gradientColor,
179
+ isLoading,
177
180
  }: ScreenProps,
178
181
  ref: any
179
182
  ) => {
@@ -504,6 +507,16 @@ const Screen = forwardRef(
504
507
  }
505
508
  };
506
509
 
510
+ const generateSkeleton = () => {
511
+ if (children) {
512
+ return Children.toArray(children).map((item, index) => {
513
+ return (
514
+ <Skeleton key={`Skeleton${index}`} style={{marginTop: Spacing.M}} />
515
+ );
516
+ });
517
+ }
518
+ };
519
+
507
520
  return (
508
521
  <View
509
522
  style={[
@@ -543,7 +556,11 @@ const Screen = forwardRef(
543
556
  style={Styles.flex}>
544
557
  {renderAnimatedHeader()}
545
558
 
546
- {useGridLayout ? renderContent(children) : children}
559
+ {isLoading
560
+ ? generateSkeleton()
561
+ : useGridLayout
562
+ ? renderContent(children)
563
+ : children}
547
564
  </Component>
548
565
 
549
566
  {floatingButtonProps && (
package/index.ts CHANGED
@@ -4,13 +4,32 @@ import {
4
4
  useSafeAreaInsets,
5
5
  } from 'react-native-safe-area-context';
6
6
  import LinearGradient from 'react-native-linear-gradient';
7
- // import {Configs} from './Consts';
7
+ import {Configs} from './Consts';
8
8
 
9
9
  if (typeof (global as any)?.miniAppApi?.dispatch === 'function') {
10
- // const features = (global as any)?.miniAppApi?.dispatch?.('platform_config');
11
- // const designSystemJson = features[0].designSystem;
12
- // const config = JSON.parse(designSystemJson);
13
- // Configs.trustBanner = config?.trustBanner;
10
+ try {
11
+ (global as any)?.miniAppApi?.dispatch?.(
12
+ 'getFeatureById',
13
+ 'platform_config',
14
+ (res: any) => {
15
+ const config = JSON.parse(res?.param);
16
+ const designSystemUrl = config?.design_system;
17
+ if (designSystemUrl) {
18
+ fetch(designSystemUrl)
19
+ .then(res => res.json())
20
+ .then(data => {
21
+ if (data) {
22
+ Configs.headerBar = data?.headerBar;
23
+ Configs.headerGradient = data?.headerGradient;
24
+ Configs.trustBanner = data?.trustBanner;
25
+ }
26
+ });
27
+ }
28
+ }
29
+ );
30
+ } catch (e) {
31
+ console.log('Error fetching design system config', e);
32
+ }
14
33
  }
15
34
 
16
35
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.112.1-beta.7",
3
+ "version": "0.112.1-beta.8",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},