@@ -139,7 +139,7 @@ export default class Header extends NativeBaseComponent {
139139 </ View > )
140140 }
141141 }
142- else {
142+ else if ( buttons . length > 1 ) {
143143 if ( Platform . OS === 'ios' ) {
144144 newChildren . push ( < View key = 'title' style = { { position : 'absolute' , left : 0 , right : 0 , top : 13 , bottom : 0 , alignSelf : 'center' , justifyContent : 'center' } } >
145145 { [ title [ 0 ] , subtitle [ 0 ] ] }
@@ -171,6 +171,31 @@ export default class Header extends NativeBaseComponent {
171171 }
172172
173173 }
174+ else {
175+ if ( Platform . OS === 'ios' ) {
176+ newChildren . push ( < View key = 'title' style = { { position : 'absolute' , left : 0 , right : 0 , top : 13 , bottom : 0 , alignSelf : 'center' , justifyContent : 'center' } } >
177+ { [ title [ 0 ] , subtitle [ 0 ] ] }
178+ </ View > )
179+
180+ if ( childrenArray . length > 1 ) {
181+ for ( let i = 1 ; i < childrenArray . length ; i ++ ) {
182+ newChildren . push ( < View key = { 'btn' + ( i + 1 ) } style = { { alignItems : 'center' , justifyContent : 'flex-start' , flexDirection : 'row' , marginRight : - 14 } } >
183+ { React . cloneElement ( childrenArray [ i ] , { } ) }
184+ </ View > )
185+ }
186+ }
187+ }
188+ else {
189+ newChildren . push ( < View key = 'title' style = { { flex : 3 , alignSelf : 'stretch' , justifyContent : 'center' } } >
190+ { [ title [ 0 ] ] }
191+ </ View > )
192+ for ( let i = 1 ; i < childrenArray . length ; i ++ ) {
193+ newChildren . push ( < View key = { 'btn' + ( i + 1 ) } style = { { alignItems : 'center' , justifyContent : 'flex-start' , flexDirection : 'row' , marginRight : - 7 } } >
194+ { React . cloneElement ( childrenArray [ i ] , { } ) }
195+ </ View > )
196+ }
197+ }
198+ }
174199 return newChildren ;
175200 }
176201 }
0 commit comments