Files
react/scripts/flow/react-native-host-hooks.js
Sebastian Markbåge 696908f496 [CS] Implement Some Stuff (#11390)
* Implement CS first take

This is using a pure JS API. This should probably switch to native hooks
at some later point but I'll start ironing out issues at this level first.

* Use async scheduling by default

The scheduled callback gets called immediately in render with infinite
time for now. Later this will be per root and abortable.

* Fix up the type signature of the ReactNativeCSType export

* Add escape hatch for special cased children

Working around the fact that we can't map arbitrary children slots. Just
the "children" prop.

* Readd providesModule for ReactNativeCSTypes

* Fix lint

* Fix ReactNativeTypes providesModule and CI check

* Special case a parent instance that doesn't have a props object

CSCustom can be anything here. Ugly but whatevs.

* Don't forget to store stateUpdater so that we can trigger updates

* Fix test
2017-10-27 20:05:34 -07:00

122 lines
3.2 KiB
JavaScript

/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
/* eslint-disable */
declare module 'deepDiffer' {
declare function exports(one: any, two: any): boolean;
}
declare module 'deepFreezeAndThrowOnMutationInDev' {
declare function exports<T>(obj: T): T;
}
declare module 'flattenStyle' {
}
declare module 'InitializeCore' {
}
declare module 'RCTEventEmitter' {
declare function register(mixed): void;
}
declare module 'TextInputState' {
declare function blurTextInput(object: any): void;
declare function focusTextInput(object: any): void;
}
declare module 'ExceptionsManager' {
declare function handleException(error: Error, isFatal: boolean): void;
}
declare module 'Platform' {
declare var OS: string;
}
declare module 'UIManager' {
declare var customBubblingEventTypes: Object;
declare var customDirectEventTypes: Object;
declare function createView(
reactTag: number,
viewName: string,
rootTag: number,
props: ?Object
): void;
declare function manageChildren(
containerTag: number,
moveFromIndices: Array<number>,
moveToIndices: Array<number>,
addChildReactTags: Array<number>,
addAtIndices: Array<number>,
removeAtIndices: Array<number>
): void;
declare function measure(hostComponent: mixed, callback: Function): void;
declare function measureInWindow(
nativeTag: ?number,
callback: Function
): void;
declare function measureLayout(
nativeTag: mixed,
nativeNode: number,
onFail: Function,
onSuccess: Function
): void;
declare function removeRootView(containerTag: number): void;
declare function removeSubviewsFromContainerWithID(containerId: number): void;
declare function replaceExistingNonRootView(): void;
declare function setChildren(
containerTag: number,
reactTags: Array<number>
): void;
declare function updateView(
reactTag: number,
viewName: string,
props: ?Object
): void;
declare function __takeSnapshot(
view?: 'window' | Element<any> | number,
options?: {
width?: number,
height?: number,
format?: 'png' | 'jpeg',
quality?: number,
}
): Promise<any>;
}
declare module 'View' {
declare var exports: typeof React$Component;
}
declare module 'RTManager' {
declare function createNode(
tag: number,
classType: string,
props: ?Object
): void;
declare function beginUpdates(): void;
declare function appendChildToContext(
contextTag: number,
childTag: number
): void;
declare function appendChild(parentTag: number, childTag: number): void;
declare function prependChild(childTag: number, beforeTag: number): void;
declare function deleteChild(childTag: number): void;
declare function updateNode(tag: number, props: ?Object): void;
declare function completeUpdates(): void;
}
declare module 'BatchedBridge' {
declare function registerCallableModule(name: string, module: Object): void;
}
declare module 'CSComponent' {
declare type Element = any;
declare type Options<Instance> = any;
}
declare module 'CSStatefulComponent' {
declare function exports(spec: any): any;
}