/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow strict-local
 * @format
 */

'use strict';

const React = require('React');

const ReactCurrentOwner =
  // $FlowFixMe
  React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;

function readContext<T>(Context: React.Context<T>): T {
  const dispatcher = ReactCurrentOwner.currentDispatcher;
  return dispatcher.readContext(Context);
}

module.exports = readContext;

/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow strict-local
 * @format
 */

'use strict';

const React = require('React');

const {ReactCurrentDispatcher, ReactCurrentOwner} =
  /* $FlowFixMe Flow doesn't know about React's internals for good reason,
              but for now, Relay needs the dispatcher to read context. */
  React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

function readContext<T>(Context: React.Context<T>): T {
  const dispatcher =
    ReactCurrentDispatcher != null
      ? ReactCurrentDispatcher.current
      : ReactCurrentOwner.currentDispatcher;
  return dispatcher.readContext(Context);
}

module.exports = readContext;

Update react-relay to account for React-internals change
Update react-relay to account for React-internals change

Reviewed By: threepointone

Differential Revision: D13653660

fbshipit-source-id: 124758f7a5804f9ed7525fa4e31f6f4b5844aa8f
