microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
1.10.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

README.md

1009lines · modecode

1# React Native Tools
2
3[![Build Status](https://dev.azure.com/vscode-webdiag-extensions/VS%20Code%20WebDiag%20extensions/_apis/build/status/%5BUnit%20tests%5D%20vscode-react-native%20%5Bmaster%5D?branchName=master)](https://dev.azure.com/vscode-webdiag-extensions/VS%20Code%20WebDiag%20extensions/_build/latest?definitionId=60&branchName=master)
4
5Stable:
6![Stable version](https://vsmarketplacebadge.apphb.com/version-short/msjsdiag.vscode-react-native.svg)
7![VS Marketplace rating](https://vsmarketplacebadge.apphb.com/rating-star/msjsdiag.vscode-react-native.svg)
8
9Preview:
10![VS Marketplace version](https://vsmarketplacebadge.apphb.com/version-short/msjsdiag.vscode-react-native-preview.svg)
11![VS Marketplace rating](https://vsmarketplacebadge.apphb.com/rating-star/msjsdiag.vscode-react-native-preview.svg)
12
13## React Native Tools Preview
14
15The extension has a [nightly version](https://marketplace.visualstudio.com/items?itemName=msjsdiag.vscode-react-native-preview) which is released on a daily basis at 9 PM PST on each day that changes occur.
16To avoid conflicts, if both extensions are installed - the only stable version will be activated. So to use the preview version it is needed to disable or remove the stable version and reload VS Code.
17
18## About the extension
19
20This VS Code extension provides a development environment for React Native projects.
21Using this extension, you can **debug your code and quickly run `react-native` commands** from the command palette.
22
23![React Native features](resources/images/react-features.gif)
24
25<!-- TABLE OF CONTENTS -->
26
27# Table of Contents
28
29- [React Native Tools Preview](#react-native-tools-preview)
30- [About the extension](#about-the-extension)
31- [Getting started](#getting-started)
32- [React Native commands in the Command Palette](#react-native-commands-in-the-command-palette)
33- [Debugging React Native applications](#debugging-react-native-applications)
34 - [Hermes engine](#hermes-engine)
35 - [iOS applications](#ios-applications)
36 - [iOS devices](#ios-devices)
37 - [Custom scheme for iOS apps](#custom-scheme-for-ios-apps)
38 - [iOS direct debugging](#iOS-direct-debugging)
39 - [iOS Hermes debugging](#ios-hermes-debugging)
40 - [Expo applications](#expo-applications)
41 - [Debug on Expo Go](#debug-on-expo-go)
42 - [Debug on expo-dev-client](#debug-on-expo-dev-client)
43 - [Configuring Expo](#configuring-expo)
44 - [Expo Hermes](#expo-hermes)
45 - [Windows applications](#react-native-for-windows)
46 - [Windows Hermes debugging](#windows-hermes-debugging)
47 - [macOS applications](#react-native-for-macos)
48 - [macOS Hermes debugging](#macos-hermes-debugging)
49 - [TypeScript and Haul based applications](#typescript-and-haul)
50 - [Debugger configuration properties](#debugger-configuration-properties)
51- [Customization](#customization)
52 - [Logging](#logging)
53 - [Build APK and generate bundle](#build-apk-and-generate-bundle)
54 - [Specifying custom arguments for `react-native run-*` command](#specifying-custom-arguments-for-react-native-run--command)
55 - [Setting up the React Native packager](#setting-up-the-react-native-packager)
56 - [Change project root](#change-project-root)
57 - [Configure an Android LogCat Monitor](#configure-an-android-logcat-monitor)
58 - [Configure dependencies versions for debugging Expo projects](#configure-dependencies-versions-for-debugging-expo-projects)
59 - [Configure custom key bindings for extension commands](#configure-custom-key-bindings-for-extension-commands)
60 - [Configure custom colors for extension output logs](#configure-custom-colors-for-extension-output-logs)
61- [Element inspector](#element-inspector)
62- [Network Inspector](#network-inspector)
63- [Developing inside a Docker Container](#developing-inside-a-docker-container)
64- [Contributing](#contributing)
65- [Known Issues](#known-issues)
66
67# Getting started
68
69Before going any further make sure that you:
70
71- [have a working React Native environment](https://reactnative.dev/docs/environment-setup).
72- have the [`emulator`](https://developer.android.com/studio/run/emulator-commandline) utility available in your `PATH` if you're developing Android applications
73- are using [VS Code](https://code.visualstudio.com) and have [installed this extension from the Marketplace](https://marketplace.visualstudio.com/items?itemName=msjsdiag.vscode-react-native).
74- have your React Native project root folder open in VS Code.
75- have launched "React Native: Check development environment configuration" command in order to make sure that all necessary software is installed and recognized correctly.
76
77Please notice that the extension uses `.vscode/.react` directory at the project root to store intermediate files required for debugging. Although these files usually get removed after debug session ends, you may want to add this directory to your project's `.gitignore` file.
78
79# React Native commands in the Command Palette
80
81In the Command Palette, type `React Native` and choose a command.
82
83![React Native commands](resources/images/command-palette.png)
84
85The **Run Android** command triggers `react-native run-android` and starts your app for Android.
86
87The **Run iOS** command similarly triggers `react-native run-ios` and starts your app in the iOS simulator (e.g. iPhone 6).
88
89The **Packager** commands allow you to start/stop the [**Metro Bundler**](https://github.com/facebook/metro-bundler) (formerly React Packager).
90
91The full list of commands is:
92
93| Name | Command ID | Description |
94| ------------------------------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
95| Launch Android Emulator | `reactNative.launchAndroidSimulator` | Prompts you to select the name of the available Android emulator and launch it. If only one emulator is installed in the system, it will be selected automatically |
96| Launch iOS Simulator | `reactNative.launchIOSSimulator` | Prompts you to select the available system version of the iOS simulator, then select the simulator name for the selected system and launch it. If only one simulator is installed in the system, it will be selected automatically |
97| Run Android on Emulator | `reactNative.runAndroidSimulator` | Run an Android application on Emulator. Launch order: check target platform support, load run arguments, start Packager, run app on the selected emulator. Make sure the `emulator` utility is added to `PATH` |
98| Run Android on Device | `reactNative.runAndroidDevice` | Run an Android application on Device. Launch order: check target platform support, load run arguments, start Packager, run app in all connected devices |
99| Run iOS on Simulator | `reactNative.runIosSimulator` | Run an iOS application on Simulator. Launch order: load run arguments, check target platform support, start Packager, run app in only one connected emulator |
100| Run iOS on Device | `reactNative.runIosDevice` | Run an iOS application on Device. Launch order: load run arguments, check target platform support, start Packager, run app in only one connected device |
101| Run Expo | `reactNative.runExponent` | Run an Exponent application. Launch order: login to exponent, load run arguments, start Packager, run app |
102| Run Windows | `reactNative.runWindows` | Run a RNW application. Launch order: check target platform support, load run arguments, start Packager, run app |
103| Run MacOS | `reactNative.runMacOS` | Run a RNmacOS application. Launch order: check target platform support, load run arguments, start Packager, run app |
104| Start Packager | `reactNative.startPackager` | Start Packager in context project workspace folder |
105| Stop Packager | `reactNative.stopPackager` | Stop Packager |
106| Restart Packager | `reactNative.restartPackager` | Restart Packager and clear the Packager's cache |
107| Publish To Expo | `reactNative.publishToExpHost` | Publish to Exponent Host. Launch order: login to exponent, execute `Run Expo` command, then publish app to host |
108| Show Dev Menu | `reactNative.showDevMenu` | Show development menu for running aplication on iOS or Android device or emulator |
109| ReloadApp | `reactNative.reloadApp` | Reload an application |
110| Run Element Inspector | `reactNative.runInspector` | Load development tools for inspect application UI elements |
111| Stop Element Inspector | `reactNative.stopInspector` | Stop development tools for inspect application UI elements |
112| Run React Native LogCat Monitor | `reactNative.startLogCatMonitor` | Creates a LogCat Monitor for the chosen online Android device to see the device LogCat logs. Default filtering arguments: ["*:S", "ReactNative:V", "ReactNativeJS:V"]. [How to configure filtering.](#configure-an-Android-LogCat-Monitor) |
113| Stop React Native LogCat Monitor | `reactNative.stopLogCatMonitor` | Stops an existing LogCat Monitor and removes its output channel |
114| Run Network Inspector | `reactNative.startNetworkInspector` | Run [Network inspector](#network-inspector) |
115| Stop Network Inspector | `reactNative.stopNetworkInspector` | Stop [Network inspector](#network-inspector) |
116| Check development environment configuration | `reactNative.testDevEnvironment` | Checks your development environment for common problems |
117
118## Using commands in VS Code tasks
119
120To run React Native Tools commands via VS Code tasks, you can create a `.vscode/tasks.json` file in your project and add tasks configurations the following way:
121
122```json
123{
124 "version": "2.0.0",
125 "tasks": [
126 {
127 "label": "Run Android on Emulator",
128 "command": "${command:reactNative.runAndroidSimulator}",
129 "problemMatcher": []
130 }
131 ]
132}
133```
134
135# Debugging React Native applications
136
137To start debugging create a new debug configuration for your ReactNative app in your `.vscode/launch.json`. Adding a new configuration can be done by opening your `launch.json` file and clicking on `Add Configuration...` button and then selecting `React Native` option. After that the extension will prompt you to create a debugging configuration by selecting debugging parameters in dropdown lists at the top of the editor. A new debugging configuration will be generated and added to the `launch.json` file automatically as shown in the image below.
138
139![Add React Native debug configuration](resources/images/add-debug-configuration.gif)
140
141In case you haven't created the `.vscode/launch.json` file yet, you can add a whole default debug configuration set. To do that click the debug icon ![Choose React Native debugger](resources/images/debug-view-icon.png) in the View bar, and then click the configuration (gear) icon ![Configure-gear](resources/images/configure-gear-icon.png), then choose the React Native debug environment.
142
143![Choose React Native debugger](resources/images/choose-debugger.png)
144
145VS Code will generate a `launch.json` in your project with some default configuration settings as shown below. You can safely close this file, choose the appropriate configuration in the Configuration dropdown, and then press F5 (or click _Green Arrow_ ![Configure-gear](resources/images/debug-icon.png) button) to start debugging your app in VS Code.
146
147![React Native launch targets](resources/images/debug-targets.png)
148
149The extension also allows to start debugging without creating the `launch.json` file in one of the following ways:
150
151- Using dynamic debugging configurations
152
153 To use dynamic debugging configurations you can click on the `Show all automatic debug configurations` string in the `Run and Debug` panel, then select `React Native` in the list of extensions and choose the appropriate configuration in the Configuration list to start debugging.
154
155 ![Run dynamic debugging configuration](resources/images/dynamic-debugging-configuration.gif)
156
157- Using `Debug` button in the Editor Title area menu
158
159 To start debugging you can click the Debug button in the Editor Title area in the upper right corner. You can also select the appropriate debugging scenario by clicking the dropdown button beside the Debug button and choosing the scenario.
160
161 ![Select and run debugging command](resources/images/debug-commands-button.png)
162
163Once app is loaded and running, [open the developer menu](https://reactnative.dev/docs/debugging#accessing-the-in-app-developer-menu) inside your application and enable remote debugging by clicking on `Debug JS Remotely` button.
164
165![React Native enable remote debug](resources/images/enable-remote-debug.png)
166
167The extension allows you to debug multiple devices and configurations, please read the following sections for more information for your particular use case.
168
169## Hermes engine
170
171**Note**: Now react-native [0.70.0](https://github.com/facebook/react-native/releases/tag/v0.70.0) set Hermes as default engine to instead of JSCore. Please see [official documentation](https://reactnative.dev/blog/2022/07/08/hermes-as-the-default) to get details.
172
173The Hermes engine is an open source JavaScript engine created by Facebook to optimize building and running React Native applications. It improves app performance and decreases app size.
174
175Click [here](https://reactnative.dev/docs/hermes) to learn more about Hermes and how to enable it for your application.
176To turn off Hermes, you can do the same changes in documentation but set `Hermes Flag` to `False`.
177
178Debugging apps with Hermes enabled is currently experimental. Please see [this issue](https://github.com/microsoft/vscode-react-native/issues/1266) for current known issues on Hermes support.
179
180### Android Hermes
181
182To debug while using Hermes engine use `Debug Android Hermes - Experimental` launch configuration:
183
184```json
185{
186 "name": "Debug Android Hermes - Experimental",
187 "cwd": "${workspaceFolder}",
188 "type": "reactnativedirect",
189 "request": "launch",
190 "platform": "android"
191}
192```
193
194### iOS Hermes
195
196The extension provides experimental support of debugging iOS Hermes applications. See [iOS Hermes debugging](#ios-hermes-debugging) for more details.
197
198### macOS Hermes
199
200The extension provides experimental support of debugging macOS Hermes applications. See [macOS Hermes debugging](#macos-hermes-debugging) for more details.
201
202### Windows Hermes
203
204The extension provides experimental support of debugging Windows Hermes applications. See [Windows Hermes debugging](#windows-hermes-debugging) for more details.
205
206### Attach to Hermes application
207
208To attach to a running Hermes application use `Attach to Hermes application - Experimental` launch configuration:
209
210```json
211{
212 "name": "Attach to Hermes application - Experimental",
213 "cwd": "${workspaceFolder}",
214 "type": "reactnativedirect",
215 "request": "attach"
216}
217```
218
219## iOS applications
220
221### iOS devices
222
223Debugging on an iOS device requires following manual steps:
224
225- Install [ios-deploy](https://github.com/ios-control/ios-deploy) `brew install ios-deploy`.
226- Install a valid iOS development certificate.
227- In your project's `launch.json` file set `target` to `device`. If you need to specify the exact device to run, you can set `target` to `<iOS device name/udid>`, or you can also use `runArguments` property to specify a particular device to run on in case multiple devices are connected (e.g. `"runArguments": [ "--device", "My iPhone" ]`)
228- Choose the **Debug iOS** option from the "Configuration" dropdown and press F5.
229- Shake the device to open the development menu and select "Debug JS Remotely".
230
231### Custom scheme for iOS apps
232
233If you want to use a custom scheme for your application you can either pass it as part of the `runArguments` parameter arguments, or set the `scheme` configuration parameter as shown below:
234
235```js
236"runArguments": ["--scheme", "customScheme", ...]
237// or
238"runArguments": ["--scheme=customScheme", ...]
239// or
240"scheme" : "customScheme"
241```
242
243Please be aware, specifying the scheme value as a part of the `runArguments` parameter arguments will override the `scheme` configuration parameter value, if it set.
244
245### iOS direct debugging
246
247The extension provides experimental support of iOS direct debugging. See more info here: [react-native-community/discussions-and-proposals#40](https://github.com/react-native-community/discussions-and-proposals/issues/40), [react-native-community/discussions-and-proposals#206](https://github.com/react-native-community/discussions-and-proposals/issues/206)
248
249For now the extension supports iOS direct debugging only on real iOS devices.
250
251To be able to debug an iOS app directly, you need to install [ios-webkit-debug-proxy](https://github.com/google/ios-webkit-debug-proxy):
252
253- Install [HomeBrew](https://brew.sh) on your Mac.
254- Open a Terminal and run `brew install ideviceinstaller ios-webkit-debug-proxy`
255
256You can use the following debug scenarios to debug iOS apps directly:
257
258- React Native Direct: Debug Direct iOS - Experimental
259
260```json
261 "name": "Debug Direct iOS - Experimental",
262 "cwd": "${workspaceFolder}",
263 "type": "reactnativedirect",
264 "request": "launch",
265 "platform": "ios",
266 "port": 9221,
267 "target": "device"
268```
269
270- React Native Direct: Attach to the React Native iOS - Experimental
271
272```json
273 "name": "Attach to the React Native iOS - Experimental",
274 "cwd": "${workspaceFolder}",
275 "type": "reactnativedirect",
276 "request": "attach",
277 "platform": "ios",
278 "port": 9221
279```
280
281### iOS Hermes debugging
282
283You can enable Hermes engine for an iOS application by editing `ios/Podfile` file the following way:
284
285```diff
286- use_react_native!(:path => config[:reactNativePath])
287+ use_react_native!(:path => config[:reactNativePath], :hermes_enabled => true)
288```
289
290After this change you need to execute `pod install` command in `ios` folder. After that you can use `Debug iOS Hermes - Experimental` launch configuration to debug an iOS Hermes application:
291
292```json
293{
294 "name": "Debug iOS Hermes - Experimental",
295 "cwd": "${workspaceFolder}",
296 "type": "reactnativedirect",
297 "request": "launch",
298 "platform": "ios"
299}
300```
301
302## Expo applications
303
304To debug a project created using Expo or the `create-react-native-app` task, you can use embedded support for Expo.
305
306Prepare your environment by following the [Expo CLI Quickstart instruction](https://reactnative.dev/docs/environment-setup).
307For correct work with Expo this extension **`requires Android SDK`**.
308So also pay attention to the `React Native CLI Quickstart` tab, where you can find the Android SDK installation guide:
309
310- Install the [Expo app](https://getexponent.com/) on the target device or emulator
311- Ensure that the `Android SDK` is installed on your computer (You may install it using the [`React Native CLI Quickstart` guide](https://reactnative.dev/docs/environment-setup))
312- Ensure that the `expo-cli` is installed globally (`npm install -g expo-cli`)
313
314You can verify that everything is working correctly and that the environment is ready for use with the `npx react-native doctor` command.
315
316### Debug on Expo Go
317
318If you're using [Expo Go](https://expo.dev/expo-go), follow below steps tp start debugging Expo application:
319
3201. Open your project in VS Code with this extension installed.
3211. Create a debug configuration (as described in [Debugging React Native applications](#debugging-react-native-applications)), select `Debug in Exponent` in the debug drop-down menu, and start debugging
3221. Wait while some dependencies are configured - the extension will install [`Expo Development Library(xdl)`](https://www.npmjs.com/package/xdl) when this feature is used for the first time.
3231. If you have not used Exponent on this system before, you will be prompted for an Exponent username and password.
324 Exponent account allows you to use Expo cloud services. More info about how it works is available [here](https://docs.expo.io/versions/latest/workflow/how-expo-works/).
325 If you have not created an Exponent account, then specifying a new username and password will create one.
326 Note that there is no e-mail associated with the account, and no way to recover a forgotten password.
327 If you don't want to create an Exponent account, you can specify `expoHostType` parameter in your debug configuration to make Expo work locally (via LAN or on localhost).
3281. Once the packager starts, the extension will open a separate tab with QR code to scan from the Expo Go. Once you do so, the Expo Go will connect to the packager and begin running your app.
3291. Once the app is loaded and running, [open the developer menu](https://reactnative.dev/docs/debugging#accessing-the-in-app-developer-menu) and enable remote debugging by clicking on `Debug JS Remotely` button.
330
331 ![React Native developer menu](./resources/images/enable-remote-debug.png)
332
333### Debug on expo-dev-client
334
335If you want to debug Expo app using [expo-dev-client](https://docs.expo.dev/development/getting-started/), follow below steps to start debugging Expo application:
336
3371. Open your project in VS Code with this extension installed.
3382. In project folder, install expo-dev-client for your app using `npx expo install expo-dev-client`
3393. Create your app in development mode `eas build --profile development --platform all`, replace `--platform all` to `android` or `iOS` to build specific platform application(need development account for `iOS` platform).
3404. After build success, download your build and install application to your device or simulator
3415. In project, using `npx expo start --dev-client` to start Metro and load application in device or simulator
3426. Using `CMD + D` or `Ctrl + M` to open dev menu, then enable local devtools
3437. If your Chrome or MS Edge open devtools after enabling local devtools, waiting the status is changed to `Status: Debugger session active`, then close browser devtools.
3448. Add `Attach to application` command `./.vscode/launch.json`
345
346```json
347 "configurations": [
348 {
349 "name": "Attach to packager",
350 "request": "attach",
351 "type": "reactnative",
352 "cwd": "${workspaceFolder}"
353 }
354 ]
355```
356
3579. Run `Attach` command in debug tab and debugger will start to work(If debugger not go into breakpoint, you need to reload app from Metro to refresh app since maybe it had some conflicts between Browser devtools debug session and RNT debug session).
358
359### Configuring Expo
360
361The extension supports running through Exponent not just the applications created with Expo but even pure React Native applications (in that case you need to add `expo` package to `node_modules` in order to make it work with Expo: `npm install expo --save-dev`. In either cases it uses `app.json` configuration file in the root of the project.
362
363If you are running `Debug in Exponent` configuration or any of pallette commands like `Run in Exponent`, `Publish to Exponent` then this file will be created automatically if absent or updated with the following basic configuration section:
364
365```json
366{
367 "expo": {
368 "slug": "MyApp", // Project slug
369 "name": "MyApp", // Project name
370 "sdkVersion": "31.0.0", // Expo SDK version
371 "entryPoint": ".vscode\\exponentIndex.js" // Entrypoint for the project
372 },
373 "name": "MyApp" // Project name
374}
375```
376
377Full list of configuration parameters for `expo` section in `app.json` may be found on [official Expo documentation page](https://docs.expo.io/versions/latest/workflow/configuration).
378
379For running **pure React Native app**, the extension, creates and uses `.vscode/exponentIndex.js` which points to the app entrypoint (`index.js` or `index.android.js` or `index.ios.js`) file.
380
381If you want to change your app entrypoint (for example, from `index.js` to `index.android.js`), delete `.vscode/exponentIndex.js` and then restart your debugging session.
382
383**NOTE**: The extension caches the version of the exponent SDK used by your project. This is helpful since we don't want to install the SDK each time you run exponent. If you want the extension to update the SDK version based on your React Native version, just restart VS Code and if it is supported it should work. If it does not please open an issue.
384
385### Expo Hermes
386
387Expo app is supporting Hermes Engine.
388
389You can add or remove `"jsEngine": "hermes"` in `app.json` to enable or disable Hermes Engine. And any changes for app engine you need to run `eas build` to rebuild your application.
390
391```json
392{
393 "expo": {
394 "jsEngine": "hermes"
395 }
396}
397```
398
399**Note**: You maybe need to create developer account to run `eas build`. Any other issue or limitiation, please see [expo hermes ducomentation](https://docs.expo.dev/guides/using-hermes/).
400
401## React Native for Windows
402
403### How to launch and debug a React Native for Windows application
404
405Before launching and debugging a React Native for Windows application, please make sure that your development environment is configured properly in accordance with [the official system requirements](https://microsoft.github.io/react-native-windows/docs/rnw-dependencies).
406
407You can debug UWP React Native for Windows applications by changing the `platform` in your `launch.json` configuration to `windows`:
408
409```json
410{
411 "name": "Debug Windows",
412 "cwd": "${workspaceFolder}",
413 "type": "reactnative",
414 "request": "launch",
415 "platform": "windows"
416}
417```
418
419### How to attach to a running React Native for Windows application
420
4211. Add the `Attach to packager` configuration to `.vscode/launch.json` in your project
422
423 ```json
424 {
425 "name": "Attach to packager",
426 "cwd": "${workspaceFolder}",
427 "type": "reactnative",
428 "request": "attach"
429 }
430 ```
431
4321. (**Optional**) Start Metro packager by means of the `React Native: Start Packager` Command Palette command or run `npx react-native start` command in the terminal in the project root folder
4331. Select the `Attach to packager` configuration and click the `play` button. If Metro packager isn't running yet, the extension will start it automatically.
4341. Launch your React Native Windows application. Please make sure that the application is on remote debugging mode.
435
436Then the extension should attach to the running application.
437
438You can find more information on how to setup your application to work with Windows in [React Native for Windows Getting started instruction](https://microsoft.github.io/react-native-windows/docs/getting-started)
439
440### Windows Hermes debugging
441
442Please follow [the official guide](https://microsoft.github.io/react-native-windows/docs/hermes#hermes-on-windows) to enable Hermes engine for a Windows application.
443
444To debug a Windows Hermes application you can use `Debug Windows Hermes - Experimental` debugging scenario:
445
446```json
447{
448 "name": "Debug Windows Hermes - Experimental",
449 "request": "launch",
450 "type": "reactnativedirect",
451 "cwd": "${workspaceFolder}",
452 "platform": "windows"
453}
454```
455
456## React Native for macOS
457
458You can debug React Native for macOS applications by changing the `platform` in your `launch.json` configuration to `macos`:
459
460```json
461{
462 "name": "Debug macOS",
463 "cwd": "${workspaceFolder}",
464 "type": "reactnative",
465 "request": "launch",
466 "platform": "macos"
467}
468```
469
470To attach to a running macOS application you can use the default `Attach to packager` debugging configuration. Please make sure that the application is on remote debugging mode.
471
472```json
473{
474 "name": "Attach to packager",
475 "cwd": "${workspaceFolder}",
476 "type": "reactnative",
477 "request": "attach"
478}
479```
480
481You can find more information on how to setup your application to work with macOS in [React Native for macOS Getting started instruction](https://microsoft.github.io/react-native-windows/docs/rnm-getting-started)
482
483### macOS Hermes debugging
484
485Please follow [the official guide](https://microsoft.github.io/react-native-windows/docs/hermes#available-on-macos) to enable Hermes engine for a macOS application.
486
487To debug a macOS Hermes application you can use `Debug macOS Hermes - Experimental` debugging scenario:
488
489```json
490{
491 "name": "Debug macOS Hermes - Experimental",
492 "request": "launch",
493 "type": "reactnativedirect",
494 "cwd": "${workspaceFolder}",
495 "platform": "macos"
496}
497```
498
499## TypeScript and Haul
500
501### Sourcemaps
502
503The debugger uses sourcemaps to let you debug with your original sources, but sometimes the sourcemaps aren't generated properly and overrides are needed. In the config we support `sourceMapPathOverrides`, a mapping of source paths from the sourcemap, to the locations of these sources on disk. Useful when the sourcemap isn't accurate or can't be fixed in the build process.
504
505The left hand side of the mapping is a pattern that can contain a wildcard, and will be tested against the `sourceRoot` + `sources` entry in the source map. If it matches, the source file will be resolved to the path on the right hand side, which should be an absolute path to the source file on disk.
506
507Below there are some examples of how sourcemaps could be resolved in different scenarios:
508
509```javascript
510// webRoot = /Users/me/project
511"sourceMapPathOverrides": {
512 "webpack:///./~/*": "${webRoot}/node_modules/*", // Example: "webpack:///./~/querystring/index.js" -> "/Users/me/project/node_modules/querystring/index.js"
513 "webpack:///./*": "${webRoot}/*", // Example: "webpack:///./src/app.js" -> "/Users/me/project/src/app.js",
514 "webpack:///*": "*", // Example: "webpack:///project/app.ts" -> "/project/app.ts"
515 "webpack:///src/*": "${webRoot}/*" // Example: "webpack:///src/app.js" -> "/Users/me/project/app.js"
516}
517```
518
519### Haul debugging
520
521The extension provides functional to attach to [Haul packager](https://callstack.github.io/haul/) based applications. You can use the `Attach to packager` scenario to attach to a Haul based app and debug it. For now launch scenarios aren't supported. You can find more info in [the issue](https://github.com/microsoft/vscode-react-native/issues/883).
522
523You can prepare your React Native application to work with `Haul` by following the [`Haul Getting started` guide](https://github.com/callstack/haul#getting-started).
524
525If you use the [legacy version](https://github.com/callstack/haul/tree/legacy) of `Haul` as your React Native bundler instead of the default [Metro](https://facebook.github.io/metro/), it could be required to add `sourceMapPathOverrides` to the `launch.json` file.
526
527For example:
528
529```json
530{
531 // Other configurations
532 "sourceMapPathOverrides": {
533 "webpack:///./~/*": "${workspaceRoot}/node_modules/*",
534 "webpack:///./*": "${workspaceRoot}/*",
535 "webpack:///*": "*"
536 }
537}
538```
539
540## Debugger configuration properties
541
542The following is a list of all the configuration properties the debugger accepts in `launch.json`:
543
544| Name | Description | Type | Defaults |
545| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | --------------------------------------------- |
546| `cwd` | The path to the project root folder | `string` | `${workspaceFolder}` |
547| `sourceMaps` | Whether to use JavaScript source maps to map the generated bundled code back to its original sources | `boolean` | `true` |
548| `sourceMapPathOverrides` | A set of mappings for rewriting the locations of source files from what the source map says, to their locations on disk. See [Sourcemaps](#sourcemaps) for details | `object` | n/a |
549| `sourceMapRenames` | Whether to use the "names" mapping in sourcemaps. This requires requesting source content, which could slow debugging | `boolean` | `false` |
550| `enableDebug` | Whether to enable debug mode. If set to "false", an application will be launched without debugging | `boolean` | `true` |
551| `webkitRangeMin`, `webkitRangeMax` | Combines to specify the port range that you want the [ios-webkit-debug-proxy](https://github.com/google/ios-webkit-debug-proxy) to use to find the specific device described in the Direct iOS debug configuration | 9223, 9322 |
552| `trace` | Logging level in debugger process. May be useful for diagnostics. If set to "Trace" all debugger process logs will be available in `Debug Console` output window | `string` | `log` |
553| `address` | TCP/IP address of packager to attach to for debugging | `string` | `localhost` |
554| `port` | Port of packager to attach to for debugging | `string` | `8081` |
555| `remoteRoot` | The source root of the remote host | `string` | `null` |
556| `localRoot` | The local source root that corresponds to the 'remoteRoot' | `string` | `${workspaceFolder}` |
557| `skipFiles` | An array of file or folder names, or glob patterns, to skip when debugging | `array` | `[]` |
558| `debuggerWorkerUrlPath` | Path to the app debugger worker to override. For example, if debugger tries to attach to http://localhost:8081/debugger-ui/debuggerWorker.js and you get 404 error from packager output then you may want to change debuggerWorkerUrlPath to another value suitable for your packager (\"debugger-ui\" will be replaced with the value you provide) | `string` | `debugger-ui/` |
559| `platform` | The platform to target. Possible values: `android`, `ios`, `exponent`, `windows` | `string` | n/a |
560| `target` | Target to run on. Possible values: `simulator`, `device`, `<iOS target name/udid>`, [`<Android target id>`](https://github.com/react-native-community/cli/blob/master/docs/commands.md#--deviceid-string), `<Android emulator AVD name>`. If the value is `simulator` or `device` then the quick pick window will be expanded with the names of the available virtual or physical targets, then, in case there are more than one available target with specified type, the target value in `launch.json` will be changed to the name or id of the selected target. If you have only one target with specified type available, it will be selected automatically. If you're using Android emulator targets, please, make sure the `emulator` utility is added to `PATH` | `string` | `simulator` |
561| `logCatArguments` | Arguments to be used for LogCat (The LogCat output will appear on an Output Channel). It can be an array such as: `[":S", "ReactNative:V", "ReactNativeJS:V"]` | `array` | `["*:S", "ReactNative:V", "ReactNativeJS:V"]` |
562| `runArguments` | Run arguments to be passed to `react-native run-<platform>` command (override all other configuration params) | `array` | n/a |
563| `launchActivity` | The Android activity to be launched for debugging, e.g. it specifies [`--main-activity`](https://github.com/react-native-community/cli/blob/master/docs/commands.md#--main-activity-string) parameter in `react-native` run arguments | `string` | `MainActivity` |
564| `expoHostType` | The connection type to be used on Expo debugging to communicate with a device or an emulator. Possible values: <ul><li>`tunnel` - allows to deploy and debug an application by means of Expo cloud services</li><li>`lan` - allows to deploy and install an application via your LAN</li><li>`local` - allows to debug an application on an emulator or an Android device without network connection</li></ul> | `string` | `lan` |
565| `env` | Environment variables passed to the debugger and `react-native run-<platform>` command | `object` | `{}` |
566| `envFile` | Absolute path to a file containing environment variable definitions | `string` | `${workspaceFolder}/.env` |
567| `variant` | A variant to be passed to `react-native run-android`, e.g. use `devDebug` to specify `--variant=devDebug` | `string` | n/a |
568| `scheme` | A scheme name to be passed to `react-native run-ios`, e.g. `devDebug` to specify `--scheme=devDebug` | `string` | n/a |
569| `productName` | iOS bundle display name e.g. `AwesomeProject` value means that the extension will search for `AwesomeProject.app` bundle | `string` | n/a |
570
571# Customization
572
573The extension can be further customized for other React Native scenarios. These are the most common:
574
575## Logging
576
577The extension logging is divided by several output channels:
578
579- React Native - the main extension channel which collects outputs from React Native Packager and shows critical errors in the extension
580- These channels are spawned only when the specific launch scenario is executed:
581 - React Native: Run Android
582 - LogCat monitor(to get LogCat output from Android device, can be filtered by debug configuration settings)
583 - React Native: Run iOS
584 - React Native: Run macOS
585 - React Native: Run Windows
586 - React Native: Run exponent
587- Debug Console which is used to receive application logs and logs generated by the debug adapter (`console.log` and other `std` outputs from the app)
588- Extension debugger verbose logs (these logs are shown up only if the `trace: "verbose"` option is enabled in debug scenarios)
589 - React Native Chrome Proxy - shows what runs in and out to the debugger and application
590 - Debug Console becomes more informative and contains some debugging information from the debug adapter
591 - Global extension errors are controlled by VS Code and printed in VS Code Developer Tools
592
593There are also some global extension technical logs that might be exposed to the output. To see them set the following properties in your VS Code Settings:
594
595```json
596{
597 "react-native-tools": {
598 "logLevel": "Trace"
599 }
600}
601```
602
603`logLevel` can be `None` (no logs), `Error`, `Warning`, `Info`, `Debug`, `Trace` (all logs). Default is `Info`.
604
605## Build APK and generate bundle
606
607You can add VSCode tasks to build an `.apk` file and generate iOS/Android bundles.
608
609The following is an example of a `tasks.json` for `react-native init` projects.
610Place it in the `.vscode` folder in your project to use it:
611
612```json
613{
614 "version": "2.0.0",
615 "presentation": {
616 "reveal": "always",
617 "panel": "new"
618 },
619 "tasks": [
620 {
621 "label": "Build APK Debug",
622 "group": "build",
623 "type": "shell",
624 "windows": {
625 "command": "cd android; if($?) {./gradlew assembleDebug}"
626 },
627 "linux": {
628 "command": "cd android && ./gradlew assembleDebug"
629 }
630 },
631 {
632 "label": "Build APK Release",
633 "group": "build",
634 "type": "shell",
635 "windows": {
636 "command": "cd android; if($?) {./gradlew assembleRelease}"
637 },
638 "linux": {
639 "command": "cd android && ./gradlew assembleRelease"
640 }
641 },
642 {
643 "label": "Generate Android Bundle",
644 "group": "build",
645 "type": "shell",
646 "command": "npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/main.jsbundle"
647 },
648 {
649 "label": "Generate iOS Bundle",
650 "group": "build",
651 "type": "shell",
652 "command": "npx react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios/main.jsbundle"
653 }
654 ]
655}
656```
657
658To learn more about `tasks` in VSCode read [the official documentation](https://code.visualstudio.com/docs/editor/tasks).
659
660Visit [generating Signed APK](https://reactnative.dev/docs/signed-apk-android) to learn more about this subject.
661
662## Specifying custom arguments for `react-native run-*` command
663
664Using custom run arguments for `react-native run-<platform>`:
665**NOTE:** This overrides all other configuration parameters.
666
667```json
668{
669 "react-native.android.runArguments.simulator": [
670 "--appFolder",
671 "/Users/test/AwesomeProject/android/app",
672 "--deviceId",
673 "emulator-5555"
674 ],
675 "react-native.ios.runArguments.device": [
676 "--project-path",
677 "ios",
678 "--device",
679 "Max's iPhone"
680 ]
681}
682```
683
684**NOTE:** You can get the list of installed simulator devices by:
685
686iOS devices (macOS only):
687
688```
689xcrun simctl list --json devices
690```
691
692Android devices:
693
694```
695adb devices
696```
697
698**NOTE:** If you want to run the application on an iOS device, make sure you have `ios-deploy` installed globally.
699
700`brew install ios-deploy`
701
702## Setting up the React Native packager
703
704To use a custom port for the `react-native` packager:
705
706```json
707{
708 "react-native": {
709 "packager": {
710 "port": portNumber
711 }
712 }
713}
714```
715
716If you change this port, then for iOS device and simulator scenarios you will have to modify the native code files. [Instructions here](https://childofcode.com/react-native-0-63-running-on-device-by-other-port-solution/).
717
718If you use Android, you need to change the debug server by:
719
7201. `CTRL+M`(`CMD+M`) in the emulator
7212. Go to `Dev Settings`
7223. Debug server host for device => enter `localhost:<yourPortNumber>`.
7234. Reload application (press `R` twice)
7245. (Hermes only) Hermes engine listens port 8081 for debugging by default, to change it you might need to modify your [`metro.config.js` file adding `"port": portNumber` argument in there to the server settings](https://facebook.github.io/metro/docs/configuration/#port).
725
726```js
727// Example of metro.config.js
728module.exports = {
729 server: {
730 port: 9091,
731 },
732};
733```
734
735<details>
736<summary>Port setup instruction</summary>
737
738![image](resources/images/select-dev-menu.png)
739
740![image](resources/images/dev-menu-setup-custom-host.png)
741
742![image](resources/images/custom-host-and-port.png)
743
744</details>
745
746**NOTE:** Some aspects of React Native hard-code the port to the default as specified in [this issue](https://github.com/facebook/react-native/issues/9145).
747
748### Custom environment variables
749
750Extension supports passing custom environment variables to the React Native Packager process context. To add custom variables you can create `.env` file in the root folder of your project and add needed environment variables in the following format:
751
752```
753
754Variable1_name=Variable1_value
755Variable2_name=Variable2_value
756
757```
758
759Variables that are declared in this `.env` file can override the original environment variables from `process.env` of the Packager process.
760
761It is possible to transfer environment variables (via `env` and `envFile` arguments in `launch.json`) from the `launch` or `attach` debug scenarios to the Packager. If these variables are defined, then they will be used, otherwise the `.env` file is used.
762
763## Change project root
764
765To specify a subfolder in which the react-native project is located, set `react-native-tools.projectRoot`. You can use either an absolute or relative path in your VS Code Settings:
766
767```json
768{
769 "react-native-tools": {
770 "projectRoot": "./your/react-native/project"
771 }
772}
773```
774
775## Configure an Android LogCat Monitor
776
777There are two ways to filter your LogCat Monitor output depending on how LogCat Monitor was launched:
778
7791. Since LogCat Monitor is launched for all Android launch scenarios by default, you can add `logCatArguments` to your debug scenario in `launch.json` file like in the following example:
780
781```json
782{
783 "name": "Debug Android",
784 "cwd": "${workspaceFolder}",
785 "type": "reactnative",
786 "request": "launch",
787 "platform": "android",
788 "logCatArguments": ["ReactNativeJS:V"]
789}
790```
791
7922. If you want to launch LogCat Monitor from the Command Palette command `React Native: Run React Native LogCat Monitor` with filtering options set `react-native.android.logCatArguments` settings in your `settings.json`:
793
794```json
795{
796 "react-native.android.logCatArguments": [
797 "*:S",
798 "ReactNative:V",
799 "ReactNativeJS:V"
800 ]
801}
802```
803
804To have better understanding on how LogCat filtering works take into account that the extension launches LogCat with flag `-s` and then adds user-provided filters as arguments. Please see the [official instruction on how does LogCat filtering works](https://developer.android.com/studio/command-line/logcat#filteringOutput).
805
806## Configure dependencies versions for debugging Expo projects
807
808To debug Expo applications the extension requires additional dependencies, such as `xdl` and `@expo/metro-config`. These packages are installed automatically on the first start of the Expo debugging scenario. You can configure the dependencies versions by adding the `react-native.expo.dependencies` parameter, which contains packages names and appropriate versions, to the `settings.json` file:
809
810```json
811{
812 "react-native.expo.dependencies": {
813 "xdl": "59.2.0",
814 "@expo/metro-config": "0.2.0",
815 "@expo/ngrok": "^4.1.0"
816 }
817}
818```
819
820To enable new versions of the dependencies, it's required to restart VS Code editor. After that the extension will download the new versions of the packages on the next Expo debugging starting.
821
822## Configure custom key bindings for extension commands
823
824The extension provides context variables for the following features:
825|Context variable|Feature|
826|---|---|
827|`isRNPackagerRunning` - true if the packager is running|Metro packager|
828|`isRNTNetworkInspectorRunning` - true if the Network inspector is running|Network inspector|
829
830Using these context variables you can assign the same keyboard combination for some pair commands for more convenient use. For example, you can configure the same key bindings for `Start Packager` and `Stop Packager` commands using `when` clauses, as shown below:
831![image](resources/images/custom-keybindings.png)
832
833## Configure custom colors for extension output logs
834
835The extension provides custom TextMate tokens, with the help of which it is now possible to customize the colors of the logs in output channels:
836|Scope|Description|
837|---|---|
838|`rnt.output.string`|Single and double quoted strings|
839|`rnt.output.url`|Links, email and ip address, filepaths|
840|`rnt.output.timestamp`|Date and time|
841|`rnt.output.numeric`|Constant decimal numbers|
842|`rnt.output.process`|Logs of processes such as npm, bundle, and other build tasks|
843|`rnt.output.error`|Errors, exceptions, fails and stack for them|
844|`rnt.output.warn`|Warning logs|
845|`rnt.output.info`|Info logs|
846|`rnt.output.debug`|Debug logs|
847|`rnt.output.verbose`|Verbose logs|
848|`rnt.output.constant`|Such values as `true`, `false`, `null`, `undefined`, `NaN`|
849|`rnt.output.success`|Logs indicating successful completion of the process, such as `BUILD SUCCESSFUL` and others|
850
851Now you can customize React Native Tools output logs with `editor.tokenColorCustomizations` parameter in `settings.json` this way:
852
853```json
854"editor.tokenColorCustomizations": {
855 "textMateRules": [
856 {
857 "settings": {
858 "foreground": "#c57ca0",
859 "fontStyle": "bold",
860 },
861 "scope": "rnt.output.string"
862 }
863 ]
864}
865```
866
867# Element inspector
868
869In the extension you can run React DevTools Element inspector to inspect the DOM-tree of your application.
870It's required to install the [`react-devtools`](https://www.npmjs.com/package/react-devtools) package globally to run React DevTools from the extension.
871
872```
873npm install -g react-devtools
874```
875
876### Integration with React Native Inspector
877
878You can open the in-app developer menu and choose "Show Element Inspector". It will bring up an overlay that lets you tap on any UI element and see information about it:
879
880![Element inspector usage](resources/images/element-inspector-usage.gif)
881
882Using the `Run Element Inspector` Command Palette command you can launch React DevTools in the extension. Inspector will enter a special collapsed mode, and use the DevTools as primary UI. In this mode, clicking on something in the emulator will bring up the relevant components in the DevTools:
883
884![Element inspector usage](resources/images/element-inspector-with-ui.png)
885
886# Network Inspector
887
888The extension provides `Network inspector` feature to inspect outgoing network traffic in your apps. You can browse all requests being made and their responses in VS Code DevTools console.
889
890![image](resources/images/network-inspector.png)
891
892### Network inspector requirements
893
894Before using the Network inspector, please make sure that your system meets the following requirements:
895
896- `OpenSSL` utility is installed and added to PATH. You can install `OpenSSL` the following way:
897 - Windows: `choco install openssl`
898 - macOS: `brew install openssl`
899 - Linux: `sudo apt-get install openssl`
900- (macOS only) [`idb`](https://fbidb.io/docs/installation/) utility is installed. It's required to interact with iOS physical devices
901
902The Network inspector uses functional of the Flipper plugin integrated to React Native apps. Please make sure that it's enabled in your application. You can use [this guide](https://fbflipper.com/docs/getting-started/react-native/) to integate Flipper into your projects.
903
904### Network inspector usage
905
906- To run the Network inspector you can use `Run Network Inspector` Command Palette command</br>
907 When the Network inspector detects a React Native application and connects to it, VS Code DevTools window will be opened automatically. But you can also open it manually, by opening `Help` menu and clicking `Toggle Developer Tools` option. After that you just need to open `Console` tab in DevTools, where network requests will be printed.
908- To stop the Network inspector you can use `Stop Network Inspector` Command Palette command
909
910For now the Network inspector doesn't support Expo applications.
911
912### Network inspector logs theme
913
914The extension provides “Dark” and “Light” color themes for Network Inspector logs. You can configure the theme in the extension configuration in your VS Code Settings.
915
916```json
917{
918 "react-native-tools.networkInspector.consoleLogsColorTheme": "Dark"
919}
920```
921
922# Developing inside a Docker Container
923
924The extension supports [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview) features on Linux. Please follow the [VS Code official documentation](https://code.visualstudio.com/docs/remote/containers) to setup your environment to use a remote development approach.
925
926You can use [official React Native Docker image](https://hub.docker.com/r/reactnativecommunity/react-native-android) provided by the [react-native-community](https://github.com/react-native-community/docker-android).
927
928Here are the steps to run React Native debugging inside a Docker Container on a real Android device:
929
9301. Open Command Palette and run the following command
931 ```
932 Remote-Containers: Add Development Container Configuration Files...
933 ```
934 Then select `Existing Dockerfile` to create `.devcontainer/devcontainer.json` configuration file.
9351. Сreate Dockerfile extending [reactnativecommunity/react-native-android image](https://hub.docker.com/r/reactnativecommunity/react-native-android). For example you can use the following Dockerfile:
936
937 ```
938 FROM reactnativecommunity/react-native-android:latest
939
940 RUN npm install -g expo-cli react-native-cli
941 ```
942
9431. Configure your `devcontainer.json` file as needed. Below is a sample configuration:
944
945 ```json
946 {
947 "name": "React Native Android Container",
948
949 // Sets the run context to one level up instead of the .devcontainer folder.
950 "context": "..",
951
952 // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
953 "dockerFile": "Dockerfile",
954
955 // The optional 'runArgs' property can be used to specify additional runtime arguments.
956 "runArgs": [
957 "--privileged", // give all capabilities to a container, in other words, the container can then do almost everything that the host can do
958 "--net",
959 "host", // forwarding all host machine ports
960 "-v",
961 "/dev/bus/usb:/dev/bus/usb" // mount connected USB devices to a container
962 ],
963
964 "settings": {
965 // This will ignore your local shell user setting for Linux since shells like zsh are typically
966 // not in base container images. You can also update this to an specific shell to ensure VS Code
967 // uses the right one for terminals and tasks. For example, /bin/bash (or /bin/ash for Alpine).
968 "terminal.integrated.shell.linux": null
969 },
970
971 // Add the IDs of extensions you want installed when the container is created in the array below.
972 "extensions": ["msjsdiag.vscode-react-native"]
973 }
974 ```
975
9761. Open Command Palette and run the following command `Remote-Containers: Open Folder in Container` to reopen your project in a container
9771. Connect your device via USB and start debugging the same way as on local machine.
978
979Currently the above scenario doesn't work on macOS and Windows. Docker Container implementation on these OS uses Virtual Machine tools which may have problems with USB forwarding for mobile devices.
980
981# Contributing
982
983Please see our [contributing guide](CONTRIBUTING.md) for more information.
984
985# Known Issues
986
987Here is the list of common known issues you may experience while using the extension:
988
989| Issue | Description |
990| ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
991| Debugger doesn't stop at breakpoints | Breakpoints require sourcemaps to be correctly configured. If you are using TypeScript, then make sure to follow the `Getting started` section for how to ensure sourcemaps are correctly set up. Also, similar issues may occur on React Native version `0.58.*` in some special cases (see [#928](https://github.com/microsoft/vscode-react-native/issues/928), [#907](https://github.com/microsoft/vscode-react-native/issues/907)), bumping dependencies versions of `react` and `react-native` package to the more recent ones should resolve these. If you are on Linux, make sure that the project folder which is opened is not a symbolic link to the real folder, that might cause problems with sourcemaps (see [#1456](https://github.com/microsoft/vscode-react-native/issues/1456)) |
992| 'adb: command not found' | If you receive an error `adb: command not found`, you need to update your system Path to include the location of your _ADB_ executable.The _ADB_ executable file is located in a subdirectory along with your other Android SDK files. |
993| Targeting iPhone 6 doesn't work | There was a known issue with React Native ([#5850](https://github.com/facebook/react-native/issues/5850)) but it was fixed. Please upgrade your version of React Native. |
994| Can't communicate with socket pipe | (Linux only) If you have two workspaces open that only differ in casing, the extension will fail to communicate effectively. |
995| "Add configuration" button doesn't work when trying to add debug configuration to `launch.json` | You have to add some json configuration to `launch.json` manually. Please, see ([#985](https://github.com/microsoft/vscode-react-native/issues/985)). |
996| Error `None of these files exist: * .vscode/exponentIndex` appears when running React Native apps via Expo | On some project configurations (mostly on macOS) there could be problems with running RN app via Expo for the first time. You can resolve this by explicitly adding `module.exports.watchFolders = ['.vscode'];` to your Metro config. This will help Metro bundler to find the custom entry point generated by the extension needed to work with Expo. For details you can see the issue ([#1327](https://github.com/microsoft/vscode-react-native/issues/1327)). |
997| High CPU load notification while starting debugging Expo app | When you start debugging the Expo application you may receive the notification `"The extension 'React Native Tools' took a very long time to complete its last operation and it has prevented other extensions from running"`. The issue occurs because of importing the `xdl` package, which extension uses for debugging Expo applications. The `xdl` package has the large size and some peculiarities of its structure, so it may cause high CPU load. |
998
999[Known-Issues](https://github.com/microsoft/vscode-react-native/issues?q=is%3Aissue+label%3Aknown-issues) provides a complete list of active and resolved issues.
1000
1001# Telemetry reporting
1002
1003VS Code React Native extension collects usage data and sends it to Microsoft to help improve our products and services. Read our [privacy statement](https://www.visualstudio.com/en-us/dn948229) to learn more.
1004
1005If you don’t wish to send usage data to Microsoft, edit `VSCodeTelemetrySettings.json` file at `~/.vscode-react-native` and add `optIn:false`.
1006
1007# Code of conduct
1008
1009This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
1010