(finishedRoot, current, finishedWork, currentTime, committedExpirationTime)
| 10489 | } |
| 10490 | |
| 10491 | function commitLifeCycles(finishedRoot, current, finishedWork, currentTime, committedExpirationTime) { |
| 10492 | switch (finishedWork.tag) { |
| 10493 | case ClassComponent: |
| 10494 | { |
| 10495 | var _instance = finishedWork.stateNode; |
| 10496 | if (finishedWork.effectTag & Update) { |
| 10497 | if (current === null) { |
| 10498 | startPhaseTimer(finishedWork, 'componentDidMount'); |
| 10499 | _instance.props = finishedWork.memoizedProps; |
| 10500 | _instance.state = finishedWork.memoizedState; |
| 10501 | _instance.componentDidMount(); |
| 10502 | stopPhaseTimer(); |
| 10503 | } else { |
| 10504 | var prevProps = current.memoizedProps; |
| 10505 | var prevState = current.memoizedState; |
| 10506 | startPhaseTimer(finishedWork, 'componentDidUpdate'); |
| 10507 | _instance.props = finishedWork.memoizedProps; |
| 10508 | _instance.state = finishedWork.memoizedState; |
| 10509 | _instance.componentDidUpdate(prevProps, prevState); |
| 10510 | stopPhaseTimer(); |
| 10511 | } |
| 10512 | } |
| 10513 | var updateQueue = finishedWork.updateQueue; |
| 10514 | if (updateQueue !== null) { |
| 10515 | commitCallbacks(updateQueue, _instance); |
| 10516 | } |
| 10517 | return; |
| 10518 | } |
| 10519 | case HostRoot: |
| 10520 | { |
| 10521 | var _updateQueue = finishedWork.updateQueue; |
| 10522 | if (_updateQueue !== null) { |
| 10523 | var _instance2 = null; |
| 10524 | if (finishedWork.child !== null) { |
| 10525 | switch (finishedWork.child.tag) { |
| 10526 | case HostComponent: |
| 10527 | _instance2 = getPublicInstance(finishedWork.child.stateNode); |
| 10528 | break; |
| 10529 | case ClassComponent: |
| 10530 | _instance2 = finishedWork.child.stateNode; |
| 10531 | break; |
| 10532 | } |
| 10533 | } |
| 10534 | commitCallbacks(_updateQueue, _instance2); |
| 10535 | } |
| 10536 | return; |
| 10537 | } |
| 10538 | case HostComponent: |
| 10539 | { |
| 10540 | var _instance3 = finishedWork.stateNode; |
| 10541 | |
| 10542 | // Renderers may schedule work to be done after host components are mounted |
| 10543 | // (eg DOM renderer may schedule auto-focus for inputs and form controls). |
| 10544 | // These effects should only be committed when components are first mounted, |
| 10545 | // aka when there is no current/alternate. |
| 10546 | if (current === null && finishedWork.effectTag & Update) { |
| 10547 | var type = finishedWork.type; |
| 10548 | var props = finishedWork.memoizedProps; |
no test coverage detected