Skip to content

Commit

Permalink
Check each renderer's config with Flow
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed May 18, 2018
1 parent d292923 commit 7c55e9e
Show file tree
Hide file tree
Showing 56 changed files with 1,044 additions and 983 deletions.
2 changes: 1 addition & 1 deletion packages/react-art/src/ReactART.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import React from 'react';
import * as ARTRenderer from 'react-reconciler/inline';
import * as ARTRenderer from 'react-reconciler/inline.art';
import Transform from 'art/core/transform';
import Mode from 'art/modes/current';
import FastNoSideEffects from 'art/modes/fast-noSideEffects';
Expand Down
82 changes: 3 additions & 79 deletions packages/react-art/src/ReactARTHostConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ function applyTextProps(instance, props, prevProps = {}) {
}
}

export * from 'shared/HostConfigWithNoPersistence';
export * from 'shared/HostConfigWithNoHydration';

export function appendInitialChild(parentInstance, child) {
if (typeof child === 'string') {
// Noop for string children of Text (eg <Text>{'foo'}{'bar'}</Text>)
Expand Down Expand Up @@ -333,8 +336,6 @@ function applyTextProps(instance, props, prevProps = {}) {
export const isPrimaryRenderer = false;

export const supportsMutation = true;
export const supportsPersistence = false;
export const supportsHydration = false;

export function appendChild(parentInstance, child) {
if (child.parentNode === parentInstance) {
Expand Down Expand Up @@ -388,80 +389,3 @@ function applyTextProps(instance, props, prevProps = {}) {
instance._applyProps(instance, newProps, oldProps);
}


export function cloneInstance() {
// not supported
}

export function createContainerChildSet() {
// not supported
}

export function appendChildToContainerChildSet() {
// not supported
}

export function finalizeContainerChildren() {
// not supported
}

export function replaceContainerChildren() {
// not supported
}


export function canHydrateInstance() {
// not supported
}

export function canHydrateTextInstance() {
// not supported
}

export function getNextHydratableSibling() {
// not supported
}

export function getFirstHydratableChild() {
// not supported
}

export function hydrateInstance() {
// not supported
}

export function hydrateTextInstance() {
// not supported
}

export function didNotMatchHydratedContainerTextInstance() {
// not supported
}

export function didNotMatchHydratedTextInstance() {
// not supported
}

export function didNotHydrateContainerInstance() {
// not supported
}

export function didNotHydrateInstance() {
// not supported
}

export function didNotFindHydratableContainerInstance() {
// not supported
}

export function didNotFindHydratableContainerTextInstance() {
// not supported
}

export function didNotFindHydratableInstance() {
// not supported
}

export function didNotFindHydratableTextInstance() {
// not supported
}
2 changes: 1 addition & 1 deletion packages/react-dom/src/client/ReactDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type {Container} from './ReactDOMHostConfig';
import '../shared/checkReact';
import './ReactDOMClientInjection';

import * as DOMRenderer from 'react-reconciler/inline';
import * as DOMRenderer from 'react-reconciler/inline.dom';
import * as ReactPortal from 'shared/ReactPortal';
import ExecutionEnvironment from 'fbjs/lib/ExecutionEnvironment';
import * as ReactGenericBatching from 'events/ReactGenericBatching';
Expand Down
45 changes: 21 additions & 24 deletions packages/react-dom/src/client/ReactDOMHostConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ import {
DOCUMENT_FRAGMENT_NODE,
} from '../shared/HTMLNodeType';


export type T = string;
export type P = Object;
export type I = Element;
export type TI = Text;
export type HI = Element | Text;
export type PI = Element | Text;
export type C = Element | Document;
export type CC = void;
export type CX = string | { namespace: string, ancestorInfo: mixed };
export type PL = Array<mixed>;


export type Container = Element | Document;
type Props = {
autoFocus?: boolean,
Expand Down Expand Up @@ -77,6 +90,10 @@ function shouldAutoFocusHostComponent(type: string, props: Props): boolean {
return false;
}


export * from 'shared/HostConfigWithNoPersistence';


export function getRootHostContext(rootContainerInstance: Container): HostContext {
let type;
let namespace;
Expand Down Expand Up @@ -111,6 +128,7 @@ export function getRootHostContext(rootContainerInstance: Container): HostContex
export function getChildHostContext(
parentHostContext: HostContext,
type: string,
instance: *
): HostContext {
if (__DEV__) {
const parentHostContextDev = ((parentHostContext: any): HostContextDev);
Expand All @@ -130,13 +148,13 @@ export function getPublicInstance(instance: Instance | TextInstance): * {
return instance;
}

export function prepareForCommit(): void {
export function prepareForCommit(containerInfo: *): void {
eventsEnabled = ReactBrowserEventEmitter.isEnabled();
selectionInformation = ReactInputSelection.getSelectionInformation();
ReactBrowserEventEmitter.setEnabled(false);
}

export function resetAfterCommit(): void {
export function resetAfterCommit(containerInfo: *): void {
ReactInputSelection.restoreSelection(selectionInformation);
selectionInformation = null;
ReactBrowserEventEmitter.setEnabled(eventsEnabled);
Expand Down Expand Up @@ -194,6 +212,7 @@ export function finalizeInitialChildren(
type: string,
props: Props,
rootContainerInstance: Container,
hostContext: *,
): boolean {
setInitialProperties(domElement, type, props, rootContainerInstance);
return shouldAutoFocusHostComponent(type, props);
Expand Down Expand Up @@ -267,7 +286,6 @@ export function prepareUpdate(
export const isPrimaryRenderer = true;

export const supportsMutation = true;
export const supportsPersistence = false;
export const supportsHydration = true;

export function commitMount(
Expand Down Expand Up @@ -565,24 +583,3 @@ export function prepareUpdate(
export const scheduleDeferredCallback = ReactScheduler.scheduleWork;
export const cancelDeferredCallback = ReactScheduler.cancelScheduledWork;


export function cloneInstance() {
// not supported
}

export function createContainerChildSet() {
// not supported
}

export function appendChildToContainerChildSet() {
// not supported
}

export function finalizeContainerChildren() {
// not supported
}

export function replaceContainerChildren() {
// not supported
}

4 changes: 2 additions & 2 deletions packages/react-native-renderer/src/ReactFabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {ReactNodeList} from 'shared/ReactTypes';

import './ReactFabricInjection';

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

import * as ReactPortal from 'shared/ReactPortal';
import * as ReactGenericBatching from 'events/ReactGenericBatching';
Expand Down Expand Up @@ -65,7 +65,7 @@ function findNodeHandle(componentOrHandle: any): ?number {
}
if (hostInstance.canonical) {
// Fabric
return hostInstance.canonical._nativeTag;
return (hostInstance.canonical: any)._nativeTag;
}
return hostInstance._nativeTag;
}
Expand Down
Loading

0 comments on commit 7c55e9e

Please sign in to comment.