( parent: Instance, workInProgress: Fiber, needsVisibilityToggle: boolean, isHidden: boolean, )
| 238 | } |
| 239 | |
| 240 | function appendAllChildren( |
| 241 | parent: Instance, |
| 242 | workInProgress: Fiber, |
| 243 | needsVisibilityToggle: boolean, |
| 244 | isHidden: boolean, |
| 245 | ) { |
| 246 | if (supportsMutation) { |
| 247 | // We only have the top Fiber that was created but we need recurse down its |
| 248 | // children to find all the terminal nodes. |
| 249 | let node = workInProgress.child; |
| 250 | while (node !== null) { |
| 251 | if (node.tag === HostComponent || node.tag === HostText) { |
| 252 | appendInitialChild(parent, node.stateNode); |
| 253 | } else if ( |
| 254 | node.tag === HostPortal || |
| 255 | (supportsSingletons ? node.tag === HostSingleton : false) |
| 256 | ) { |
| 257 | // If we have a portal child, then we don't want to traverse |
| 258 | // down its children. Instead, we'll get insertions from each child in |
| 259 | // the portal directly. |
| 260 | // If we have a HostSingleton it will be placed independently |
| 261 | } else if (node.child !== null) { |
| 262 | node.child.return = node; |
| 263 | node = node.child; |
| 264 | continue; |
| 265 | } |
| 266 | if (node === workInProgress) { |
| 267 | return; |
| 268 | } |
| 269 | // $FlowFixMe[incompatible-use] found when upgrading Flow |
| 270 | while (node.sibling === null) { |
| 271 | // $FlowFixMe[incompatible-use] found when upgrading Flow |
| 272 | if (node.return === null || node.return === workInProgress) { |
| 273 | return; |
| 274 | } |
| 275 | node = node.return; |
| 276 | } |
| 277 | // $FlowFixMe[incompatible-use] found when upgrading Flow |
| 278 | node.sibling.return = node.return; |
| 279 | node = node.sibling; |
| 280 | } |
| 281 | } else if (supportsPersistence) { |
| 282 | // We only have the top Fiber that was created but we need recurse down its |
| 283 | // children to find all the terminal nodes. |
| 284 | let node = workInProgress.child; |
| 285 | while (node !== null) { |
| 286 | if (node.tag === HostComponent) { |
| 287 | let instance = node.stateNode; |
| 288 | if (needsVisibilityToggle && isHidden) { |
| 289 | // This child is inside a timed out tree. Hide it. |
| 290 | const props = node.memoizedProps; |
| 291 | const type = node.type; |
| 292 | instance = cloneHiddenInstance(instance, type, props); |
| 293 | } |
| 294 | appendInitialChild(parent, instance); |
| 295 | } else if (node.tag === HostText) { |
| 296 | let instance = node.stateNode; |
| 297 | if (needsVisibilityToggle && isHidden) { |
no test coverage detected