@@ -105,15 +105,9 @@ export function registerTabs(): void {
105
105
tabStrip . _addChildFromBuilder ( 'items' , child . nativeView as TabStripItem ) ;
106
106
} else {
107
107
// console.log(`[tabStrip.insert] 2b [${parent} > ${child} @${atIndex}] => [${parent.childNodes}]`);
108
- items . forEach ( ( item ) => {
109
- tabStrip . _removeView ( item ) ;
110
- } ) ;
111
108
const itemsClone = items . slice ( ) ;
112
109
itemsClone . splice ( atIndex , 0 , child . nativeView as TabStripItem ) ;
113
110
tabStrip . items = itemsClone ;
114
- itemsClone . forEach ( ( item ) => {
115
- tabStrip . _addView ( item ) ;
116
- } ) ;
117
111
}
118
112
} else if ( child . nodeRole === 'item' ) {
119
113
if ( __DEV__ ) {
@@ -133,7 +127,6 @@ export function registerTabs(): void {
133
127
134
128
if ( child . nodeRole === 'items' ) {
135
129
tabStrip . items = ( tabStrip . items || [ ] ) . filter ( ( i ) => i !== child . nativeView ) ;
136
- tabStrip . _removeView ( child . nativeView ) ;
137
130
} else if ( child . nodeRole === 'item' ) {
138
131
if ( __DEV__ ) {
139
132
warn ( `Unable to remove child "${ child . nativeView . constructor . name } " from <tabStrip> as it had the nodeRole "item"; please correct it to "items".` ) ;
@@ -164,7 +157,7 @@ export function registerTabs(): void {
164
157
// keep these good practices in case it's ever refactored.
165
158
166
159
if ( child . nodeRole === 'label' ) {
167
- console . log ( `[tabStrip .insert] LABEL [${ parent } > ${ child } @${ atIndex } ] => [${ parent . childNodes } ]` ) ;
160
+ console . log ( `[tabStripItem .insert] LABEL [${ parent } > ${ child } @${ atIndex } ] => [${ parent . childNodes } ]` ) ;
168
161
if ( child . nativeView instanceof Label === false ) {
169
162
if ( __DEV__ ) {
170
163
warn ( `Unable to add child "${ child . nativeView . constructor . name } " to the items of <tabStripItem> as it is not an instance of Label.` ) ;
@@ -174,7 +167,7 @@ export function registerTabs(): void {
174
167
175
168
tabStripItem . label = child . nativeView as Label ;
176
169
} else if ( child . nodeRole === 'image' ) {
177
- console . log ( `[tabStrip .insert] IMAGE [${ parent } > ${ child } @${ atIndex } ] => [${ parent . childNodes } ]` ) ;
170
+ console . log ( `[tabStripItem .insert] IMAGE [${ parent } > ${ child } @${ atIndex } ] => [${ parent . childNodes } ]` ) ;
178
171
if ( child . nativeView instanceof Image === false ) {
179
172
if ( __DEV__ ) {
180
173
warn ( `Unable to add child "${ child . nativeView . constructor . name } " to the items of <tabStripItem> as it is not an instance of Image.` ) ;
@@ -184,7 +177,7 @@ export function registerTabs(): void {
184
177
185
178
tabStripItem . image = child . nativeView as Image ;
186
179
} else {
187
- console . log ( `[tabStrip .insert] OTHER [${ parent } > ${ child } @${ atIndex } ] => [${ parent . childNodes } ]` ) ;
180
+ console . log ( `[tabStripItem .insert] OTHER [${ parent } > ${ child } @${ atIndex } ] => [${ parent . childNodes } ]` ) ;
188
181
if ( __DEV__ ) {
189
182
warn (
190
183
`Unable to add child "${ child . nativeView . constructor . name } " to <tabStripItem> as it does not have a nodeRole specified; ` +
@@ -245,15 +238,9 @@ export function registerTabs(): void {
245
238
if ( typeof atIndex === 'undefined' || atIndex === items . length ) {
246
239
tabs . _addChildFromBuilder ( 'items' , child . nativeView as TabContentItem ) ;
247
240
} else {
248
- items . forEach ( ( item ) => {
249
- tabs . _removeView ( item ) ;
250
- } ) ;
251
241
const itemsClone = items . slice ( ) ;
252
242
itemsClone . splice ( atIndex , 0 , child . nativeView as TabContentItem ) ;
253
243
tabs . items = itemsClone ;
254
- itemsClone . forEach ( ( item ) => {
255
- tabs . _addView ( item ) ;
256
- } ) ;
257
244
}
258
245
} else if ( child . nodeRole === 'item' ) {
259
246
if ( __DEV__ ) {
@@ -274,7 +261,6 @@ export function registerTabs(): void {
274
261
tabs . tabStrip = null ; // Anything falsy should work.
275
262
} else if ( child . nodeRole === 'items' ) {
276
263
tabs . items = ( tabs . items || [ ] ) . filter ( ( i ) => i !== child . nativeView ) ;
277
- tabs . _removeView ( child . nativeView ) ;
278
264
} else if ( child . nodeRole === 'item' ) {
279
265
if ( __DEV__ ) {
280
266
warn ( `Unable to remove child "${ child . nativeView . constructor . name } " from <tabs> as it had the nodeRole "item"; please correct it to "items".` ) ;
0 commit comments