react-native-website icon indicating copy to clipboard operation
react-native-website copied to clipboard

add new CLI feature for selecting target device

Open esthor opened this issue 2 years ago • 3 comments

What: There is a new --list-devices flag being added to the React Native CLI that provides an interactive list of available devices (for both iOS and Android). It's very nice.

Why: TL;DR: Convenience & ✨✨ Developer Experience ✨✨

This interactive approach allows a user to not need to manually run xcrun simctl list devices or adb devices in order to copy and then paste the exact device name into a --simulator <simulator_name> or --deviceID <device_id> , for iOS and Android, respectively.

Status: Besides approval on this PR, these changes need to land over in React Native CLI land:

  • [x] Android is already merged -- https://github.com/react-native-community/cli/pull/1765 (🥇 @adamTrz )
  • [x] iOS is merged https://github.com/react-native-community/cli/pull/1676
  • [ ] Lands in a release

Not In Scope

Consolidating the docs around running on devices and simulators/emulators. I noticed that there are at least 3 few places mentioning how to run (Environment Setup, Running on Device, Running on iOS Simulator), but it doesn't feel like there is a definitive place or pattern to the docs. For instance, that third location is a specific iOS guide for running on specific devices/simulators, but there isn't a similar page in the Android guide on the same topic.

Suggestion:

  1. Make an Android "Running on Emulator" (mirroring the iOS "Running on Simulator")
  2. Expand these to fully cover running on physical devices, as well. They should become the definitive guides on building to specific iOS and Android dev targets, respectively.
  3. Remove explanations in Environment Setup and Running on Device pages, and replace them with a reference to these 2 new "definitive" pages.
  4. Drastically simplify the "Running on Device" page to use the automated processes the CLI supports. E.g., for Android, the CLI will try to do the adb reverse for selected device, it will also interactively list devices, etc. You could turn this page for Android dev into "Run npx react-native run-android --list-devices and select the connected device or emulator you'd prefer. For more information, check the <Running on Android> Page", which would also have the (old) manual steps.

I may also be hyper-focused on this topic and it's maybe not that big of a deal. 🤷

esthor avatar Jan 25 '23 00:01 esthor

Hi @esthor!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

facebook-github-bot avatar Jan 25 '23 00:01 facebook-github-bot

Deploy Preview for react-native ready!

Name Link
Latest commit eb7eb1dfac2d92d6a947068ae37084c0429008e8
Latest deploy log https://app.netlify.com/sites/react-native/deploys/63d14b68a3d70300088a9c8f
Deploy Preview https://deploy-preview-3534--react-native.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Jan 25 '23 00:01 netlify[bot]

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

facebook-github-bot avatar Jan 25 '23 01:01 facebook-github-bot