From 9729d4dfeb051dfbc5da4f3254cf6190a60bc5df Mon Sep 17 00:00:00 2001 From: Peter Argany Date: Wed, 14 Apr 2021 10:36:21 -0700 Subject: [PATCH] Revert a small change to UIManagerBinding Summary: Changelog: [Internal] This reverts a small change from D26885562 (https://github.com/facebook/react-native/commit/ea1f9531f00b5cd834e03f58cdfa117a93634624). I'm not sure if this change was made intentionally (feel free to reject this diff if it was luluwu). Before D26885562 (https://github.com/facebook/react-native/commit/ea1f9531f00b5cd834e03f58cdfa117a93634624), if `RN$Bridgeless` was truthy and `RN$stopSurface` was falsey, then the function returned. After D26885562 (https://github.com/facebook/react-native/commit/ea1f9531f00b5cd834e03f58cdfa117a93634624), it ran the else clause (which shouldn't be run in bridgeless mode IIUC). Reviewed By: mdvacca Differential Revision: D27751583 fbshipit-source-id: daaf5c72fec11f4b2e21d1d2926a5026b984461f --- ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp index ac083a7cebc..744de426797 100644 --- a/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp +++ b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp @@ -209,8 +209,11 @@ void UIManagerBinding::setSurfaceProps( void UIManagerBinding::stopSurface(jsi::Runtime &runtime, SurfaceId surfaceId) const { auto global = runtime.global(); - if (global.hasProperty(runtime, "RN$Bridgeless") && - global.hasProperty(runtime, "RN$stopSurface")) { + if (global.hasProperty(runtime, "RN$Bridgeless")) { + if (!global.hasProperty(runtime, "RN$stopSurface")) { + // ReactFabric module has not been loaded yet; there's no surface to stop. + return; + } // Bridgeless mode uses a custom JSI binding instead of callable module. global.getPropertyAsFunction(runtime, "RN$stopSurface") .call(runtime, {jsi::Value{surfaceId}});