mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Support onKeyDown in Bridgeless (#43466)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43466 Implement `onKeyDown` in Bridgeless by adding it to ReactHostImpl Changelog: [Android][Breaking] Implement `onKeyDown` in Bridgeless Reviewed By: cortinico Differential Revision: D54870966 fbshipit-source-id: 0f8e48b29679f1bca92f6ac7b6ebf1592cdc5dac
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9700540bec
commit
b14f7d58e3
@@ -154,6 +154,7 @@ public class com/facebook/react/ReactDelegate {
|
||||
public fun onHostDestroy ()V
|
||||
public fun onHostPause ()V
|
||||
public fun onHostResume ()V
|
||||
public fun onKeyDown (ILandroid/view/KeyEvent;)Z
|
||||
public fun onNewIntent (Landroid/content/Intent;)Z
|
||||
public fun onWindowFocusChanged (Z)V
|
||||
public fun shouldShowDevMenuOrReload (ILandroid/view/KeyEvent;)Z
|
||||
|
||||
+1
-11
@@ -147,17 +147,7 @@ public class ReactActivityDelegate {
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
||||
// TODO T156475655: support onKeyDown
|
||||
} else {
|
||||
if (getReactNativeHost().hasInstance()
|
||||
&& getReactNativeHost().getUseDeveloperSupport()
|
||||
&& keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) {
|
||||
event.startTracking();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return mReactDelegate.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
|
||||
+13
@@ -184,6 +184,19 @@ public class ReactDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD
|
||||
&& ((ReactFeatureFlags.enableBridgelessArchitecture
|
||||
&& mReactHost != null
|
||||
&& mReactHost.getDevSupportManager() != null)
|
||||
|| (getReactNativeHost().hasInstance()
|
||||
&& getReactNativeHost().getUseDeveloperSupport()))) {
|
||||
event.startTracking();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void loadApp() {
|
||||
loadApp(mMainComponentName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user