From d8570ec6eaa4133037e1f350c8e8ed570c8b1b71 Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 10 Jan 2020 10:21:32 -0800 Subject: [PATCH] Create ReactFabric.stopSurface and use that for bridgeless mode binding (#16164) --- packages/react-native-renderer/src/ReactFabric.js | 6 ++++++ scripts/rollup/shims/react-native/ReactFabric.js | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/react-native-renderer/src/ReactFabric.js b/packages/react-native-renderer/src/ReactFabric.js index 1371067ab0a73..d9b532e497984 100644 --- a/packages/react-native-renderer/src/ReactFabric.js +++ b/packages/react-native-renderer/src/ReactFabric.js @@ -199,7 +199,13 @@ const ReactFabric: ReactFabricType = { return getPublicRootInstance(root); }, + // Deprecated - this function is being renamed to stopSurface, use that instead. + // TODO (T47576999): Delete this once it's no longer called from native code. unmountComponentAtNode(containerTag: number) { + this.stopSurface(containerTag); + }, + + stopSurface(containerTag: number) { const root = roots.get(containerTag); if (root) { // TODO: Is it safe to reset this now or should I wait since this unmount could be deferred? diff --git a/scripts/rollup/shims/react-native/ReactFabric.js b/scripts/rollup/shims/react-native/ReactFabric.js index 8f6a708fd2057..536ce9a6f30b6 100644 --- a/scripts/rollup/shims/react-native/ReactFabric.js +++ b/scripts/rollup/shims/react-native/ReactFabric.js @@ -23,6 +23,10 @@ if (__DEV__) { ReactFabric = require('../implementations/ReactFabric-prod'); } -BatchedBridge.registerCallableModule('ReactFabric', ReactFabric); +if (global.RN$Bridgeless) { + global.RN$stopSurface = ReactFabric.stopSurface; +} else { + BatchedBridge.registerCallableModule('ReactFabric', ReactFabric); +} module.exports = (ReactFabric: ReactNativeType);