mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
* WIP:use public API * ReactPortal shifted to shared:all passed * wrote createPortal method for ReactNoop.(#11299) * imported ReactNodeList type into ReactNoop.(#11299) * createPortal method implemented.(#11299) * exec yarn prettier-all.(#11299)
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ import './ReactDOMClientInjection';
|
||||
|
||||
import ReactFiberReconciler from 'react-reconciler';
|
||||
// TODO: direct imports like some-package/src/* are bad. Fix me.
|
||||
import * as ReactPortal from 'react-reconciler/src/ReactPortal';
|
||||
import * as ReactPortal from 'shared/ReactPortal';
|
||||
import ExecutionEnvironment from 'fbjs/lib/ExecutionEnvironment';
|
||||
import * as ReactGenericBatching from 'events/ReactGenericBatching';
|
||||
import * as ReactControlledComponent from 'events/ReactControlledComponent';
|
||||
|
||||
@@ -12,7 +12,7 @@ import type {ReactNodeList} from 'shared/ReactTypes';
|
||||
|
||||
import './ReactNativeInjection';
|
||||
|
||||
import * as ReactPortal from 'react-reconciler/src/ReactPortal';
|
||||
import * as ReactPortal from 'shared/ReactPortal';
|
||||
import * as ReactGenericBatching from 'events/ReactGenericBatching';
|
||||
import TouchHistoryMath from 'events/TouchHistoryMath';
|
||||
import * as ReactGlobalSharedState from 'shared/ReactGlobalSharedState';
|
||||
|
||||
+10
-1
@@ -16,10 +16,11 @@
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {UpdateQueue} from 'react-reconciler/src/ReactFiberUpdateQueue';
|
||||
|
||||
import type {ReactNodeList} from 'shared/ReactTypes';
|
||||
import ReactFiberReconciler from 'react-reconciler';
|
||||
import {enablePersistentReconciler} from 'shared/ReactFeatureFlags';
|
||||
import * as ReactInstanceMap from 'shared/ReactInstanceMap';
|
||||
import * as ReactPortal from 'shared/ReactPortal';
|
||||
import emptyObject from 'fbjs/lib/emptyObject';
|
||||
import expect from 'expect';
|
||||
|
||||
@@ -318,6 +319,14 @@ var ReactNoop = {
|
||||
}
|
||||
},
|
||||
|
||||
createPortal(
|
||||
children: ReactNodeList,
|
||||
container: Container,
|
||||
key: ?string = null,
|
||||
) {
|
||||
return ReactPortal.createPortal(children, container, null, key);
|
||||
},
|
||||
|
||||
// Shortcut for testing a single root
|
||||
render(element: React$Element<any>, callback: ?Function) {
|
||||
ReactNoop.renderToRootWithID(element, DEFAULT_ROOT_ID, callback);
|
||||
|
||||
@@ -13,7 +13,6 @@ describe('ReactDebugFiberPerf', () => {
|
||||
let React;
|
||||
let ReactCallReturn;
|
||||
let ReactNoop;
|
||||
let ReactPortal;
|
||||
let PropTypes;
|
||||
|
||||
let root;
|
||||
@@ -121,8 +120,6 @@ describe('ReactDebugFiberPerf', () => {
|
||||
React = require('react');
|
||||
ReactNoop = require('react-noop-renderer');
|
||||
ReactCallReturn = require('react-call-return');
|
||||
// TODO: can we express this test with only public API?
|
||||
ReactPortal = require('../ReactPortal');
|
||||
PropTypes = require('prop-types');
|
||||
});
|
||||
|
||||
@@ -514,9 +511,7 @@ describe('ReactDebugFiberPerf', () => {
|
||||
it('supports portals', () => {
|
||||
const noopContainer = {children: []};
|
||||
ReactNoop.render(
|
||||
<Parent>
|
||||
{ReactPortal.createPortal(<Child />, noopContainer, null)}
|
||||
</Parent>,
|
||||
<Parent>{ReactNoop.createPortal(<Child />, noopContainer, null)}</Parent>,
|
||||
);
|
||||
ReactNoop.flush();
|
||||
expect(getFlameChart()).toMatchSnapshot();
|
||||
|
||||
@@ -24,7 +24,7 @@ describe('ReactPersistent', () => {
|
||||
|
||||
React = require('react');
|
||||
ReactNoop = require('react-noop-renderer');
|
||||
ReactPortal = require('../ReactPortal');
|
||||
ReactPortal = require('shared/ReactPortal');
|
||||
});
|
||||
|
||||
const DEFAULT_ROOT_ID = 'persistent-test';
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import type {ReactNodeList} from 'shared/ReactTypes';
|
||||
import 'InitializeCore';
|
||||
import './ReactNativeRTEventEmitter';
|
||||
|
||||
import * as ReactPortal from 'react-reconciler/src/ReactPortal';
|
||||
import * as ReactPortal from 'shared/ReactPortal';
|
||||
import * as ReactGenericBatching from 'events/ReactGenericBatching';
|
||||
import ReactVersion from 'shared/ReactVersion';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user