2016-05-27 09:13:21 +08:00
|
|
|
/**
|
2017-09-25 04:48:13 +08:00
|
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
2016-05-27 09:13:21 +08:00
|
|
|
*
|
2017-09-25 04:48:13 +08:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2016-05-27 09:13:21 +08:00
|
|
|
*
|
|
|
|
|
* @flow
|
2017-11-16 00:17:15 +08:00
|
|
|
* @providesModule ReactTypes
|
2016-05-27 09:13:21 +08:00
|
|
|
*/
|
|
|
|
|
|
2017-03-14 08:05:18 +08:00
|
|
|
export type ReactNode =
|
2017-08-29 05:39:58 +08:00
|
|
|
| React$Element<any>
|
2017-12-13 07:04:40 +08:00
|
|
|
| ReactCall<any>
|
|
|
|
|
| ReactReturn<any>
|
2017-03-14 08:05:18 +08:00
|
|
|
| ReactPortal
|
|
|
|
|
| ReactText
|
2018-01-25 11:36:22 +08:00
|
|
|
| ReactFragment
|
|
|
|
|
| ReactProvider<any>
|
|
|
|
|
| ReactConsumer<any>;
|
2016-05-27 09:13:21 +08:00
|
|
|
|
2017-08-29 05:39:58 +08:00
|
|
|
export type ReactFragment = ReactEmpty | Iterable<React$Node>;
|
2016-05-27 09:13:21 +08:00
|
|
|
|
2017-08-29 05:39:58 +08:00
|
|
|
export type ReactNodeList = ReactEmpty | React$Node;
|
2016-05-27 09:13:21 +08:00
|
|
|
|
|
|
|
|
export type ReactText = string | number;
|
|
|
|
|
|
|
|
|
|
export type ReactEmpty = null | void | boolean;
|
2017-05-25 00:06:30 +08:00
|
|
|
|
2017-12-13 07:04:40 +08:00
|
|
|
export type ReactCall<V> = {
|
2017-05-25 00:06:30 +08:00
|
|
|
$$typeof: Symbol | number,
|
2017-12-13 07:04:40 +08:00
|
|
|
type: Symbol | number,
|
2017-05-25 00:06:30 +08:00
|
|
|
key: null | string,
|
2017-12-13 07:04:40 +08:00
|
|
|
ref: null,
|
|
|
|
|
props: {
|
|
|
|
|
props: any,
|
|
|
|
|
// This should be a more specific CallHandler
|
|
|
|
|
handler: (props: any, returns: Array<V>) => ReactNodeList,
|
|
|
|
|
children?: ReactNodeList,
|
|
|
|
|
},
|
2017-05-25 00:06:30 +08:00
|
|
|
};
|
|
|
|
|
|
2017-12-13 07:04:40 +08:00
|
|
|
export type ReactReturn<V> = {
|
2017-05-25 00:06:30 +08:00
|
|
|
$$typeof: Symbol | number,
|
2017-12-13 07:04:40 +08:00
|
|
|
type: Symbol | number,
|
|
|
|
|
key: null,
|
|
|
|
|
ref: null,
|
|
|
|
|
props: {
|
|
|
|
|
value: V,
|
|
|
|
|
},
|
2017-05-25 00:06:30 +08:00
|
|
|
};
|
|
|
|
|
|
2018-01-25 11:36:22 +08:00
|
|
|
export type ReactProvider<T> = {
|
|
|
|
|
$$typeof: Symbol | number,
|
|
|
|
|
type: ReactProviderType<T>,
|
|
|
|
|
key: null | string,
|
|
|
|
|
ref: null,
|
|
|
|
|
props: {
|
|
|
|
|
value: T,
|
|
|
|
|
children?: ReactNodeList,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type ReactProviderType<T> = {
|
|
|
|
|
$$typeof: Symbol | number,
|
|
|
|
|
context: ReactContext<T>,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type ReactConsumer<T> = {
|
|
|
|
|
$$typeof: Symbol | number,
|
|
|
|
|
type: ReactContext<T>,
|
|
|
|
|
key: null | string,
|
|
|
|
|
ref: null,
|
|
|
|
|
props: {
|
2018-01-31 05:06:12 +08:00
|
|
|
children: (value: T) => ReactNodeList,
|
2018-03-23 23:58:49 +08:00
|
|
|
unstable_observedBits?: number,
|
2018-01-25 11:36:22 +08:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type ReactContext<T> = {
|
|
|
|
|
$$typeof: Symbol | number,
|
2018-01-31 05:06:12 +08:00
|
|
|
Consumer: ReactContext<T>,
|
|
|
|
|
Provider: ReactProviderType<T>,
|
2018-03-13 05:30:47 +08:00
|
|
|
|
|
|
|
|
_calculateChangedBits: ((a: T, b: T) => number) | null,
|
|
|
|
|
_defaultValue: T,
|
|
|
|
|
|
|
|
|
|
_currentValue: T,
|
|
|
|
|
_changedBits: number,
|
2018-01-25 11:36:22 +08:00
|
|
|
|
|
|
|
|
// DEV only
|
|
|
|
|
_currentRenderer?: Object | null,
|
|
|
|
|
};
|
|
|
|
|
|
2017-05-25 00:06:30 +08:00
|
|
|
export type ReactPortal = {
|
|
|
|
|
$$typeof: Symbol | number,
|
|
|
|
|
key: null | string,
|
|
|
|
|
containerInfo: any,
|
|
|
|
|
children: ReactNodeList,
|
|
|
|
|
// TODO: figure out the API for cross-renderer implementation.
|
|
|
|
|
implementation: any,
|
|
|
|
|
};
|
2018-02-07 04:19:49 +08:00
|
|
|
|
|
|
|
|
export type RefObject = {|
|
2018-03-15 00:43:20 +08:00
|
|
|
current: any,
|
2018-02-07 04:19:49 +08:00
|
|
|
|};
|