diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp index 0b6407a93305db..94ef5ef5e49fe5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp @@ -728,9 +728,36 @@ void Binding::schedulerDidSetJSResponder( SurfaceId surfaceId, const ShadowView &shadowView, const ShadowView &initialShadowView, - bool blockNativeResponder) { } + bool blockNativeResponder) { -void Binding::schedulerDidClearJSResponder() { } + jni::global_ref localJavaUIManager = getJavaUIManager(); + if (!localJavaUIManager) { + LOG(ERROR) << "Binding::schedulerSetJSResponder: JavaUIManager disappeared"; + return; + } + + static auto setJSResponder = + jni::findClassStatic(UIManagerJavaDescriptor) + ->getMethod( + "setJSResponder"); + + setJSResponder(localJavaUIManager, shadowView.tag, initialShadowView.tag, (jboolean) blockNativeResponder); +} + +void Binding::schedulerDidClearJSResponder() { + jni::global_ref localJavaUIManager = getJavaUIManager(); + if (!localJavaUIManager) { + LOG(ERROR) << "Binding::schedulerClearJSResponder: JavaUIManager disappeared"; + return; + } + + static auto clearJSResponder = + jni::findClassStatic(UIManagerJavaDescriptor) + ->getMethod("clearJSResponder"); + + clearJSResponder(localJavaUIManager); +} void Binding::registerNatives() { registerHybrid(