@momo-kits/foundation 0.110.1-beta.1 → 0.110.1-beta.2

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,6 +1,6 @@
1
1
  import LinearGradient from 'react-native-linear-gradient';
2
2
  import {Animated, Platform, StyleSheet, View} from 'react-native';
3
- import React, {useContext, useEffect, useState} from 'react';
3
+ import React, {useContext} from 'react';
4
4
  import {HeaderBackgroundProps} from '../types';
5
5
  import {ApplicationContext} from '../index';
6
6
  import {Colors, Styles} from '../../Consts';
@@ -19,17 +19,7 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
19
19
  gradientColor,
20
20
  headerBackground,
21
21
  }) => {
22
- const {theme, navigator} = useContext(ApplicationContext);
23
- const [configHeader, setConfigHeader] = useState(null);
24
-
25
- useEffect(() => {
26
- navigator?.maxApi?.getFeatureById('platform_config', (config: any) => {
27
- const header = config?.navigationBar?.headerBar;
28
- if (header) {
29
- setConfigHeader(header);
30
- }
31
- });
32
- }, []);
22
+ const {theme} = useContext(ApplicationContext);
33
23
 
34
24
  const linearGradientColor = gradientColor ?? theme.colors.gradient;
35
25
 
@@ -69,7 +59,7 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
69
59
  {!!headerImage && (
70
60
  <Image
71
61
  style={styles.headerBackground}
72
- source={{uri: configHeader || headerImage}}
62
+ source={{uri: headerImage}}
73
63
  loading={false}
74
64
  />
75
65
  )}
@@ -32,6 +32,7 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
32
32
  const isReady = useRef(false);
33
33
  const navigator = useRef(new Navigator(navigationRef, isReady));
34
34
  const [showGrid, setShowGrid] = useState(false);
35
+ const [configHeader, setConfigHeader] = useState(null);
35
36
 
36
37
  /**
37
38
  * inject data for navigator
@@ -62,12 +63,27 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
62
63
  return localize?.translate(data as string);
63
64
  };
64
65
 
66
+ useEffect(() => {
67
+ maxApi?.getFeatureById('platform_config', (data: any) => {
68
+ const parsedConfig = JSON.parse(data?.param);
69
+ const header = parsedConfig?.navigationBar?.headerBar;
70
+ if (header) {
71
+ setConfigHeader(header);
72
+ }
73
+ });
74
+ }, []);
75
+
65
76
  return (
66
77
  <SafeAreaProvider>
67
78
  <ApplicationContext.Provider
68
79
  value={{
69
80
  navigator: navigator.current,
70
- theme,
81
+ theme: {
82
+ ...theme,
83
+ assets: {
84
+ headerBackground: theme.assets?.headerBackground || configHeader,
85
+ },
86
+ },
71
87
  showGrid,
72
88
  translate,
73
89
  }}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.110.1-beta.1",
3
+ "version": "0.110.1-beta.2",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},