mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Flag missing DefaultHardwareBackBtnHandler interface in bridgeless too (#43487)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43487 Inconsistent between bridge and bridgeless, but if you forget to implement this interface, ReactDelegate will silently not do anything in bridgeless. Changelog: [Android] Enforce Activities using ReactDelegate implement DefaultHardwareBackBtnHandler. Reviewed By: arushikesarwani94 Differential Revision: D54900747 fbshipit-source-id: 5dd31d4f81e4ec37e1c3ee906be836a8a9c6a944
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f345fcf3e8
commit
a2d277f740
+8
-11
@@ -82,20 +82,17 @@ public class ReactDelegate {
|
||||
}
|
||||
|
||||
public void onHostResume() {
|
||||
if (!(mActivity instanceof DefaultHardwareBackBtnHandler)) {
|
||||
throw new ClassCastException(
|
||||
"Host Activity does not implement DefaultHardwareBackBtnHandler");
|
||||
}
|
||||
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
||||
if (mActivity instanceof DefaultHardwareBackBtnHandler) {
|
||||
mReactHost.onHostResume(mActivity, (DefaultHardwareBackBtnHandler) mActivity);
|
||||
}
|
||||
mReactHost.onHostResume(mActivity, (DefaultHardwareBackBtnHandler) mActivity);
|
||||
} else {
|
||||
if (getReactNativeHost().hasInstance()) {
|
||||
if (mActivity instanceof DefaultHardwareBackBtnHandler) {
|
||||
getReactNativeHost()
|
||||
.getReactInstanceManager()
|
||||
.onHostResume(mActivity, (DefaultHardwareBackBtnHandler) mActivity);
|
||||
} else {
|
||||
throw new ClassCastException(
|
||||
"Host Activity does not implement DefaultHardwareBackBtnHandler");
|
||||
}
|
||||
getReactNativeHost()
|
||||
.getReactInstanceManager()
|
||||
.onHostResume(mActivity, (DefaultHardwareBackBtnHandler) mActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user