mouselangelo / react-native-actions-shortcuts

iOS Home screen Quick Actions & Android App Shortcuts for react-native
MIT License
131 stars 22 forks source link

[Fixed] NativeEventEmitter #52

Open arthurgeron-work opened 1 year ago

arthurgeron-work commented 1 year ago

addListener and removeListeners is not necessary for this lib's functionality, React will generate a NativeEventEmitter warning on Android anyway, the following patch-package fixes this error on 1.0.1:

diff --git a/node_modules/react-native-actions-shortcuts/android/src/main/java/com/reactnativeshortcuts/ShortcutsModule.kt b/node_modules/react-native-actions-shortcuts/android/src/main/java/com/reactnativeshortcuts/ShortcutsModule.kt
index ec847cc..cc2658c 100644
--- a/node_modules/react-native-actions-shortcuts/android/src/main/java/com/reactnativeshortcuts/ShortcutsModule.kt
+++ b/node_modules/react-native-actions-shortcuts/android/src/main/java/com/reactnativeshortcuts/ShortcutsModule.kt
@@ -145,6 +145,14 @@ class ShortcutsModule(reactContext: ReactApplicationContext) :
     fun isSupported(): Boolean {
         return Build.VERSION.SDK_INT >= 25
     }
+
+    @ReactMethod
+    fun addListener(eventName: String?) {
+    }
+
+    @ReactMethod
+    fun removeListeners(count: Int?) {
+    }
 }

 object NotSupportedException: Throwable("Feature not supported, requires version 25 or above")
\ No newline at end of file