componentDidUpdate method

  1. @mustCallSuper
  2. @override
void componentDidUpdate(
  1. Map prevProps,
  2. Map prevState
)
override

ReactJS lifecycle method that is invoked immediately after the Component's updates are flushed to the DOM.

This method is not called for the initial render.

Use this as an opportunity to operate on the root node (DOM) when the Component has been updated as a result of the values of prevProps / prevState.

See: reactjs.org/docs/react-component.html#updating-componentdidupdate

Implementation

@mustCallSuper
@override
void componentDidUpdate(Map prevProps, Map prevState) {
  _transitionNotGuaranteed = false;

  S tPrevState = typedStateFactory(prevState);

  if (tPrevState.transitionPhase != state.transitionPhase) {
    if (state.transitionPhase != TransitionPhase.SHOWING) {
      // Allows the AbstractTransitionComponent to handle state changes that interrupt state
      // changes waiting on transitionend events.
      _cancelTransitionEventListener();
    }

    switch (state.transitionPhase!) {
      case TransitionPhase.PRE_SHOWING:
        handlePreShowing();
        break;
      case TransitionPhase.SHOWING:
        handleShowing();
        break;
      case TransitionPhase.HIDING:
        _transitionNotGuaranteed = tPrevState.transitionPhase == TransitionPhase.SHOWING;
        handleHiding();
        break;
      case TransitionPhase.HIDDEN:
        handleHidden();
        break;
      case TransitionPhase.SHOWN:
        handleShown();
        break;
    }
  }
}