microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
37f011eefe3ccfa579b89b6945f8a4ba6720f00d

Branches

Tags

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

Clone

HTTPS

Download ZIP

doc/customization.md

105lines · modeblame

2af998b7Vladimir Kotikov8 years ago1# Customization
2
3There are a few customizations supported by this extension; they can be added to your `.vscode/settings.json` if you need them.
4
e5d4370fRuslan Bikkinin8 years ago5**NOTE**: To apply changes you made to `.vscode/settings.json`, please, save it and then **restart VS Code instance**.
6
2af998b7Vladimir Kotikov8 years ago7## Specifying custom arguments for `react-native run-*` command
8
9For using custom run arguments for `react-native run-<platform>`:
10* **Note:** This overrides all other configuration parameters.
11
12```
13{
0792d798Brendan McGill7 years ago14"react-native.android.runArguments.simulator": ["--appFolder", "/Users/test/AwesomeProject/android/app", "--deviceId", "emulator-5555"],
2af998b7Vladimir Kotikov8 years ago15"react-native.ios.runArguments.device": ["--project-path", "ios", "--device", "Max's iPhone"],
16}
17```
18
19* **Note:** You can get the list of installed simulator devices by:
20
21iOS devices(MacOS only):
22
23```
24xcrun simctl list --json devices
25```
26
27Android devices:
28
29```
30adb devices
31```
32
33* **Note:** If you want run application on iOS devices make sure you have `ios-deploy` installed globally.
34
35```npm install -g ios-deploy```
36
37## Setting up the react-native packager
38
39To use a custom port for the `react-native` packager:
40
41```
42{
43"react-native": {
44"packager" : {
45"port": portNumber
46}
47}
48}
49```
50
b57ea017Artem Egorov8 years ago51If you change this port, then for iOS device and simulator scenarios you will have to modify the native code files. Instruction [here](https://blog.binoy.io/running-react-native-on-a-different-port-7deb43887cd4).<br>
52If you use android, you need to change debug server by:
531. CTRL+M(CMD+M) in the emulator
542. Go to Dev Settings
553. Debug server host for device => enter ‘localhost:\<yourPortNumber\>’.
564. Reload application (double R)
57
58* Note that 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).
2af998b7Vladimir Kotikov8 years ago59
8c3266b0RedMickey6 years ago60## Setting up React Native global CLI
61
62By default React Native Tools extension uses React Native local CLI from React Native project's dependencies to run React Native commands. Local CLI module is available at the following path: `yourProjectDir/node_modules/.bin/react-native`. But it is possible to change that approach and use globally installed React Native CLI that is available from your PATH environment variable.
63
64To specify React Native CLI installed globally, you can use `reactNativeGlobalCommandName` parameter. This parameter is responsible for launcher command name, which is used to run React Native commands. If you edit `reactNativeGlobalCommandName` parameter in your `settings.json` file, the extension will use specified launcher command name to run React Native commands (e.g. `react-native run-android` instead of `yourProjectDir/node_modules/.bin/react-native run-android`).
65For example, `react-native` is launcher command name for Facebook React Native CLI. You can specify it like this:
66
67```
68{
69"react-native-tools.reactNativeGlobalCommandName": "react-native"
70}
71```
72
73You can also use custom React Native CLI compatible with Facebook React Native CLI, by setting up `reactNativeGlobalCommandName` parameter:
74
75```
76{
77"react-native-tools.reactNativeGlobalCommandName": "custom-react-native"
78}
79```
80
2af998b7Vladimir Kotikov8 years ago81## Logging
82
83To expose internal logs to the output, set the following properties:
84
85```
86{
87"react-native-tools": {
88"logLevel": "Trace"
89}
90}
91```
92
7ef94dceArtem Egorov8 years ago93`logLevel` can be `None` (no logs), `Error`, `Warning`, `Info`, `Debug`, `Trace` (all logs). Default is `Info`.
2af998b7Vladimir Kotikov8 years ago94
95## Project structure
96
97To 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 here:
98
99```
100{
101"react-native-tools": {
102"projectRoot": "./your/react-native/project"
103}
104}
105```