@momo-kits/foundation 0.77.5 → 0.77.7

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.
@@ -225,23 +225,22 @@ const HeaderRightAction: React.FC<any> = ({children, ...restProps}) => {
225
225
  );
226
226
  return <View />;
227
227
  }
228
+ return item;
228
229
  };
229
230
  const renderAction = () => {
230
231
  if (Array.isArray(children)) {
231
232
  return children.map((child, index) => {
232
- validType(child);
233
233
  return (
234
234
  <View key={index} style={styles.headerButton}>
235
- {React.cloneElement(child, {...restProps})}
235
+ {React.cloneElement(validType(child), {...restProps})}
236
236
  </View>
237
237
  );
238
238
  });
239
239
  }
240
240
 
241
- validType(children);
242
241
  return (
243
242
  <View style={styles.headerButton}>
244
- {React.cloneElement(children, {...restProps})}
243
+ {React.cloneElement(validType(children), {...restProps})}
245
244
  </View>
246
245
  );
247
246
  };
@@ -328,6 +327,7 @@ const HeaderToolkitAction: React.FC<any> = ({tintColor}) => {
328
327
  />
329
328
  );
330
329
  }
330
+ return null;
331
331
  };
332
332
 
333
333
  if (toolConfig) {
@@ -6,7 +6,7 @@ import {GridSystem} from '../Layout';
6
6
 
7
7
  const StackScreen: React.FC<ScreenParams> = props => {
8
8
  const {screen: Component, options}: ScreenParams = props.route.params;
9
- const {theme, showGrid, navigator} = useContext(ApplicationContext);
9
+ const {theme, showGrid} = useContext(ApplicationContext);
10
10
  const navigation = new Navigation(props.navigation, theme);
11
11
 
12
12
  const params = {
@@ -90,6 +90,7 @@ export interface ScreenProps extends ViewProps {
90
90
  scrollViewProps?: ScrollViewProps;
91
91
  footerComponent?: ReactNode;
92
92
  marginHeader?: number;
93
+ backgroundColor?: string;
93
94
  }
94
95
 
95
96
  export type ScreenParams = {
@@ -122,6 +123,7 @@ export type NavigationOptions = {
122
123
  preventBack?: PopupNotifyProps;
123
124
  surface?: boolean;
124
125
  headerTransparent?: boolean;
126
+ hiddenBack?: boolean;
125
127
  title?: string;
126
128
  headerTitle?: (props?: any) => React.ReactElement;
127
129
  headerTitleAlign?: 'left' | 'center';
@@ -133,6 +133,13 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
133
133
  };
134
134
  }
135
135
 
136
+ if (params.hiddenBack) {
137
+ options = {
138
+ ...options,
139
+ headerLeft: null,
140
+ };
141
+ }
142
+
136
143
  return {
137
144
  ...params,
138
145
  ...options,
package/Layout/Card.tsx CHANGED
@@ -132,7 +132,7 @@ const Card: React.FC<CardProps> = ({children, style, backgroundImage}) => {
132
132
  {!!backgroundImage && (
133
133
  <Image
134
134
  source={{uri: backgroundImage}}
135
- style={[style, styles.cardImage]}
135
+ style={[style, styles.imageBackground]}
136
136
  />
137
137
  )}
138
138
  {renderView(validateChildren(children, [Item]))}
package/Layout/Screen.tsx CHANGED
@@ -15,11 +15,12 @@ const Screen: React.FC<ScreenProps> = ({
15
15
  scrollable = false,
16
16
  navigation,
17
17
  marginHeader,
18
- useAnimatedHeader = false,
19
- useExtendedHeader = false,
18
+ useAnimatedHeader,
19
+ useExtendedHeader,
20
20
  headerBackground,
21
21
  scrollViewProps,
22
22
  footerComponent: Footer,
23
+ backgroundColor,
23
24
  }) => {
24
25
  const animatedValue = useRef<Animated.Value | undefined>(undefined);
25
26
  const {theme} = useContext(ApplicationContext);
@@ -44,15 +45,19 @@ const Screen: React.FC<ScreenProps> = ({
44
45
  }
45
46
 
46
47
  useEffect(() => {
47
- let title = {};
48
- if (useExtendedHeader) {
49
- title = {headerTitle: HeaderTitle};
48
+ if (useAnimatedHeader != undefined || useExtendedHeader != undefined) {
49
+ let title = {};
50
+ if (useExtendedHeader) {
51
+ title = {headerTitle: HeaderTitle};
52
+ }
53
+ setImmediate(() => {
54
+ navigation?.setOptions({
55
+ animatedValue: animatedValue.current,
56
+ headerTransparent: headerTransparent,
57
+ ...title,
58
+ });
59
+ });
50
60
  }
51
- navigation?.setOptions({
52
- animatedValue: animatedValue.current,
53
- headerTransparent,
54
- ...title,
55
- });
56
61
  }, [useExtendedHeader, useAnimatedHeader]);
57
62
 
58
63
  /**
@@ -130,7 +135,9 @@ const Screen: React.FC<ScreenProps> = ({
130
135
  };
131
136
 
132
137
  return (
133
- <View style={Styles.flex} accessibilityLabel={`ScreenContainer`}>
138
+ <View
139
+ style={[Styles.flex, {backgroundColor}]}
140
+ accessibilityLabel={`ScreenContainer`}>
134
141
  <View
135
142
  style={{
136
143
  position: 'absolute',
@@ -6,11 +6,13 @@ import {GridContext} from './index';
6
6
  import Item from './Item';
7
7
  import {ApplicationContext} from '../Application';
8
8
  import styles from './styles';
9
+ import {Image} from '../Image';
9
10
 
10
11
  const Section: React.FC<SectionProps> = ({
11
12
  children,
12
13
  useMargin = true,
13
14
  backgroundColor,
15
+ backgroundImage,
14
16
  }) => {
15
17
  const {showGrid} = useContext(ApplicationContext);
16
18
  const {numberOfColumns} = useGridSystem();
@@ -124,6 +126,12 @@ const Section: React.FC<SectionProps> = ({
124
126
  flexWrap: 'wrap',
125
127
  backgroundColor: backgroundColor,
126
128
  }}>
129
+ {!!backgroundImage && (
130
+ <Image
131
+ source={{uri: backgroundImage}}
132
+ style={styles.imageBackground}
133
+ />
134
+ )}
127
135
  {renderView(validateChildren(children, [Item]))}
128
136
  {showGrid && renderOverlay()}
129
137
  </View>
package/Layout/styles.ts CHANGED
@@ -58,7 +58,7 @@ export default StyleSheet.create({
58
58
  marginVertical: undefined,
59
59
  marginHorizontal: undefined,
60
60
  },
61
- cardImage: {
61
+ imageBackground: {
62
62
  position: 'absolute',
63
63
  top: 0,
64
64
  bottom: 0,
package/Layout/types.ts CHANGED
@@ -42,6 +42,8 @@ export interface SectionProps extends ViewProps {
42
42
  useMargin?: boolean;
43
43
 
44
44
  backgroundColor?: string;
45
+
46
+ backgroundImage?: string;
45
47
  }
46
48
 
47
49
  export interface ItemProps extends ViewProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.77.5",
3
+ "version": "0.77.7",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {