Skip to content

Commit

Permalink
Fix shouldShowDevMenuOrReload in RELEASE
Browse files Browse the repository at this point in the history
Summary:
In RELEASE mode, the `devSupportManager` received is ReleaseDevSupportManager for which `showDevOptionsDialog()` & `handleReloadJS()` is a no-op
https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/ReleaseDevSupportManager.java

Which is expected since this is a capability only in Dev mode(useDeveloperSupport = true). However, ATM `shouldShowDevMenuOrReload()` returns true in RELEASE as well which is a bug.

Since there is no need for `shouldShowDevMenuOrReload()` in RELEASE, changing it's logic to introduce that check, early exit and return false in case of RELEASE.

Changelog:
[Android][Fixed] shouldShowDevMenuOrReload() in RELEASE mode

Reviewed By: RSNara

Differential Revision: D56851473
  • Loading branch information
arushikesarwani94 authored and facebook-github-bot committed May 2, 2024
1 parent 4403317 commit bbb70e7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ protected ReactRootView createRootView() {
*/
public boolean shouldShowDevMenuOrReload(int keyCode, KeyEvent event) {
DevSupportManager devSupportManager = getDevSupportManager();
if (devSupportManager == null) {
// shouldShowDevMenuOrReload is a Dev API and not supported in RELEASE mode.
if (devSupportManager == null || devSupportManager instanceof ReleaseDevSupportManager) {
return false;
}

Expand Down

0 comments on commit bbb70e7

Please sign in to comment.