Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-renderer/src/ReactNativeRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
11 changes: 10 additions & 1 deletion packages/react-noop-renderer/src/ReactNoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('ReactDebugFiberPerf', () => {
let React;
let ReactCallReturn;
let ReactNoop;
let ReactPortal;
let PropTypes;

let root;
Expand Down Expand Up @@ -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');
});

Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-rt-renderer/src/ReactNativeRT.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down