@@ -57,37 +57,54 @@ export const createHeaderBodyFooterComponent = (
57
57
} ,
58
58
} ) ;
59
59
60
- return ( { header, body, footer } ) => (
61
- < View
62
- style = {
63
- ! header && ! footer && ! body
64
- ? globalStyles . emptyWrappingView
65
- : header && footer && ! body
66
- ? globalStyles . wrappingViewWithoutBody
67
- : footer && ! body && ! header
68
- ? globalStyles . wrappingViewWithOnlyFooter
69
- : globalStyles . wrappingView
70
- }
71
- >
72
- { header ? (
60
+ return ( { header, body, footer } ) => {
61
+ const children = [ ] ;
62
+
63
+ if ( header ) {
64
+ children . push (
73
65
< View
74
66
{ ...( body && headerBodySpacing
75
67
? { style : localStyles . headerView }
76
68
: { } ) }
77
69
>
78
70
{ header }
79
71
</ View >
80
- ) : null }
81
- { body ? < View style = { globalStyles . bodyView } > { body } </ View > : null }
82
- { footer ? (
72
+ ) ;
73
+ }
74
+
75
+ if ( body ) {
76
+ children . push ( < View style = { globalStyles . bodyView } > { body } </ View > ) ;
77
+ }
78
+
79
+ if ( footer ) {
80
+ children . push (
83
81
< View
84
82
{ ...( body && bodyFooterSpacing
85
83
? { style : localStyles . footerView }
86
84
: { } ) }
87
85
>
88
86
{ footer }
89
87
</ View >
90
- ) : null }
91
- </ View >
92
- ) ;
88
+ ) ;
89
+ }
90
+
91
+ return (
92
+ < View
93
+ style = {
94
+ ! header && ! footer && ! body
95
+ ? globalStyles . emptyWrappingView
96
+ : header && footer && ! body
97
+ ? globalStyles . wrappingViewWithoutBody
98
+ : footer && ! body && ! header
99
+ ? globalStyles . wrappingViewWithOnlyFooter
100
+ : globalStyles . wrappingView
101
+ }
102
+ { ...( children . length === 0
103
+ ? { }
104
+ : children . length === 1
105
+ ? { children : children [ 0 ] }
106
+ : { children } ) }
107
+ />
108
+ ) ;
109
+ } ;
93
110
} ;
0 commit comments