mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
This updates the host container root with new children. Currently, this is always called for updates because we don't track if any children reordered.
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
/**
|
|
* Copyright 2013-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
* @providesModule ReactFiberRoot
|
|
* @flow
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
import type { Fiber } from 'ReactFiber';
|
|
|
|
const { createHostContainerFiber } = require('ReactFiber');
|
|
|
|
export type FiberRoot = {
|
|
// Any additional information from the host associated with this root.
|
|
containerInfo: any,
|
|
// The currently active root fiber. This is the mutable root of the tree.
|
|
current: Fiber,
|
|
// Determines if this root has already been added to the schedule for work.
|
|
isScheduled: bool,
|
|
// The work schedule is a linked list.
|
|
nextScheduledRoot: ?FiberRoot,
|
|
};
|
|
|
|
exports.createFiberRoot = function(containerInfo : any) : FiberRoot {
|
|
// Cyclic construction. This cheats the type system right now because
|
|
// stateNode is any.
|
|
const uninitializedFiber = createHostContainerFiber();
|
|
const root = {
|
|
current: uninitializedFiber,
|
|
containerInfo: containerInfo,
|
|
isScheduled: false,
|
|
nextScheduledRoot: null,
|
|
};
|
|
uninitializedFiber.stateNode = root;
|
|
return root;
|
|
};
|