Summary:
I had to re-do my CLI pull request internally using hg because shipit couldn't import binary files even after debugging with the OSS team. While using hg I messed up. This should fix it:
- Remove files added by mistake when using 'hg addremove'
- Add Xcode project that was ignored by hg (probably at fb we don't want people to check in Xcode projects since we use Buck)
**Test Plan**
Travis tests on this pull request.
Closes https://github.com/facebook/react-native/pull/11043
Differential Revision: D4212755
Pulled By: bestander
fbshipit-source-id: c762472ed31b9845425c1766510dce7761a35ae0
Summary: Uses `Logger` for the HMR Server output so that we get timestamps for free and the packager server output does not look as crappy.
Reviewed By: cpojer
Differential Revision: D4210827
fbshipit-source-id: e1ae64c359150b98c33e7b074f1111d37a2bc39b
Summary:
This is the manually imported version of https://github.com/facebook/react-native/pull/10786
This was mostly straigthforward by replacing the local-cli folder with the version I had in my local git checkout,
plus a few other files I listed with git diff --name-only.
Reviewed By: hramos
Differential Revision: D4201118
fbshipit-source-id: 4d0fb54b0edda9de1abba427958e420fd2ac105c
Summary: This adds a new flag to the `unbundle` command: `--indexed-unbundle` allows to output the indexed file format even when building for android.
Reviewed By: cpojer
Differential Revision: D4189485
fbshipit-source-id: e56192456de764eb38c25b574ceaaf52eb8a6fca
Summary:
This is the next incremental step to rewrite node-haste. I apologize for the size of this diff but there is really no smaller way to do this. The current architecture passes a single file watcher instance into many classes that each subscribe to file changes. It's really hard to keep track of this. The new implementation reduces the listeners to two (will eventually be just one!) - one in DependencyGraph and one in it's parent's parent's parent (ugh! This doesn't make any sense). This should make it much more straightforward to understand what happens when a file changes.
I was able to remove a bunch of tests because jest's watcher takes care of things like ignore patterns. Some of the tests were specifically testing for whether the change events were invoked and they are now much more straightforward as well by manually invoking the `processFileChange` methods.
(Relanding a fixed version of D4161662)
Reviewed By: kentaromiura
Differential Revision: D4194378
fbshipit-source-id: 8c008247a911573f6b5f6b0b374d50d38f62a4f5
Summary:
Implements a multi-device proxy for the Chrome debugging protocol. Each device connects
to the proxy over a single websocket connection that is able to multiplex messages to multiple
Javascript VMs. An inspector instance running in Chrome can connect to a specific VM via this
proxy.
Reviewed By: davidaurelio
Differential Revision: D4088492
fbshipit-source-id: 3ee934e98604b5a378da732e687ca05fe3d23ce0
Summary:
Currently, to generate a `Release` build in `Android` it is required to get into the `android` directory and run the `react native bundle`with a lot of options and after that run the `gradle` to assemble or install the application with the build type `Release`.
This PR improves the process adding that feature to the `React Native CLI`.
To generate a release build is only required to use the parameter `--configuration` with the value `Release`.
**Examples**
To generate a release build:
```sh
react-native run-android --configuration release
```
To generate a release build for the product flavors staging:
```sh
react-native run-android --configuration release --flavor staging
```
To generate a debug build:
```sh
react-native run-android
```
To generate a debug build for the product flavors staging:
```sh
react-native run-android --flavor staging
```
This PR also removes the option `--install-debug` from the `react-native run-android` because that is always the default value,
Closes https://github.com/facebook/react-native/pull/10867
Differential Revision: D4167203
Pulled By: cpojer
fbshipit-source-id: c5ac07f81feeeea00ee0e8b059b46ef0d258a1a6
Summary:
With the current `run-ios` script it is not possible to create/run iOS release builds or any other kind of scheme configuration from the terminal (we need to use `Xcode`). The reason for this is that the `run-ios` script does not expose the scheme configuration option for the `xcodebuild` command. This PR exposes that property and allows the developers to directly create/run release builds from the terminal.
This PR also closes [this](https://productpains.com/post/react-native/create-ios-release-builds-from-terminal) request at `productpains`.
And answers to [this](http://stackoverflow.com/questions/40303229/run-a-react-native-ios-release-build-from-terminal) question at the `stackoverflow`.
**Test plan (required)**
To generate a release build just run:
``` sh
react-native run-ios --configuration Release
```
The output
``` sh
Found Xcode project App.xcodeproj
Launching iPhone 6 (iOS 9.3)...
Building using "xcodebuild -project App.xcodeproj -scheme App -destination id=B0738993-CE4A-4D
Closes https://github.com/facebook/react-native/pull/10637
Differential Revision: D4151793
Pulled By: cpojer
fbshipit-source-id: 5a0fcdd59589977f3e251ec9bb3ba85e8919cffc
Summary:
Fixes#10638.
Added NativeAnimation library to the starter project iOS generator. Passing `useNativeDriver: true` to `Animated` config will enable the app to tap into the native code for animations.
**Test plan**
Init a RN project and animate an element. Enable native driver as follows:
```
Animated.timing(
this.state.value,
{
toValue: 300, // some value
useNativeDriver: true
}
).start();
```
Earlier, this used to crash.
Closes https://github.com/facebook/react-native/pull/10783
Differential Revision: D4159386
Pulled By: mkonicek
fbshipit-source-id: 993481a31b4446eab24ef4ee35ae1941d7a7aae9
Summary:
Force npm for e2e tests.
Bonus: tracked down and removed a non-standard `.done()` call that was breaking e2e tests.
Reviewed By: bestander
Differential Revision: D4153514
fbshipit-source-id: 079939874ea75c7ea6e3e5376d37873c95fc74c1
Summary:
Link doesn't work on f8app,
as it is, android projects don't have to contain the matching string and then the linking would not work, I've switched it to the much simpler new-line.
If you can find a better common minimum string for settings.gradle please do.
Commit Msg:
Current string, `include ':app'\n`, is not a minimum common string.
Instead a simple `\n` will do.
Closes https://github.com/facebook/react-native/pull/10172
Differential Revision: D4150313
fbshipit-source-id: 34470e1fb67194e41354b6085fb3eb90ddaa7ff8
Summary: Use native Promises in React Native Packager. Remove all the non-standard `Promise.done()` calls throughout the codebase & replace `Promise.denodeify` with the stand-alone `denodeify` module.
Reviewed By: davidaurelio
Differential Revision: D4146965
fbshipit-source-id: 1730531c914863ac3c52626801d9f91c28eed717
Summary:
Check that 'react-native init' itself used yarn to install React Native.
When using an old global react-native-cli@1.0.0 (or older), we don't want to install React Native with npm, and React + Jest with yarn. Let's be safe and not mix yarn and npm in a single project.
**Test plan**
Publish the code in this PR to Sinopia, use that when creating a new project.
Using old CLI:
npm install -g react-native-cli@1.0.0
react-native init AwesomeApp
The generated project doesn't contain `yarn.lock` (everything was installed with the npm client).
---
Using new CLI:
npm install -g react-native-cli@1.2.0
react-native init AwesomeApp
The generated project contains `yarn.lock`, output shows that yarn is used to install React Native, React, Jest.
---
In both cases the project runs and Reload JS works:
![screenshot 2016-11-04 17 20 50](https://cloud.githubusercontent.com/assets/346214/20015719/719effb0-a2b4-11e6-84a0-43474314009b.png)
Closes https://github.com/facebook/react-native/pull/10752
Differential Revision: D4131812
Pulled By: bestander
fbshipit-source-id: efaaf97a27005e2c2d10cae5d07afe108d5c0dee
Summary:
Ignore all keystore files as we do not want users to accidentally check in their keystore file.
Closes https://github.com/facebook/react-native/pull/10214
Differential Revision: D4118169
Pulled By: bestander
fbshipit-source-id: a81fc99afd1715d52dfdce8c47dfc10808470008
Summary:
Some recent change to Chrome causes the remote debugger to be throttled unexpectedly if it is in a background tab. Although this does not fix the problem, it raises the issue and suggests a workaround.
I also cleaned up some littering of the global namespace in the debugger web worker.
Reviewed By: jingc
Differential Revision: D4104515
fbshipit-source-id: 56e46c0e759bec4c42d3baedd4d2d46cdea2e4a0
Summary:
> Explain the **motivation** for making this change. What existing problem does the pull request solve?
There's no longer a seaprate page for Android setup instructions, it just redirects to the getting started page, where you have to navigate futher.
**Test plan (required)**
None.
Closes https://github.com/facebook/react-native/pull/10524
Differential Revision: D4069696
Pulled By: lacker
fbshipit-source-id: 67f6450f550cbbf446476ea824a6915125e823ba
Summary:
Adds a ```sort``` to ```findProject(folder)``` to boost ones in IOS_BASE to the top. Otherwise, if for example there is a git submodule project in the root app folder, the method will pick that one instead and linking will fail.
Fixes issue #10494
Closes https://github.com/facebook/react-native/pull/10495
Differential Revision: D4069439
Pulled By: lacker
fbshipit-source-id: 4328ac55389ed51cb42759fcf8360e56d5058136
Summary: In order to make `Config` and defaults available to our new code, I’ve added flow types and put default values into one shared modile
Reviewed By: cpojer
Differential Revision: D4044600
fbshipit-source-id: 875ed3ade69c5b22bb3c1b177e7bad732834d476
Summary: I originally added fastpath to node-haste to speed up `path` operations by an order of magnitude. Now we are exclusively using Node 6 at FB so we don't need to ship this thing any more.
Reviewed By: bestander
Differential Revision: D4029092
fbshipit-source-id: 064cf67f4f79ce4f2774fb4e430d22eef4a95434
Summary:
In most .gradle files, lines are indented with 4 spaces, but in some places they are indented with 2 spaces. This PR fixes them and enforce it by adding .editorconfig settings.
Closes https://github.com/facebook/react-native/pull/10267
Differential Revision: D4048335
Pulled By: lacker
fbshipit-source-id: df2f2556380f56672cf85690eb1c80e640a6aedf
Summary:
In xcode, you can modify the Product Name per build configuration. During the build, the app file name is made using that value. For example, I name my app "MyApp Dev", it will build into "MyApp Dev.app".
react-native run-ios doesn't extract the proper app name. Instead it uses the scheme name + ".app". So if in the example above I use the default Scheme "MyApp", which references the build configuration whose name is "MyApp Dev". The build will succeed, but when runIOS.js goes to run the app, it fails because the file name doesn't exist.
My fix parses the build output and extracts the app name from the line "export FULL_PRODUCT_NAME=$(appfilename)" and uses that instead of the scheme. If there is any issue parsing, the scheme name is used like it currently is.
**Test plan (required)**
1) Change the Product Name in xcode project manager to be something different than the scheme name.
2) Run react-native run-ios and ensure it works.
Closes https://github.com/facebook/react-native/pull/10178
Differential Revision: D4022116
Pulled By: javache
fbshipit-source-id: c1bd8e7a1f6364d681c505557a96955a293bc05c
Summary:
If you don't have a `package.json` in your project you can't do anything with the cli as it errors. This fixes that by wrapping the reading of the `package.json` file and returns `my-react-native-app` if an error is caught.
Closes https://github.com/facebook/react-native/pull/10207
Differential Revision: D4022113
Pulled By: javache
fbshipit-source-id: ffe940160f9d0b58e630adfab5e0dc9d34b859e5
Summary:
On iOS project, ATS is disabled for 'localhost'. But the key for this setting is old and just for early iOS9 beta. iOS9 release and later uses new one, so I updated it.
Closes https://github.com/facebook/react-native/pull/10314
Differential Revision: D3993780
fbshipit-source-id: b749edd571c34f07989dde6af0e4ff95f5355c29
Summary:
I frequently spend multiple seconds scanning my open Chrome tabs for the React Native debugger tab. It would be a lot quicker to find the correct tab if the debugger UI tab had a favicon.
This commit adds favicon (blue react logo in a white circle). It's a super minor change, but would help a lot with day-to-day DX.
I chose this icon to differentiate sufficiently from other tabs developer might have open: React docs (blue logo in black square) and React Native docs (white logo in black square). If the idea of having a favicon is agreeable but you want a different asset, I'm more than happy to change it to something else.
Original asset before base-64 encoding:
![favicon-32x32](https://cloud.githubusercontent.com/assets/1203949/19117546/44b36fd2-8b11-11e6-8a94-c8956fe7533c.png)
In the wild:
<img width="335" alt="screen shot 2016-10-05 at 15 40 58" src="https://cloud.githubusercontent.com/assets/1203949/19117811/43cad316-8b12-11e6-8406-4c9b74efdaf2.png">
Closes https://github.com/facebook/react-native/pull/10252
Differential Revision: D3974983
Pulled By: hramos
fbshipit-source-id: 6b07d446dd972c4c171062134b45bc3850886349
Summary: File platform identifiers (`fileName.<platform>.js`) are no longer part of the blacklist regular expression. This allows the upcoming `jest-haste-map` to include all files for all platforms, therefore enabling Packager to build bundles for different platforms using the same `HasteMap`(jest-haste-map) instance.
Reviewed By: davidaurelio
Differential Revision: D3907508
fbshipit-source-id: d7d7f3bd93287a634a1ef0590a736d021be2aaa5
Summary:
Adds the possibility to specify an array of files (group roots) that are used to bundle modules outside of the “startup section” into bigger groups by colocating their code.
A require call for any grouped module will load all modules in that group.
Files contained by multiple groups are deoptimized (i.e. bundled as individual script)
Reviewed By: martinbigio
Differential Revision: D3841780
fbshipit-source-id: 8d37782792efd66b5f557c7567489f68c9b229d8
Summary:
Very simple PR to add the shorcuts for windows/linux to the web debuger interface so it's less mac-centric.
**Test plan**: Open the debugger and see the shorcuts for windows/linux/mac
Closes https://github.com/facebook/react-native/pull/9812
Differential Revision: D3862570
fbshipit-source-id: 54605af66b674d176b3cbbb9efcfa93f84fcd552
Summary:
If the packager is already watching `/path/to/MyProject`, and it finds symlinks inside `/path/to/MyProject/node_modules` that point to `/path/to/MyProject/path/to/somewhere/else`, there's no need to add the latter to the project roots.
**Test Plan:** replicate an aforementioned project set-up, and verify that only `/path/to/MyProject` is a project root for the packager, while files in `/path/to/MyProject/path/to/somewhere/else` can still be imported so long as they're part of an npm-style package (e.g. `/path/to/MyProject/path/to/somewhere/else/package.json` exists).
Closes https://github.com/facebook/react-native/pull/9819
Differential Revision: D3852591
Pulled By: mkonicek
fbshipit-source-id: 558ab3f835ee3d2bf6174c31595e242992f75601
Summary:
Adding jest and its presets to the react-native init command
**Test plan (required)**
run react-native init foo (using `npm link` to use the local `react-native` version)
inside foo there are now a .babelrc file and the package.json is set up as described by
https://facebook.github.io/jest/docs/tutorial-react-native.html#setup
Closes https://github.com/facebook/react-native/pull/9719
Differential Revision: D3843037
Pulled By: bestander
fbshipit-source-id: 004e27ebd3f257a202ed43f378d6fe6cc23ced52
Summary:
Current Xcode project does not include settings to enable auto-incrementing build numbers using ```agvtool``` as described [here](https://developer.apple.com/library/ios/qa/qa1827/_index.html). Tools like Fastlane, for example, rely on this for commands like ```increment_build_number```. Having these settings enabled by default ensures that people will have one less thing to worry about setting up CI for RN based projects.
Closes https://github.com/facebook/react-native/pull/9511
Differential Revision: D3841281
Pulled By: javache
fbshipit-source-id: 9b9640edf608efd0835371dbe90a2f51786748af
Summary:
I removed `$` and `_` (only from the starting substring) as they
cannot be used in creating Android package name according to official
android documentation. Also removed a duplicate function (there is the
same one in `react-native-cli/index.js`). This fixes#7115.
Closes https://github.com/facebook/react-native/pull/7127
Differential Revision: D3841253
Pulled By: mkonicek
fbshipit-source-id: 677c7e4277c783180b04dee57d3ccd509e2b99d3
Summary:
At the moment the run-ios command from the react-native cli does only work for simulators.
The pull request adds a new option to the existing command: **"--device 'device-name'" which installs and launches an iOS application on a connected device.**
This makes it easier to build a test environment using react-native for connected devices.
I've tested my code with the following commands:
react-native run-ios --device "Not existing device"
react-native run-ios --device
react-native run-ios --device "name-of-a-simulator"
react-native run-ios --device "name-of-connected-device"
Output of the first three commands:
![example_error_output](https://cloud.githubusercontent.com/assets/9102810/17669443/f53d5948-630d-11e6-9a80-7df2f352c6a3.png)
Additional to the manual command tests i've added a test file 'parseIOSDevicesList-test.js'.
I used **ios-deploy** In order to launch and install the .app-bundle on a connected device.
ios-deploy on github:
Closes https://github.com/facebook/react-native/pull/9414
Differential Revision: D3821638
Pulled By: javache
fbshipit-source-id: c07b7bf25283a966e45613a22ed3184bb1aac714
Summary:
An attempt to address https://github.com/facebook/react-native/issues/9156.
cc grabbou Kureev
**Test plan (required)**
1. Added the following to the `package.json` of a `react-native-plugin`
```
"rnpm": {
"commands": {
"preunlink": "node node_modules/react-native-plugin/scripts/preunlink"
"postunlink": "node node_modules/react-native-plugin/scripts/postunlink"
}
}
```
2. Added files, `scripts/preunlink.js` and `scripts/postunlink.js` to the plugin. Each of them simply logs a string to the console.
3. Ran `react-native unlink react-native-plugin` to verify that those logs get printed.
Closes https://github.com/facebook/react-native/pull/9157
Differential Revision: D3749434
fbshipit-source-id: 40b94c9026db4f11e8f5be4a417a0670e8069be6
Summary:
Fixes#9312
(Sorry for inconvenience, could've been removed by mistake!)
Bonus: projectName can be configured rather than always defaulting to package.json name, not sure if helpful, but just added it since we have a `default` function that makes sense in this case.
Closes https://github.com/facebook/react-native/pull/9525
Differential Revision: D3753610
Pulled By: bestander
fbshipit-source-id: 641872855b9865502f4055910262686edc4b504e
Summary:
This commit removes `rnpm` folder that we left during initial merge to keep the diff cleaner. The `core`, `link` and `install` have now the same directory structure as any other command to make development more natural for all of us.
From most notable differences:
1) the `src` folder is now gone. The new structure should make it easier for people to work with the stuff and also move us closer to 100% rnpm integration,
2) There's also no `package.json` present in any of the `rnpm` packages, since they are no longer standalone modules,
3) There's no `bugs.url` in link.js since main package.json of React doesn't specify it. Decided to hardcode it to facebook/react-native since it's really unlikely to change. If one would prefer to use pkg.bugs.url as before, a separate PR modifying package.json should be sent.
Closes https://github.com/facebook/react-native/pull/9509
Differential Revision: D3751115
fbshipit-source-id: 74ae8330f7634df0887ad676808f47eee4b8de85
Summary:
`this` is a `ReactNativeHost` post RN 0.29, so the current patch doesn't compile. Simply `getResources()` will work for all versions - Post RN 0.29, it will be the method in the outer `MainApplication`, Pre RN 0.29, it will be the method on the `MainActivity`.
grabbou Kureev
Closes https://github.com/facebook/react-native/pull/9381
Differential Revision: D3744162
fbshipit-source-id: 1fa270bb3268b7b40c6160da948d99ff993c83b1
Summary:
Currently we just try to resolve a rn-cli.config.js file by walking up the tree from node_modules/react-native. In non-standard uses of RN, when your copy of RN may not live within node_modules, it's impossible to use rn-cli.config.js. This PR adds a "config" flag to the cli that let's you pass in a path to rn-cli.config.js.
cc ide
Closes https://github.com/facebook/react-native/pull/7883
Differential Revision: D3382823
Pulled By: bestander
fbshipit-source-id: b946f3bb355050fc2fe99273d0e99e441dbed111
Summary: This shortens the source map URL to its basename for bundles built via the command line API. This makes builds reproducible across different file system locations.
Reviewed By: michalgr
Differential Revision: D3684263
fbshipit-source-id: 2d5fdb5c5d0aa229f5a85465b2d1919f54e33d55
Summary:
The issue here is that sometimes `this.options()` is not `[options]` but contains different stuff, esp. if your command accepts arguments.
This commit reverts its original behaviour and passes custom `examples` property that we use instead.
Tested, can be shipped right away.
Differential Revision: D3662179
fbshipit-source-id: 4b2af3487464d46e2007388230e675ce3575f797
Summary:
Prior to the RNPM integration, command names would match the second argument passed to the react-native-cli. Now the command names contain some usage information (such as non-flag CLI arguments). This commit splits the name of the commands and checks that against the second command line argument.
Closes https://github.com/facebook/react-native/pull/9171
Differential Revision: D3661799
fbshipit-source-id: dc2aa9cd9e69dde3c5b877aeb77a17c4f6427075
Summary:
cc Kureev
Disabling symlink resolver temporarily because it breaks launchPackager.command.
Waiting for a PR with a fix to enable both
Closes https://github.com/facebook/react-native/pull/9166
Differential Revision: D3655846
Pulled By: matryoshcow
fbshipit-source-id: da0bfc64f5fd9d747db2b97d669fcb98250faf39
Summary:
This is an initial step of rewriting the CLI interface to use `rnpm` one (commander, plugins etc.).
It's scope is to move all existing commands to use rnpm CLI interface, so that we get plugins, flags and our existing ecosystem working out of the box.
<s>This is still WIP and some of the commands are left commented out.</s>
For the `config` of `rnpm` (functions get info about project and dependency), <s>I am thinking we can merge them with</s> we decided to merge it with [`default.config.js`](e57683e420/local-cli/default.config.js (L33)), so they are available on the `new Config()` [instance](e57683e420/local-cli/cliEntry.js (L59)) (which means we don't have to change anything and current plugins, like runIOS and runAndroid can just start using it [w/o depending on any extra argument](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e
Closes https://github.com/facebook/react-native/pull/7899
Differential Revision: D3613193
Pulled By: bestander
fbshipit-source-id: 09a072f3b21e5239dfcd8da88a205bd28dc5d037
Summary:
Since jest stopped using node-haste a while ago, we are the only client left.
This brings back node-haste back to fbsource to allow us to iterate faster.
Reviewed By: bestander
Differential Revision: D3641341
fbshipit-source-id: a859f8834765723a3515e2cf265581b9dd83997c
Summary:
A tiny PR to add support for launching IDEA editors with the cursor at the correct line. The argument syntax is the same as sublime.
The base names `wstorm`, `idea` and `appcode` are the default names when CLI launchers are created through 'Tools'->'Create Command-Line launcher' in the respective editor's gui.
Tested through a fork of RN on Webstorm, IntelliJ and AppCode for OSX and by manual invocation from CLI on IntelliJ for windows.
Closes https://github.com/facebook/react-native/pull/9042
Differential Revision: D3627680
fbshipit-source-id: dfb0db92f9ca8b464471c3dc9e92196d87d2e244
Summary:
Updated the keyboard input element on the browser debugger page that contains "⌘⌥J" from a `span` to the more semantic `kbd`.
Closes https://github.com/facebook/react-native/pull/8998
Differential Revision: D3620668
fbshipit-source-id: ab3081688202c85978f6f400a42eb1aa1abb77c6
Summary:
Attempt to fix https://github.com/facebook/react-native/pull/8612
We re-named `mainActivityPath` by `mainFilePath` in the `link` code, but we forgot to rename config parameters. Currently, link is broken.
- [x] `react-native link` should work for react-native 0.29+
Closes https://github.com/facebook/react-native/pull/8807
Differential Revision: D3576176
fbshipit-source-id: 60ecbd660563923696bbef1ed3b0900a7d58469f
Summary:
rnpm aka `react-native link` is broken with Android 0.29 - #8603
This gets it back to working again by checking for new MyApplication.java file, and curtailing the path when needed.
Closes https://github.com/facebook/react-native/pull/8612
Differential Revision: D3533960
fbshipit-source-id: 95d799eaebb26ba1d876c88107ccd2af72427f55
Summary:
When multiple simulator runtimes are available, this change will make it possible to specify which one to run. So assuming you have e.g. iOS 9.0 and 9.3 runtimes, all following calls will now work:
```
react-native run-ios --simulator "iPhone 6s (9.0)"
react-native run-ios --simulator "iPhone 6s (9.3)"
react-native run-ios --simulator "iPhone 6s"
```
Closes https://github.com/facebook/react-native/pull/8559
Differential Revision: D3516811
Pulled By: frantic
fbshipit-source-id: c81658f77e482e712293367b13d27e783e538aad
Summary:
Add "Copy" and "Dismiss" button when the RN Android redbox is shown, consistent with that in RN iOS.
- "Copy" button copies all the messages shown in the redbox to the host system clipboard, the solution is posting redbox messages to packager and the the packager copies the messages onto the host clipboard.
- "Dismiss" button always exits the redbox dialog.
- Add shortcut as "Dismiss (ESC)" and "Reload (R, R).
Notice: Copy button is only supported on Mac OS by now (warning in packager on other platforms), because it's not easy for us to test on Windows or Linux. Will put the codes for other platforms on Github issues, hoping anyone could help test and add this feature, then send us a pull request.
Redbox Dialog in RN Android before:
{F61310489}
Redbox Dialog in RN Android now:
{F61659189}
Follow-up:
- We can adjust the button styles in redboxes.
- We can consider to add shortcut for "Copy" button.
Reviewed By: foghina
Differential Revision: D3392155
fbshipit-source-id: fc5dc2186718cac8706fb3c17d336160e61e3f4e
Summary:
in `runAndroid.js` I renamed the `buildAndRun()` into `run()` and added a call to `runAdbReverse`
Closes https://github.com/facebook/react-native/pull/8345
Differential Revision: D3475782
Pulled By: mkonicek
fbshipit-source-id: 6f2c5a3e6d61cbeec914175686d2a7909d22a957
Summary:
This will allow consumers to supply their own transformer to all `react-native` cli commands by simply implementing `rn-cli.config.js` and overriding `getTransformModulePath()`. That way they don't have to fork various parts of the iOS and Android build system that React Native already provides just to add a `--transformer` command line argument.
**Test plan:** Applied this patch to the React Native version in my app, implemented `getTransformModulePath()` in my `rn-cli.config.js`, and verified that my custom transformer is invoked.
Closes https://github.com/facebook/react-native/pull/7961
Differential Revision: D3404201
Pulled By: foghina
fbshipit-source-id: c7eaa85de84d485d06d23a2ffea899821b2cf71c
Summary:
The file is used to notify users when they are using a node version < 4. Therefore we should not allow arrow functions. This was pointed out at the time when the arrow function was introduced but merged anyways: db3a00d58c (commitcomment-16590379)
Trying to run the code with Node version 0.10.32
Before:
```
…/node_modules/react-native/local-cli/server/formatBanner.js:48
chalkFunction: (fn) => fn,
^
SyntaxError: Unexpected token >
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (…/node_modules/react-native/local-cli/server/checkNodeVersion.js:12:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
Closes https://github.com/facebook/react-native/pull/8310
Differential Revision: D3469092
Pulled By: javache
fbshipit-source-id: 757e8b121f6cd6971dd7d73cda92fcb6fcbe5066
Summary:
The runIOS command currently assumes the path to the `xcodebuild` product - it's hardcoded
```
const appPath = `build/Build/Products/Debug-iphonesimulator/${inferredSchemeName}.app`;
```
https://github.com/facebook/react-native/blob/master/local-cli/runIOS/runIOS.js#L87
This can be a problem, when you e.g. install a release version of the app to the simulator using the cli. We use a separate schema for that, which can be selected with `--scheme`.
This fix reads the output of the `xcodebuild` call and searches for the path and the name of the *.app file. If it's found, then it will be used to spawn in the simulator. If not, the default (as before) is used.
Closes https://github.com/facebook/react-native/pull/8250
Differential Revision: D3469074
Pulled By: javache
fbshipit-source-id: b10c7e6f48268b0c71dfcbfa661f8e5960c3aaa6
Summary:
When opening a text editor from react native there are a list of editors being supported. This PR adds `VSCode` to that.
As a difference with the current supported editors, `VSCode` has a notion of `workspace` (a directory that contains all of the project's files). The `workspace` can be passed to `VSCode` as a parameter so that if the workspace is already open we don't get new instances of `VSCode` every time a new file is open. The `workspace` is gotten by comparing the file location with the different `project roots`.
This code relies on `VSCode`'s `code` command, which it's documentation can be found at: https://code.visualstudio.com/Docs/editor/codebasics#_launching-from-the-command-line
Closes https://github.com/facebook/react-native/pull/7757
Differential Revision: D3463761
fbshipit-source-id: ee9ec999747ad6d16d95ec8317f551f3535286c9
Summary:
This makes sure that `getModuleId` is called on modules in the order returned by `node-haste`, rather than waiting for a couple of promises to resolve before calling the function.
Related: #7758
Reviewed By: frantic
Differential Revision: D3450853
fbshipit-source-id: 7f26590b39b94ade32c73a8db9fd31d283d57549
Summary:
This is particularly important when using generated xcode project together with cocoapods (or anything that leverages a custom xcconfig)
If we do not set `$(inherited)`, then user will get cryptic "Symbol(s) not found for architecture ..." errors that will be really difficult to track down, especially for beginners. This happens because without setting `$(inherited)` we are essentially overriding settings provided on project level (rather than target level) as well as `.xcconfig` level.
**Test plan (required)**
```bash
react-native init MyProject
cd ios
pod init
```
Now go and add a pod to the `Podfile`, say
```ruby
pod 'HockeySDK'
```
And try to use it in `AppDelegate.m`
```objc
...
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"APP_IDENTIFIER"];
[[BITHockeyManager sharedHockeyManager] startManager];
```
Before this change, you'll get errors like this
![image](https://cloud.githubusercontent.com/assets/696842/15801450/feb3c036-2a4
Closes https://github.com/facebook/react-native/pull/7927
Differential Revision: D3430228
Pulled By: javache
fbshipit-source-id: ef453ad2e822726db0159d24ec93e301192e21de
Summary:
Implemented automatic IP detection for iOS, based on #6345 and #6362.
As the previous pull requests did, this works by writing the IP address of the host to a file.
Closes https://github.com/facebook/react-native/pull/8091
Differential Revision: D3427657
Pulled By: javache
fbshipit-source-id: 3f534c9b32c4d6fb9615fc2e2c3c3aef421454c5
Summary:
Re: javache 's suggestions from https://github.com/facebook/react-native/pull/7878. Didn't want to deal with the merge conflict so I'm opening a separate PR. Here's the original justification:
If I want to set NODE_ENV to "baconator", I should be allowed to. Mutating global state that most devs assume to be immutable is just abysmal dev practice, especially since this mutation only happens when you're building for prod, not running on the simulator.
To test this, run env NODE_ENV=baconator ./gradlew assembleRelease with babel-plugin-transform-inline-environment-variables in your app/.babelrc. You'll see that the final app has NODE_ENV=production.
As a side note, running with babel-plugin-transform-inline-environment-variables in the top-level .babelrc crashes horribly with a compiler error.
For anybody who runs into this bug and doesn't feel like waiting for this to get merged, I wrote a quick babel plugin to remove assignments to process.env, which is sufficient to fix this issue.
Closes https://github.com/facebook/react-native/pull/8057
Differential Revision: D3419950
Pulled By: javache
fbshipit-source-id: dc541cad0a99906433e5c14bbc93ce66b4ed325e
Summary:
Clears the debug console whenever the React Native JS is reloaded.
NOTE: This respects "Preserve log" in Chrome by default.
Reviewed By: jingc
Differential Revision: D3409713
fbshipit-source-id: ce215e3125cf43ab3ea5811c707fab9dfa4bcbb3
Summary:
`react-native start` already ensures that the `--transformer` path is understood to be relative to CWD, not to the module that ends up importing that file. `react-native bundle` and `react-native dependencies` didn't up until this point.
**Test plan:** Ensured that `react-native bundle ... --transformer ./relative/path` works with this patch applied.
Closes https://github.com/facebook/react-native/pull/7857
Differential Revision: D3393777
fbshipit-source-id: 303a226fae9c8087c3dd3b2e8d004462ca66665e
Summary:
**Test plan:** With the given patch applied to `react.gradle`, I specified the following in my `android/app/build.gradle`:
```
project.ext.react = [
nodeExecutableAndArgs: ["node", "--max_old_space_size=4096"]
]
```
and ensured in a `./gradlew installDebug --debug` run that the packager gets indeed invoked with these parameters.
Closes https://github.com/facebook/react-native/pull/7903
Differential Revision: D3390543
fbshipit-source-id: cf440b36633420b8f67070f47dfabf4c84cb28a7
Summary:
React@15.1.0 is incompatible with React-Native@0.26.
This PR was cherry-picked to 0.26-stable branch now.
What this change does:
- react-native-cli (major release bump) saves exact versions of react-native and react (only in npm2) dependencies into package.json
- local-cli saves exact version of react (only npm3) dependency into package.json
Closes https://github.com/facebook/react-native/pull/7879
Differential Revision: D3384705
Pulled By: davidaurelio
fbshipit-source-id: d4dff418f9659bd083ae8826433a4e7c0355d03b
Summary:
If for instance you're using a custom transformer, having this hook will let you specify it without forking all of react.gradle
**Test plan:** Specified some additional packager args in my app's `android/app/build.gradle`:
```groovy
project.ext.react = [
bundleInDebug: true,
extraPackagerArgs: ["--transformer", "path/to/my/transformer.js"]
]
```
and ensured they show up when gradle invokes the bundler.
Closes https://github.com/facebook/react-native/pull/7858
Differential Revision: D3382996
Pulled By: mkonicek
fbshipit-source-id: 437b2e6c902931d45b9d2f7ec97c833ba0cd3217