@momo-kits/foundation 0.81.36-beta.1 → 0.81.36-beta.3
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 +23 -14
- package/package.json +1 -1
package/Layout/Screen.tsx
CHANGED
|
@@ -12,6 +12,7 @@ import {useHeaderHeight} from '@react-navigation/stack';
|
|
|
12
12
|
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
13
13
|
import React, {
|
|
14
14
|
forwardRef,
|
|
15
|
+
Fragment,
|
|
15
16
|
ReactNode,
|
|
16
17
|
useContext,
|
|
17
18
|
useEffect,
|
|
@@ -259,25 +260,33 @@ const Screen = forwardRef(
|
|
|
259
260
|
/**
|
|
260
261
|
* build content for screen
|
|
261
262
|
*/
|
|
262
|
-
const renderContent = () => {
|
|
263
|
-
const results = validateChildren(children, [Section, Card]);
|
|
263
|
+
const renderContent = (children: any): any => {
|
|
264
|
+
const results = validateChildren(children, [Section, Card, undefined]);
|
|
264
265
|
if (Array.isArray(results)) {
|
|
265
266
|
return results.map((item, index) => {
|
|
266
|
-
const space = item
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
267
|
+
const space = item?.props?.useMargin === false ? 0 : Spacing.M;
|
|
268
|
+
if (item?.type == Fragment) {
|
|
269
|
+
return renderContent(item?.props?.children);
|
|
270
|
+
}
|
|
271
|
+
if (item) {
|
|
272
|
+
return (
|
|
273
|
+
<View
|
|
274
|
+
key={`ScreenItem${index}`}
|
|
275
|
+
style={{
|
|
276
|
+
marginTop: space,
|
|
277
|
+
flex: item.props?.expanded ? 1 : undefined,
|
|
278
|
+
}}>
|
|
279
|
+
{item}
|
|
280
|
+
</View>
|
|
281
|
+
);
|
|
282
|
+
}
|
|
277
283
|
});
|
|
278
284
|
} else {
|
|
279
285
|
const item: any = children;
|
|
280
286
|
const space = item?.props?.useMargin === false ? 0 : Spacing.M;
|
|
287
|
+
if (item?.type == Fragment) {
|
|
288
|
+
return renderContent(item?.props?.children);
|
|
289
|
+
}
|
|
281
290
|
return (
|
|
282
291
|
<View
|
|
283
292
|
key={`ScreenItem`}
|
|
@@ -326,7 +335,7 @@ const Screen = forwardRef(
|
|
|
326
335
|
style={[styles.screenBanner, {maxHeight: 210 + layoutOffset}]}>
|
|
327
336
|
{renderHeader()}
|
|
328
337
|
</View>
|
|
329
|
-
{renderContent()}
|
|
338
|
+
{renderContent(children)}
|
|
330
339
|
</Component>
|
|
331
340
|
{Footer && (
|
|
332
341
|
<View
|