import type {Dispatcher} from 'react-reconciler/src/ReactInternalTypes';
import type {AsyncDispatcher} from 'react-reconciler/src/ReactInternalTypes';
import type {Transition} from './ReactStartTransition';
import type {GestureProvider, GestureOptions} from 'shared/ReactTypes';
import {enableGestureTransition} from 'shared/ReactFeatureFlags';
type onStartTransitionFinish = (Transition, mixed) => void;
type onStartGestureTransitionFinish = (
Transition,
GestureProvider,
?GestureOptions,
) => () => void;
export type SharedStateClient = {
H: null | Dispatcher,
A: null | AsyncDispatcher,
T: null | Transition,
S: null | onStartTransitionFinish,
G: null | onStartGestureTransitionFinish,
actQueue: null | Array<RendererTask>,
asyncTransitions: number,
isBatchingLegacy: boolean,
didScheduleLegacyUpdate: boolean,
didUsePromise: boolean,
thrownErrors: Array<mixed>,
getCurrentStack: null | (() => string),
recentlyCreatedOwnerStacks: 0,
};
export type RendererTask = boolean => RendererTask | null;
const ReactSharedInternals: SharedStateClient = ({
H: null,
A: null,
T: null,
S: null,
}: any);
if (enableGestureTransition) {
ReactSharedInternals.G = null;
}
if (__DEV__) {
ReactSharedInternals.actQueue = null;
ReactSharedInternals.asyncTransitions = 0;
ReactSharedInternals.isBatchingLegacy = false;
ReactSharedInternals.didScheduleLegacyUpdate = false;
ReactSharedInternals.didUsePromise = false;
ReactSharedInternals.thrownErrors = [];
ReactSharedInternals.getCurrentStack = (null: null | (() => string));
ReactSharedInternals.recentlyCreatedOwnerStacks = 0;
}
export default ReactSharedInternals;