@samitouri / QOS-React / commits / 459c34fde6

Add flag concurrent root to Fabric render function (#21552)

* Add flag concurrent root to Fabric render function * Lint

Samuel Susla committed May 24, 2021 at 15:56 UTC 459c34fde6e22475b09e7215c8d35a513c4fa7b4
1 file changed +10 -2
packages/react-native-renderer/src/ReactFabric.js
+10 -2
@@ -40,7 +40,7 @@ import {
40 getInspectorDataForViewTag,
41 getInspectorDataForViewAtPoint,
42 } from './ReactNativeFiberInspector';
43 -import {LegacyRoot} from 'react-reconciler/src/ReactRootTags';
43 +import {LegacyRoot, ConcurrentRoot} from 'react-reconciler/src/ReactRootTags';
44 import ReactSharedInternals from 'shared/ReactSharedInternals';
45 import getComponentNameFromType from 'shared/getComponentNameFromType';
46
@@ -201,13 +201,21 @@ function render(
201 element: Element<ElementType>,
202 containerTag: number,
203 callback: ?() => void,
204 + concurrentRoot: ?boolean,
205 ): ?ElementRef<ElementType> {
206 let root = roots.get(containerTag);
207
208 if (!root) {
209 // TODO (bvaughn): If we decide to keep the wrapper component,
210 // We could create a wrapper for containerTag as well to reduce special casing.
210 - root = createContainer(containerTag, LegacyRoot, false, null, false, null);
211 + root = createContainer(
212 + containerTag,
213 + concurrentRoot ? ConcurrentRoot : LegacyRoot,
214 + false,
215 + null,
216 + false,
217 + null,
218 + );
219 roots.set(containerTag, root);
220 }
221 updateContainer(element, root, null, callback);