@samitouri / QOS-React-2 / commits / d8570ec6ea

Create ReactFabric.stopSurface and use that for bridgeless mode binding (#16164)

Emily committed Jan 10, 2020 at 10:21 UTC d8570ec6eaa4133037e1f350c8e8ed570c8b1b71
2 files changed +11 -1
packages/react-native-renderer/src/ReactFabric.js
+6
@@ -199,7 +199,13 @@ const ReactFabric: ReactFabricType = {
199 return getPublicRootInstance(root);
200 },
201
202 + // Deprecated - this function is being renamed to stopSurface, use that instead.
203 + // TODO (T47576999): Delete this once it's no longer called from native code.
204 unmountComponentAtNode(containerTag: number) {
205 + this.stopSurface(containerTag);
206 + },
207 +
208 + stopSurface(containerTag: number) {
209 const root = roots.get(containerTag);
210 if (root) {
211 // TODO: Is it safe to reset this now or should I wait since this unmount could be deferred?
scripts/rollup/shims/react-native/ReactFabric.js
+5 -1
@@ -23,6 +23,10 @@ if (__DEV__) {
23 ReactFabric = require('../implementations/ReactFabric-prod');
24 }
25
26 -BatchedBridge.registerCallableModule('ReactFabric', ReactFabric);
26 +if (global.RN$Bridgeless) {
27 + global.RN$stopSurface = ReactFabric.stopSurface;
28 +} else {
29 + BatchedBridge.registerCallableModule('ReactFabric', ReactFabric);
30 +}
31
32 module.exports = (ReactFabric: ReactNativeType);