From 16fb9d8f7629ab230a0748d3872f136dd2b0a3bd Mon Sep 17 00:00:00 2001 From: Heath Kehoe Date: Wed, 27 Sep 2023 13:00:39 -0500 Subject: [PATCH] add missing listener methods (new architecture) Methods `addListener` and `removeListeners` were missing from the codegen spec. Without them, events emitted from native code do not get sent to JS, and warnings are logged complaining about the missing methods. Fixes: https://github.com/RonRadtke/react-native-blob-util/issues/283 Possibly also fixes: https://github.com/RonRadtke/react-native-blob-util/issues/274 https://github.com/RonRadtke/react-native-blob-util/issues/292 --- .../java/com/ReactNativeBlobUtil/ReactNativeBlobUtil.java | 2 +- codegenSpecs/NativeBlobUtils.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/android/src/newarch/java/com/ReactNativeBlobUtil/ReactNativeBlobUtil.java b/android/src/newarch/java/com/ReactNativeBlobUtil/ReactNativeBlobUtil.java index 8de48bb6..f0bb9d45 100644 --- a/android/src/newarch/java/com/ReactNativeBlobUtil/ReactNativeBlobUtil.java +++ b/android/src/newarch/java/com/ReactNativeBlobUtil/ReactNativeBlobUtil.java @@ -34,7 +34,7 @@ public void addListener(String eventName) { } @ReactMethod - public void removeListeners(Integer count) { + public void removeListeners(double count) { } diff --git a/codegenSpecs/NativeBlobUtils.js b/codegenSpecs/NativeBlobUtils.js index 6f510ab6..a8da97f3 100644 --- a/codegenSpecs/NativeBlobUtils.js +++ b/codegenSpecs/NativeBlobUtils.js @@ -75,6 +75,10 @@ export interface Spec extends TurboModule { +getSDCardApplicationDir: () => Promise; +scanFile: (pairs: Array, callback: (value: Array) => void) => void; +writeToMediaFile: (fileUri: string, path: string, transformFile: boolean) => Promise; + + // RCTEventEmitter + +addListener: (eventName: string) => void; + +removeListeners: (count: number) => void; } export default (TurboModuleRegistry.get('ReactNativeBlobUtil'): ?Spec);