@momo-kits/foundation 0.81.36-beta.2 → 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 +9 -2
- 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,11 +260,14 @@ const Screen = forwardRef(
|
|
|
259
260
|
/**
|
|
260
261
|
* build content for screen
|
|
261
262
|
*/
|
|
262
|
-
const renderContent = () => {
|
|
263
|
+
const renderContent = (children: any): any => {
|
|
263
264
|
const results = validateChildren(children, [Section, Card, undefined]);
|
|
264
265
|
if (Array.isArray(results)) {
|
|
265
266
|
return results.map((item, index) => {
|
|
266
267
|
const space = item?.props?.useMargin === false ? 0 : Spacing.M;
|
|
268
|
+
if (item?.type == Fragment) {
|
|
269
|
+
return renderContent(item?.props?.children);
|
|
270
|
+
}
|
|
267
271
|
if (item) {
|
|
268
272
|
return (
|
|
269
273
|
<View
|
|
@@ -280,6 +284,9 @@ const Screen = forwardRef(
|
|
|
280
284
|
} else {
|
|
281
285
|
const item: any = children;
|
|
282
286
|
const space = item?.props?.useMargin === false ? 0 : Spacing.M;
|
|
287
|
+
if (item?.type == Fragment) {
|
|
288
|
+
return renderContent(item?.props?.children);
|
|
289
|
+
}
|
|
283
290
|
return (
|
|
284
291
|
<View
|
|
285
292
|
key={`ScreenItem`}
|
|
@@ -328,7 +335,7 @@ const Screen = forwardRef(
|
|
|
328
335
|
style={[styles.screenBanner, {maxHeight: 210 + layoutOffset}]}>
|
|
329
336
|
{renderHeader()}
|
|
330
337
|
</View>
|
|
331
|
-
{renderContent()}
|
|
338
|
+
{renderContent(children)}
|
|
332
339
|
</Component>
|
|
333
340
|
{Footer && (
|
|
334
341
|
<View
|