WIP - not sure how to get the Flow type working properly
Dominic Gannaway committed
Mar 2, 2017 at 21:50 UTC
da9d91829e094fef634ce928b949512db3d07cdf
4 files changed
+20
-102
flow/environment.js
deleted
-20
@@ -1,20 +0,0 @@
1
-/**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- *
9
- * @flow
10
- */
11
-
12
-/* eslint-disable */
13
-
14
-declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: any; /*?{
15
- inject: ?((stuff: Object) => void)
16
-};*/
17
-
18
-// temporary patches for React.Component and React.Element
19
-declare var ReactComponent: typeof React$Component;
20
-declare var ReactElement: typeof React$Element;
flow/react-native-host-hooks.js
deleted
-64
@@ -1,64 +0,0 @@
1
-/**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- *
9
- * @flow
10
- */
11
-
12
-/* eslint-disable */
13
-
14
-declare module 'deepDiffer' {
15
- declare function exports(one: any, two: any): bool;
16
-}
17
-declare module 'deepFreezeAndThrowOnMutationInDev' {
18
- declare function exports<T>(obj : T) : T;
19
-}
20
-declare module 'flattenStyle' { }
21
-declare module 'InitializeCore' { }
22
-declare module 'RCTEventEmitter' {
23
- declare function register() : void;
24
-}
25
-declare module 'TextInputState' {
26
- declare function blurTextInput(object : any) : void;
27
- declare function focusTextInput(object : any) : void;
28
-}
29
-declare module 'UIManager' {
30
- declare var customBubblingEventTypes : Object;
31
- declare var customDirectEventTypes : Object;
32
- declare function createView(
33
- reactTag : number,
34
- viewName : string,
35
- rootTag : number,
36
- props : ?Object,
37
- ) : void;
38
- declare function manageChildren(
39
- containerTag : number,
40
- moveFromIndices : Array<number>,
41
- moveToIndices : Array<number>,
42
- addChildReactTags : Array<number>,
43
- addAtIndices : Array<number>,
44
- removeAtIndices : Array<number>
45
- ) : void;
46
- declare function measure() : void;
47
- declare function measureInWindow() : void;
48
- declare function measureLayout() : void;
49
- declare function removeRootView() : void;
50
- declare function removeSubviewsFromContainerWithID() : void;
51
- declare function replaceExistingNonRootView() : void;
52
- declare function setChildren(
53
- containerTag : number,
54
- reactTags : Array<number>,
55
- ) : void;
56
- declare function updateView(
57
- reactTag : number,
58
- viewName : string,
59
- props : ?Object,
60
- ) : void;
61
-}
62
-declare module 'View' {
63
- declare var exports : typeof ReactComponent;
64
-}
src/isomorphic/classic/element/ReactDebugCurrentFrame.js
+6
-8
@@ -14,16 +14,18 @@
14
15
import type { Fiber } from 'ReactFiber';
16
import type { DebugID } from 'ReactInstanceType';
17
-import type { ComponentTreeHookType } from '../../hooks/ReactComponentTreeHook';
17
+import type { ComponentTreeHookDevType } from '../../hooks/ReactComponentTreeHook';
18
19
const ReactDebugCurrentFrame = {};
20
21
if (__DEV__) {
22
+ // how do a state that ReactComponentTreeHook is using the ComponentTreeHookDevType type?
23
+ const ReactComponentTreeHook: ComponentTreeHookDevType = require('ReactComponentTreeHook');
24
const {
25
getStackAddendumByID,
26
getStackAddendumByWorkInProgressFiber,
27
getCurrentStackAddendum,
26
- }: ComponentTreeHookType = require('ReactComponentTreeHook');
28
+ } = ReactComponentTreeHook;
29
// Component that is being worked on
30
ReactDebugCurrentFrame.current = (null : Fiber | DebugID | null);
31
@@ -38,9 +40,7 @@ if (__DEV__) {
40
if (typeof current === 'number') {
41
// DebugID from Stack.
42
const debugID = current;
41
- if (getStackAddendumByID) {
42
- stack = getStackAddendumByID(debugID);
43
- }
43
+ stack = getStackAddendumByID(debugID);
44
} else if (typeof current.tag === 'number') {
45
// This is a Fiber.
46
// The stack will only be correct if this is a work in progress
@@ -49,9 +49,7 @@ if (__DEV__) {
49
stack = getStackAddendumByWorkInProgressFiber(workInProgress);
50
}
51
} else if (element !== null) {
52
- if (getCurrentStackAddendum) {
53
- stack = getCurrentStackAddendum(element);
54
- }
52
+ stack = getCurrentStackAddendum(element);
53
}
54
return stack;
55
};
src/isomorphic/hooks/ReactComponentTreeHook.js
+14
-10
@@ -57,16 +57,20 @@ function describeFiber(fiber : Fiber) : string {
57
58
export type ComponentTreeHookType = {
59
getStackAddendumByWorkInProgressFiber: (Fiber) => any,
60
- getStackAddendumByID?: () => any,
61
- getCurrentStackAddendum?: () => any,
62
- purgeUnmountedComponents?: () => any,
63
- getOwnerID?: (DebugID) => any,
64
- getParentID?: (DebugID) => any,
65
- getDisplayName?: (DebugID) => any,
66
- getText?: (DebugID) => any,
67
- getUpdateCount?: (DebugID) => any,
68
- getChildIDs?: (DebugID) => any,
69
- getRegisteredIDs?: () => any,
60
+};
61
+
62
+export type ComponentTreeHookDevType = {
63
+ getStackAddendumByWorkInProgressFiber: (Fiber) => any,
64
+ getStackAddendumByID: () => any,
65
+ getCurrentStackAddendum: () => any,
66
+ purgeUnmountedComponents: () => any,
67
+ getOwnerID: (DebugID) => any,
68
+ getParentID: (DebugID) => any,
69
+ getDisplayName: (DebugID) => any,
70
+ getText: (DebugID) => any,
71
+ getUpdateCount: (DebugID) => any,
72
+ getChildIDs: (DebugID) => any,
73
+ getRegisteredIDs: () => any,
74
};
75
76
var ReactComponentTreeHook: ComponentTreeHookType = {