diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.java index 97a1bedabef657..739555e2f7bca7 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.java @@ -134,6 +134,8 @@ public T getJSModule(Class jsInterface) { && mInteropModuleRegistry.shouldReturnInteropModule(jsInterface)) { return mInteropModuleRegistry.getInteropModule(jsInterface); } + + // TODO T189052462: ReactContext caches JavaScriptModule instances JavaScriptModule interfaceProxy = (JavaScriptModule) Proxy.newProxyInstance( @@ -143,6 +145,13 @@ public T getJSModule(Class jsInterface) { return (T) interfaceProxy; } + /** Shortcut RCTDeviceEventEmitter.emit since it's frequently used */ + @Override + public void emitDeviceEvent(String eventName, @Nullable Object args) { + mReactHost.callFunctionOnModule( + "RCTDeviceEventEmitter", "emit", Arguments.fromJavaArgs(new Object[] {args})); + } + @Override public boolean hasNativeModule(Class nativeModuleInterface) { return mReactHost.hasNativeModule(nativeModuleInterface);