Skip to content

Commit cf838d4

Browse files
committed
[WIP] Flow
1 parent a25661a commit cf838d4

30 files changed

+503
-382
lines changed

.flowconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<PROJECT_ROOT>/.*/__mocks__/.*
1616
<PROJECT_ROOT>/.*/__tests__/.*
1717

18+
# TODO
19+
<PROJECT_ROOT>/packages/react-noop-renderer/.*
20+
1821
[include]
1922

2023
[libs]
@@ -26,6 +29,11 @@ esproposal.class_static_fields=enable
2629
esproposal.class_instance_fields=enable
2730
unsafe.enable_getters_and_setters=true
2831

32+
# This would enable ReactDOM-specific check.
33+
# TODO: scripts that run this.
34+
# module.name_mapper='react-reconciler/inline.dom$' -> 'react-reconciler/inline.typed'
35+
# module.name_mapper='ReactFiberHostConfig' -> '<PROJECT_ROOT>/packages/react-dom/src/client/ReactDOMHostConfig'
36+
2937
munge_underscores=false
3038

3139
suppress_type=$FlowIssue

packages/react-art/src/ReactART.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import React from 'react';
9-
import * as ARTRenderer from 'react-reconciler/inline';
9+
import * as ARTRenderer from 'react-reconciler/inline.art';
1010
import Transform from 'art/core/transform';
1111
import Mode from 'art/modes/current';
1212
import FastNoSideEffects from 'art/modes/fast-noSideEffects';

packages/react-dom/src/client/ReactDOM.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import type {Container} from './ReactDOMHostConfig';
1919
import '../shared/checkReact';
2020
import './ReactDOMClientInjection';
2121

22-
import * as DOMRenderer from 'react-reconciler/inline';
22+
import * as DOMRenderer from 'react-reconciler/inline.dom';
2323
import * as ReactPortal from 'shared/ReactPortal';
2424
import ExecutionEnvironment from 'fbjs/lib/ExecutionEnvironment';
2525
import * as ReactGenericBatching from 'events/ReactGenericBatching';

packages/react-dom/src/client/ReactDOMHostConfig.js

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ import {
2424
DOCUMENT_FRAGMENT_NODE,
2525
} from '../shared/HTMLNodeType';
2626

27+
28+
export type T = string;
29+
export type P = any;
30+
export type I = Element;
31+
export type TI = Text;
32+
export type HI = any;
33+
export type PI = Element | Text;
34+
export type C = Element | Document;
35+
export type CC = void;
36+
export type CX = string | { namespace: string, ancestorInfo: mixed };
37+
export type PL = Array<mixed>;
38+
39+
2740
export type Container = Element | Document;
2841
type Props = {
2942
autoFocus?: boolean,
@@ -111,6 +124,7 @@ export function getRootHostContext(rootContainerInstance: Container): HostContex
111124
export function getChildHostContext(
112125
parentHostContext: HostContext,
113126
type: string,
127+
instance: *
114128
): HostContext {
115129
if (__DEV__) {
116130
const parentHostContextDev = ((parentHostContext: any): HostContextDev);
@@ -130,13 +144,13 @@ export function getPublicInstance(instance: Instance | TextInstance): * {
130144
return instance;
131145
}
132146

133-
export function prepareForCommit(): void {
147+
export function prepareForCommit(containerInfo: *): void {
134148
eventsEnabled = ReactBrowserEventEmitter.isEnabled();
135149
selectionInformation = ReactInputSelection.getSelectionInformation();
136150
ReactBrowserEventEmitter.setEnabled(false);
137151
}
138152

139-
export function resetAfterCommit(): void {
153+
export function resetAfterCommit(containerInfo: *): void {
140154
ReactInputSelection.restoreSelection(selectionInformation);
141155
selectionInformation = null;
142156
ReactBrowserEventEmitter.setEnabled(eventsEnabled);
@@ -194,6 +208,7 @@ export function finalizeInitialChildren(
194208
type: string,
195209
props: Props,
196210
rootContainerInstance: Container,
211+
hostContext: *,
197212
): boolean {
198213
setInitialProperties(domElement, type, props, rootContainerInstance);
199214
return shouldAutoFocusHostComponent(type, props);
@@ -566,23 +581,45 @@ export function prepareUpdate(
566581
export const cancelDeferredCallback = ReactScheduler.cancelScheduledWork;
567582

568583

569-
export function cloneInstance() {
584+
// TODO
585+
586+
export function cloneInstance(
587+
instance: Instance,
588+
updatePayload: null | Array<mixed>,
589+
type: string,
590+
oldProps: Props,
591+
newProps: Props,
592+
internalInstanceHandle: Object,
593+
keepChildren: boolean,
594+
recyclableInstance: Instance,
595+
): Instance {
596+
return instance;
570597
// not supported
571598
}
572599

573-
export function createContainerChildSet() {
600+
export function createContainerChildSet(
601+
container: Container
602+
): void {
574603
// not supported
575604
}
576605

577-
export function appendChildToContainerChildSet() {
606+
export function appendChildToContainerChildSet(
607+
childSet: void, child: Instance | TextInstance
608+
): void {
578609
// not supported
579610
}
580611

581-
export function finalizeContainerChildren() {
612+
export function finalizeContainerChildren(
613+
container: Container,
614+
newChildren: void
615+
) {
582616
// not supported
583617
}
584618

585-
export function replaceContainerChildren() {
619+
export function replaceContainerChildren(
620+
container: Container,
621+
newChildren: void
622+
) {
586623
// not supported
587624
}
588625

packages/react-native-renderer/src/ReactFabric.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type {ReactNodeList} from 'shared/ReactTypes';
1212

1313
import './ReactFabricInjection';
1414

15-
import * as ReactFabricRenderer from 'react-reconciler/inline';
15+
import * as ReactFabricRenderer from 'react-reconciler/inline.fabric';
1616

1717
import * as ReactPortal from 'shared/ReactPortal';
1818
import * as ReactGenericBatching from 'events/ReactGenericBatching';

packages/react-native-renderer/src/ReactNativeRenderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type {ReactNodeList} from 'shared/ReactTypes';
1212

1313
import './ReactNativeInjection';
1414

15-
import * as ReactNativeFiberRenderer from 'react-reconciler/inline';
15+
import * as ReactNativeFiberRenderer from 'react-reconciler/inline.native';
1616
import * as ReactPortal from 'shared/ReactPortal';
1717
import * as ReactGenericBatching from 'events/ReactGenericBatching';
1818
import ReactVersion from 'shared/ReactVersion';

packages/react-noop-renderer/src/createReactNoop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @flow
7+
* @ TODO !!!!!!!!!!!!!!!!!!
88
*/
99

1010
/**

packages/react-reconciler/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @flow
7+
* @ TODO !!!!!!!!!!!!!!!!!!
88
*/
99

1010
'use strict';
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// TODO
2+
export * from './src/ReactFiberReconciler';
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// TODO
2+
export * from './src/ReactFiberReconciler';

0 commit comments

Comments
 (0)