0

I have a Front end for a mobile app I am working on and I have implemented a basic Login/Signup screen for testing. However, after many hours debugging "why my app's UI is unresponsive on initial startup",

I have noticed that while testing on my android device using Expo Go, the dev menu triggered by pressing m in the terminal prevents the UI from being responsive.

Pressing m to toggle it off fixes the issue and retriggers it when toggled back on.

Anyone know how to prevent the issue permanently? I have been toggling it every time but its annoying to do especially when I forget.

Here is a sample from my terminal where until I toggled the dev menu, even the debug prompts I had would not trigger:

npx expo start -c
>>
Starting project at C:\PATH-INTENTIONALLY OMITTED
Starting Metro Bundler
warning: Bundler cache is empty, rebuilding (this may take a minute)
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
//QR CODE INTENTIONALLY OMITTED
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
› Metro waiting on exp://IP-INTENTIONALLY OMITTED
› Scan the QR code above with Expo Go (Android) or the Camera app (iOS)
› Using Expo Go
› Press s │ switch to development build
› Press a │ open Android
› Press w │ open web
› Press j │ open debugger
› Press r │ reload app
› Press m │ toggle menu
› shift+m │ more tools
› Press o │ open project code in your editor
› Press ? │ show all commands
Logs for your project will appear below. Press Ctrl+C to exit.
Android Bundled 21857ms node_modules\expo\AppEntry.js (1169 modules)
 (NOBRIDGE) LOG  Bridgeless mode is enabled
 (NOBRIDGE) LOG  expo-dev-menu not found or could not be disabled: [Error: Requiring unknown module "undefined". If you are sure the module exists, try restarting Metro. You may also want to run `yarn` or `npm install`.]
 (NOBRIDGE) WARN  [Reanimated] Reduced motion setting is enabled on this device. This warning is visible only in the development mode. Some animations will be disabled by default. You can override the behavior for individual animations, see https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#reduced-motion-setting-is-enabled-on-this-device.
 INFO 
 💡 JavaScript logs will be removed from Metro in React Native 0.77! Please use React Native DevTools as your default tool. Tip: Type j in the terminal to open (requires Google Chrome or Microsoft Edge).
 (NOBRIDGE) LOG  Login button pressed
› Toggling dev menu //<--PRESSING 'm' key ABSOLUTELY REQUIRED ELSE BLOCKS ALL UI AND ALL LOGS
 (NOBRIDGE) LOG  Login button pressed
 (NOBRIDGE) LOG  Login button pressed
 (NOBRIDGE) LOG  Login button pressed
 (NOBRIDGE) LOG  Login button pressed
 (NOBRIDGE) LOG  Login button pressed
 (NOBRIDGE) LOG  Login button pressed
 (NOBRIDGE) LOG  Navigating to Signup
 (NOBRIDGE) LOG  Navigating to Signup
 (NOBRIDGE) LOG  Login button pressed
 (NOBRIDGE) LOG  Login button pressed
 (NOBRIDGE) LOG  Login button pressed
 (NOBRIDGE) LOG  Login button pressed

I have tried a lot to fix the issue. As you can see from my terminal log, I am currently trying to detect the dev menu and to close it via my app (this only partially works because the menu detects it was closed and reopens). Pressing m in terminal fixes the issue but is an annoyance.

This was the hack I was trying to use to disable the menu:

[code]
// --- Begin hack to disable Expo Dev Menu ---
if (__DEV__) {
  try {
    const DevMenu = require('expo-dev-menu');
    if (DevMenu) {
      // If a method exists to disable it, use it:
      if (typeof DevMenu.setEnabled === 'function') {
        DevMenu.setEnabled(false);
        console.log('Dev menu disabled via setEnabled.');
      } else {
        // Otherwise, override its isEnabled property.
        Object.defineProperty(DevMenu, 'isEnabled', {
          value: false,
          configurable: true,
          writable: false,
        });
        console.log('Dev menu disabled by overriding isEnabled.');
      }
    }
  } catch (e) {
    console.log('expo-dev-menu not found or could not be disabled:', e);
  }
}
// --- End hack to disable Expo Dev Menu ---
[/code]

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.