facebook / react-native Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shake gesture should not be only way to reach dev menu on physical device #10191
Comments
Hi, I agree with @pekkanikolaus, shaking the device to bring up the dev menu is not efficient. I have a Galaxy S6 here at work and I can't bring the menu. I can shake the device but nothing happen (a chance it didn't slip of my hand yet ;)) If I start the app (not from a previous instance), then the menu is visible, and as soon as I dismiss it, it is back again (infinite loop hide<>show<>hide<>show...), and I have to hit the "recent app" button then come back to the app to make it invisible, but then it is gone forever... until I restart the app by manually killing it's instance (I suspect Samsung modification to be the cause of that behavior). I have another device, the One+ but with this one, I can't use the dev tools (nuclide inspector) because adb reverse don't work with API 19, and I must keep this device to API level 19. Using the "normal" chrome dev tools, It seem that I can only see some exceptions (if they raise from my code) and console.log. This make learning difficult, debugging almost impossible on real device. I think it is a no go but I had to write this somewhere even if maybe I am the only one with this kind of problem (googled about that and got no results so far). |
+1 for now I'm using this workaround $ adb shell am force-stop com.app_name && adb shell am start -n com.app_name/com.app_name.MainActivity |
I am developing activity recognition application based on RN, and this shake gesture conflicts with my core logic which makes use of accelerometer signals. This needs to be enhanced for the apps encompassing sensor utilization! |
Why hasn't this issue been escalated? It's really a tedious job without Live Reloading, which can only be enabled if you can open the Dev Menu, and in a lot of cases, it just doesn't open. http://stackoverflow.com/questions/41208089/cannot-open-dev-menu-on-xiaomi-devices |
I think we can also follow Exponent.js's approach which uses double long tap. This is very responsive and predictable, and does not conflict with most of applications. I think shaking gesture should not be used by defaultz |
@ohtangza Exactly. That won't be restricting the development workflow and would fit with almost all the apps, without changing their default behavior. How can we add this? |
@abhisheksoni27 For android, DevSupportManagerImpl.java should be in charge of this part. The part below is the code where RN triggers the developer menu. I am not sure about iOS part because I am not that knowledgable for iOS. I think I can take care of Android part.
We also need to discuss the followings as well:
|
@ohtangza, We're gonna need someone else to take car of the implementation in iOS. For the issues you mentioned, I think:
Let's see what RN thinks of that. Also, do you have a better way of implementing that? |
@abhisheksoni27 Sorry for my late reply. I might not be very responsive in this end-year season. In response to the SharedPreference you suggested, I think that is a good idea because we already have developer's setting in the menu. I personally think that we can get rid of the shake gesture eventually because the multi-touch long press could be replaced the gesture completely. If we support it with more than long press with more than 3 multi-touch event. It probably may not conflict with others. Anyways, we might still need to keep them supported for the time being for backward compatibility and little confusion to developers. By the way, do you have a plan to update the code by yourself? I really need this feature because I am prototyping a gesture-enabled app using the accelerometer for now. I might have some time to do it with iOS developer, but it would be around somewhere middle in January. |
Haha. Holidays. We can implement three-points multi-touch event, and support the development workflow. That's a very good point. I can start updating as soon as we formally decide what we are after. Like, let's finalize the three-points touch event and start hacking. Gesture-enabled App. Cool. And I'm afraid you are gonna have to be in charge of the iOS implementation. I have no idea how that stuff is written. |
Actually it doesn't. |
what would you think of a "3 touches" trigger?
|
I personally love your three points long touch implementation! |
i have the same problem,in my andoird device(Mi4c android 5.1),the dev menu did not show . I shake my phone.use so does anybody know the solution? |
@wbpmrck have you tried Frappé https://github.com/niftylettuce/frappe, or looking for something here? http://stackoverflow.com/questions/32914665/how-do-i-shake-an-android-device-within-the-android-emulator-to-bring-up-the-d?noredirect=1&lq=1 |
@malithjkmt when I run the command "adb shell input keyevent KEYCODE_MENU" output on my screen is "Error: TV display id Invalid, will send event to default displayId ". |
Thanks for opening the issue! As it happens, we're using GitHub to track bugs in React Native. If you'd like to submit this as a feature request, please go ahead and create an entry on Canny. It has a voting system and if the feature gets a good amount of votes, it will have a greater chance of being implemented by the community. Closing this now, thanks for understanding! |
Oops, correct link to vote: https://react-native.canny.io/feature-requests/p/shake-gesture-should-not-be-only-way-to-reach-dev-menu-on-physical-device @hramos the Canny link you posted is wrong, the correct one is |
I create a reload-device.sh script for mac #!/bin/bash and now I just write reload-device.sh and that's is all the 82 is for show the menu like @malithjkmt show us and the 66 it's for Enter. |
I still can't believe this is under "consideration". "Shaking" to activate a menu option which is an integral part of the app development cycle. Reinstall app? You have to shake vigorously(I have a DayDream VR capable phone with a more sensitive gyro) 3x just to toggle Make it simple. A permanent notification/floating button or even a 4 touch hold would all be way more useful and intuitive than the current method. ADB is a temp way to avoid this, but this only works if you're connected to the debugger via a physical connection. To prevent overcharging a phone you don't want it to be permanently on the wire and shaking to change settings just creates wear and tear on the phone port in this scenario. expo/expo#517 |
I use a workaround by using two Automator services (OSX): Open RN dev menu
Reload RN
(reload was not always working without adding the last line) In Preferences->Keyboard->Keyboard shortcuts you can then map these services to keyboard shortcuts. I added the shortcuts for the context of my editor (Webstorm) and React Native debugger. In these programs I can now press Ctrl+D to show the developer menu and Ctrl+R to reload which works perfectly. |
Wanted to share my solution because it is a life changer. Same as @joachimroeleveld but for ubuntu 16.04:
Every time you will click ALT+S your app will reload :) So I can reach the DevMenu easily. |
Hey you all! microsoft/vscode-react-native#481 (comment) Next version of the React Native extension for VS Code has some awesome updates. It allows open the dev menu and reload app from VS Code. And bind those commands to keyboard shortcuts. This makes it really awesome. |
I am attempting to add slicejunk's three finger trigger of the dev menu to an existing project and I am getting: Invariant violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object when using the following: AppRegistry.registerComponent('osaPOS', (): any => ); I do have: import osaPOSentry from './app/App'; |
Just to add to this thread, on iOS you can enable assistive touch and have a floating button on the screen at all times that triggers the shake event. Useful if you have a dedicated iOS testing device that you're sick of shaking around. +1 on having a long press to activate dev menu |
i have the assistive floating button for just shake for a month now. muuuch nicer than shaking all the time. |
Shaking is stupid, I agree. |
I too couldn't get the developer menu to appear by shaking my iPhone. Settings > Search for "AssistiveTouch" > AssistiveTouch > Switch toggle ON You'll get a floating button on the screen. When you want to bring up the developer options, click it, then Device, More, Shake. Works a charm. |
|
@pstanton Confirming that this works on macOS as well. Thanks for the tip! I found that this works for Android if you want to trigger a reload from the terminal: |
Remember to vote here if you want this feature: https://react-native.canny.io/feature-requests/p/shake-gesture-should-not-be-only-way-to-reach-dev-menu-on-physical-device |
This sucks. When shaking my device I already destroyed my fcking cord. |
So.. how about iOS devices ? -On android, we can use |
By shaking the device, sometime caused disconnecting my USB cable from debugging and |
On my Oppo a37, running colorOS 3, based off Android 5.1.1 the adb shell command is not working. Was never interested in Android. Now all my suspicions of the fragmented landscape are validating themselves. Fuck android. Fuck Hardware manufacturers with their bullshit versions. Fuck all this shit |
don't feed the trolls. this is a issue tracking system. |
On my Moto E I was able to change gesture to open the menu (to a home double tap). |
One touch shake gesture for iOS: https://www.youtube.com/watch?v=WbUjMlxkfQ8 |
yep I do the same. it's much nicer until we have a better way. |
The react native development process is awesome. The only real annoyance is that I need to shake the device to get hold of the developer menu to hot reload the app’s code.
Shaking is cumbersome the bigger and heavier the device gets, and it doesn’t work very well on my iPad pro: I have to shake repeatedly, sometimes for a while, until I get the menu. The device is resting on my table while I code and there is no reason to pick it up (also because the charger cable is showing strain).
There should be an alternative gesture to shaking to invoke the dev menu. Sadly, I lack the XCode/ObjC chops to make the change right in the code.
The text was updated successfully, but these errors were encountered: