Skip to content

Commit

Permalink
Add flag concurrent root to Fabric render function (#21552)
Browse files Browse the repository at this point in the history
* Add flag concurrent root to Fabric render function

* Lint
  • Loading branch information
sammy-SC authored May 24, 2021
1 parent a731a51 commit 459c34f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/react-native-renderer/src/ReactFabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
getInspectorDataForViewTag,
getInspectorDataForViewAtPoint,
} from './ReactNativeFiberInspector';
import {LegacyRoot} from 'react-reconciler/src/ReactRootTags';
import {LegacyRoot, ConcurrentRoot} from 'react-reconciler/src/ReactRootTags';
import ReactSharedInternals from 'shared/ReactSharedInternals';
import getComponentNameFromType from 'shared/getComponentNameFromType';

Expand Down Expand Up @@ -201,13 +201,21 @@ function render(
element: Element<ElementType>,
containerTag: number,
callback: ?() => void,
concurrentRoot: ?boolean,
): ?ElementRef<ElementType> {
let root = roots.get(containerTag);

if (!root) {
// TODO (bvaughn): If we decide to keep the wrapper component,
// We could create a wrapper for containerTag as well to reduce special casing.
root = createContainer(containerTag, LegacyRoot, false, null, false, null);
root = createContainer(
containerTag,
concurrentRoot ? ConcurrentRoot : LegacyRoot,
false,
null,
false,
null,
);
roots.set(containerTag, root);
}
updateContainer(element, root, null, callback);
Expand Down

0 comments on commit 459c34f

Please sign in to comment.