Build React DOM Fiber package (#7173)

This builds a `react-dom-fiber.js` bundle which exposes ReactDOMFiber.
This allows early experiments with the new Fiber reconciler.

I also expose it in the npm package through `react-dom/fiber`.
(cherry picked from commit f7e0db9a18)
This commit is contained in:
Sebastian Markbåge
2016-10-03 16:18:51 -07:00
committed by Paul O’Shannessy
parent 5bc9daa125
commit 5c2a88a9a1
5 changed files with 81 additions and 5 deletions
+18 -3
View File
@@ -16,6 +16,8 @@ import type { HostChildren } from 'ReactFiberReconciler';
var ReactFiberReconciler = require('ReactFiberReconciler');
var warning = require('warning');
type DOMContainerElement = Element & { _reactRootContainer: ?Object };
type Container = Element;
@@ -56,9 +58,9 @@ var DOMRenderer = ReactFiberReconciler({
},
prepareUpdate(
domElement : Instance,
oldProps : Props,
newProps : Props,
domElement : Instance,
oldProps : Props,
newProps : Props,
children : HostChildren<Instance>
) : boolean {
return true;
@@ -82,9 +84,21 @@ var DOMRenderer = ReactFiberReconciler({
});
var warned = false;
function warnAboutUnstableUse() {
warning(
warned,
'You are using React DOM Fiber which is an experimental renderer. ' +
'It is likely to have bugs, breaking changes and is unsupported.'
);
warned = true;
}
var ReactDOM = {
render(element : ReactElement<any>, container : DOMContainerElement) {
warnAboutUnstableUse();
if (!container._reactRootContainer) {
container._reactRootContainer = DOMRenderer.mountContainer(element, container);
} else {
@@ -93,6 +107,7 @@ var ReactDOM = {
},
unmountComponentAtNode(container : DOMContainerElement) {
warnAboutUnstableUse();
const root = container._reactRootContainer;
if (root) {
// TODO: Is it safe to reset this now or should I wait since this