Browse Source

Expose keyUp event from modals to ActivityCallback

Guy Carmeli 7 years ago
parent
commit
2538109519

+ 8
- 0
android/app/src/main/java/com/reactnativenavigation/controllers/Modal.java View File

@@ -4,7 +4,9 @@ import android.app.Dialog;
4 4
 import android.content.DialogInterface;
5 5
 import android.os.Build;
6 6
 import android.os.Bundle;
7
+import android.support.annotation.NonNull;
7 8
 import android.support.v7.app.AppCompatActivity;
9
+import android.view.KeyEvent;
8 10
 import android.view.Window;
9 11
 import android.view.WindowManager;
10 12
 
@@ -160,6 +162,12 @@ class Modal extends Dialog implements DialogInterface.OnDismissListener, ScreenS
160 162
         getWindow().setAttributes(attributes);
161 163
     }
162 164
 
165
+    @Override
166
+    public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
167
+        NavigationApplication.instance.getActivityCallbacks().onKeyUp(keyCode, event);
168
+        return super.onKeyUp(keyCode, event);
169
+    }
170
+
163 171
     @Override
164 172
     public void push(ScreenParams params, Promise onPushComplete) {
165 173
         layout.push(params, onPushComplete);