mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Support onKeyLongPress in Bridgeless (#43472)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43472 Implement `onKeyLongPress` in Bridgeless Changelog: [Android][Breaking] Implement onKeyLongPress in Bridgeless Reviewed By: cortinico Differential Revision: D54876052 fbshipit-source-id: 88d572eab087d913205bdfa02dba96b169066393
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b14f7d58e3
commit
f345fcf3e8
@@ -155,6 +155,7 @@ public class com/facebook/react/ReactDelegate {
|
||||
public fun onHostPause ()V
|
||||
public fun onHostResume ()V
|
||||
public fun onKeyDown (ILandroid/view/KeyEvent;)Z
|
||||
public fun onKeyLongPress (I)Z
|
||||
public fun onNewIntent (Landroid/content/Intent;)Z
|
||||
public fun onWindowFocusChanged (Z)V
|
||||
public fun shouldShowDevMenuOrReload (ILandroid/view/KeyEvent;)Z
|
||||
|
||||
+1
-11
@@ -155,17 +155,7 @@ public class ReactActivityDelegate {
|
||||
}
|
||||
|
||||
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
|
||||
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
||||
// TODO T156475655: support onKeyLongPress
|
||||
} else {
|
||||
if (getReactNativeHost().hasInstance()
|
||||
&& getReactNativeHost().getUseDeveloperSupport()
|
||||
&& keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) {
|
||||
getReactNativeHost().getReactInstanceManager().showDevOptionsDialog();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return mReactDelegate.onKeyLongPress(keyCode);
|
||||
}
|
||||
|
||||
public boolean onBackPressed() {
|
||||
|
||||
+17
@@ -197,6 +197,23 @@ public class ReactDelegate {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onKeyLongPress(int keyCode) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) {
|
||||
if (ReactFeatureFlags.enableBridgelessArchitecture
|
||||
&& mReactHost != null
|
||||
&& mReactHost.getDevSupportManager() != null) {
|
||||
mReactHost.getDevSupportManager().showDevOptionsDialog();
|
||||
return true;
|
||||
} else {
|
||||
if (getReactNativeHost().hasInstance() && getReactNativeHost().getUseDeveloperSupport()) {
|
||||
getReactNativeHost().getReactInstanceManager().showDevOptionsDialog();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void loadApp() {
|
||||
loadApp(mMainComponentName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user