forked from Ivasoft/mattermost-mobile
* Gekidou: Create patches for node modules failing on android build * Trim unnecessary data from patch
67 lines
2.5 KiB
Diff
67 lines
2.5 KiB
Diff
diff --git a/node_modules/react-native-hw-keyboard-event/android/build.gradle b/node_modules/react-native-hw-keyboard-event/android/build.gradle
|
|
index a70aace..9c2c876 100644
|
|
--- a/node_modules/react-native-hw-keyboard-event/android/build.gradle
|
|
+++ b/node_modules/react-native-hw-keyboard-event/android/build.gradle
|
|
@@ -1,11 +1,11 @@
|
|
apply plugin: 'com.android.library'
|
|
|
|
android {
|
|
- compileSdkVersion 28
|
|
+ compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : 28
|
|
|
|
defaultConfig {
|
|
- minSdkVersion 16
|
|
- targetSdkVersion 28
|
|
+ minSdkVersion rootProject.hasProperty('minSdkVersion') ? rootProject.minSdkVersion : 21
|
|
+ targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : 28
|
|
versionCode 1
|
|
versionName "1.0"
|
|
ndk {
|
|
diff --git a/node_modules/react-native-hw-keyboard-event/index.d.ts b/node_modules/react-native-hw-keyboard-event/index.d.ts
|
|
index 91999f1..116b725 100644
|
|
--- a/node_modules/react-native-hw-keyboard-event/index.d.ts
|
|
+++ b/node_modules/react-native-hw-keyboard-event/index.d.ts
|
|
@@ -1,4 +1,5 @@
|
|
+import {EventSubscription} from "react-native";
|
|
+
|
|
declare module "react-native-hw-keyboard-event";
|
|
|
|
-export function onHWKeyPressed(hwKeyEvent: { pressedKey: string }): void;
|
|
-export function removeOnHWKeyPressed(): void;
|
|
+export function onHWKeyPressed(callback: (hwKeyEvent: { pressedKey: string }) => void): EventSubscription;
|
|
diff --git a/node_modules/react-native-hw-keyboard-event/index.js b/node_modules/react-native-hw-keyboard-event/index.js
|
|
index 30d4dd9..3dcff70 100644
|
|
--- a/node_modules/react-native-hw-keyboard-event/index.js
|
|
+++ b/node_modules/react-native-hw-keyboard-event/index.js
|
|
@@ -7,28 +7,9 @@ import {
|
|
|
|
class HWKeyboardEvent {
|
|
onHWKeyPressed(cb) {
|
|
- this.removeOnHWKeyPressed(true);
|
|
- if (!this.cbStack) {
|
|
- this.cbStack = [];
|
|
- }
|
|
- this.cbStack.push(cb);
|
|
let keyEvent = new NativeEventEmitter(NativeModules.RNHWKeyboardEvent);
|
|
- this.listener = keyEvent.addListener("onHWKeyPressed", cb);
|
|
- }
|
|
-
|
|
- removeOnHWKeyPressed(newCbAdded) {
|
|
- if (this.listener) {
|
|
- this.listener.remove();
|
|
- this.listener = null;
|
|
- }
|
|
- if (!this.cbStack) return;
|
|
- if (!newCbAdded) {
|
|
- this.cbStack.pop();
|
|
- if (this.cbStack.length > 0) {
|
|
- // re-add removed listeners in case there where any
|
|
- this.onHWKeyPressed(this.cbStack[this.cbStack.length - 1]);
|
|
- }
|
|
- }
|
|
+ const listener = keyEvent.addListener("onHWKeyPressed", cb);
|
|
+ return listener;
|
|
}
|
|
}
|
|
|