microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
doc/customization.md
94lines · modeblame
2af998b7Vladimir Kotikov8 years ago | 1 | # Customization |
| 2 | | |
| 3 | There are a few customizations supported by this extension; they can be added to your `.vscode/settings.json` if you need them. | |
| 4 | | |
| 5 | ## Specifying custom arguments for `react-native run-*` command | |
| 6 | | |
| 7 | For using custom run arguments for `react-native run-<platform>`: | |
| 8 | * **Note:** This overrides all other configuration parameters. | |
| 9 | | |
| 10 | ``` | |
| 11 | { | |
| 12 | "react-native.android.runArguments.simulator": ["--appFolder, "/Users/test/AwesomeProject/android/app", "--deviceId", "emulator-5555"], | |
| 13 | "react-native.ios.runArguments.device": ["--project-path", "ios", "--device", "Max's iPhone"], | |
| 14 | } | |
| 15 | ``` | |
| 16 | | |
| 17 | * **Note:** You can get the list of installed simulator devices by: | |
| 18 | | |
| 19 | iOS devices(MacOS only): | |
| 20 | | |
| 21 | ``` | |
| 22 | xcrun simctl list --json devices | |
| 23 | ``` | |
| 24 | | |
| 25 | Android devices: | |
| 26 | | |
| 27 | ``` | |
| 28 | adb devices | |
| 29 | ``` | |
| 30 | | |
| 31 | * **Note:** If you want run application on iOS devices make sure you have `ios-deploy` installed globally. | |
| 32 | | |
| 33 | ```npm install -g ios-deploy``` | |
| 34 | | |
| 35 | ## Setting up the react-native packager | |
| 36 | | |
| 37 | To use a custom port for the `react-native` packager: | |
| 38 | | |
| 39 | ``` | |
| 40 | { | |
| 41 | "react-native": { | |
| 42 | "packager" : { | |
| 43 | "port": portNumber | |
| 44 | } | |
| 45 | } | |
| 46 | } | |
| 47 | ``` | |
| 48 | | |
b57ea017Artem Egorov8 years ago | 49 | If 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> |
| 50 | If you use android, you need to change debug server by: | |
| 51 | 1. CTRL+M(CMD+M) in the emulator | |
| 52 | 2. Go to Dev Settings | |
| 53 | 3. Debug server host for device => enter ‘localhost:\<yourPortNumber\>’. | |
| 54 | 4. Reload application (double R) | |
| 55 | | |
| 56 | * 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 ago | 57 | |
| 58 | ## Logging | |
| 59 | | |
| 60 | To expose internal logs to the output, set the following properties: | |
| 61 | | |
| 62 | ``` | |
| 63 | { | |
| 64 | "react-native-tools": { | |
| 65 | "logLevel": "Trace" | |
| 66 | } | |
| 67 | } | |
| 68 | ``` | |
| 69 | | |
| 70 | `logLevel` can be `None` (no logs), `Error`, `Warning`, `Info`, `Debug`, `Trace` (all logs). Default is `None`. | |
| 71 | | |
| 72 | ## Project structure | |
| 73 | | |
| 74 | To 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: | |
| 75 | | |
| 76 | ``` | |
| 77 | { | |
| 78 | "react-native-tools": { | |
| 79 | "projectRoot": "./your/react-native/project" | |
| 80 | } | |
| 81 | } | |
| 82 | ``` | |
| 83 | | |
| 84 | ## TypeScript | |
| 85 | | |
| 86 | To use a different `TypeScript TSDK` version than the one that comes with VS Code, set the following: | |
| 87 | | |
| 88 | ``` | |
| 89 | { | |
| 90 | "typescript": { | |
| 91 | "tsdk": "path/to/tsdk" | |
| 92 | } | |
| 93 | } | |
| 94 | ``` |