See the issue and the test case with original fix in https://github.com/facebook/react/pull/14802.

We'll need to fix it properly, see https://github.com/facebook/react/pull/14802#issuecomment-463277621.
constructor(renderer) {
    this._renderer = renderer;
    this._callbacks = [];
  }
  _renderer: ReactShallowRenderer;
  _callbacks: Array<any>;
  _enqueueCallback(callback, publicInstance) {
    if (typeof callback === 'function' && publicInstance) {
      this._callbacks.push({
        callback,
        publicInstance,
      });
    }
  }
  _invokeCallbacks() {
    const callbacks = this._callbacks;
    this._callbacks = [];
    callbacks.forEach(({callback, publicInstance}) => {
      callback.call(publicInstance);
    });
  }
  isMounted(publicInstance) {
    return !!this._renderer._element;
  }
  enqueueForceUpdate(publicInstance, callback, callerName) {
    this._enqueueCallback(callback, publicInstance);
    this._renderer._forcedUpdate = true;
    this._renderer.render(this._renderer._element, this._renderer._context);
  }
  enqueueReplaceState(publicInstance, completeState, callback, callerName) {