Summary:
By default, when a react-native app launches in development mode on a physical iOS device, it attempts to load the JS bundle from a packager at `http://_your-local-ip-address_.xip.io:8081/`.
This change removes the use of `xip.io`, which changes that url to: `http://_your-local-ip-address_:8081/`
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.
You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html
Happy contributing!
-->
Background:
The automatic IP detection feature (introduced [here](https://github.com/facebook/react-native/pull/8091)) is super handy. However, it’s use of `xip.io` has caused myself and others much grief. Some routers do not allow or have intermittent errors when trying to resolve DNS names to local IP addresses. This prompted the introduction of a [DISABLE_XIP feature](https://github.com/facebook/react-native/pull/13326), which helps.
However, I don’t believe the use of `xip.io` is needed at all.
Based on [this comment](8c29a52c54 (commitcomment-18224788)), it appears the original reason for using `xip.io` was to “circumvent the numeric IP address limitation in ATS”.
But, the reason you can’t create ATS exceptions for raw IP addresses is that ATS is not enforced for raw IP addresses _at all_. You can read the Apple documentation [here](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html), the relevant portion is:
> App Transport Security (ATS) applies only to connections made to public host names. The system does not provide ATS protection to connections made to:
> * Internet protocol (IP) addresses
> * Unqualified host names
> * Local hosts employing the .local top-level domain (TLD)
For example, in iOS, if you attempt to make an http request (note: _not_ https) to `http://www.google.com` you will get an error due to ATS.
However, you can make the same request to `http://172.217.6.14/` (which for me is the same server) and the request will succeed.
And in fact, if an ATS exception _was_ needed, the DISABLE_XIP feature shouldn’t work at all, but it does.
In short, using `xip.io` with ATS exceptions is unnecessary, causes some very annoying problems for some people, and I think it should just be removed.
Run the app on a physical iOS device and verify that it can load the JS bundle from the host computer's IP.
[Implemented automatic IP detection for iOS #8091](https://github.com/facebook/react-native/pull/8091)
[Added option to disable xip #13326](https://github.com/facebook/react-native/pull/13326)
<!--
Help reviewers and the release process by writing your own release notes
**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**
CATEGORY
[----------] TYPE
[ CLI ] [-------------] LOCATION
[ DOCS ] [ BREAKING ] [-------------]
[ GENERAL ] [ BUGFIX ] [-{Component}-]
[ INTERNAL ] [ ENHANCEMENT ] [ {File} ]
[ IOS ] [ FEATURE ] [ {Directory} ] |-----------|
[ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} |
[----------] [-------------] [-------------] |-----------|
[CATEGORY] [TYPE] [LOCATION] - MESSAGE
EXAMPLES:
[IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
[ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
[CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
[DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
[GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
[INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
[INTERNAL] [BUGFIX] [./scripts] - Removed use of xip.io
Closes https://github.com/facebook/react-native/pull/17642
Differential Revision: D6814609
Pulled By: hramos
fbshipit-source-id: f2faebd6a29b0b211d78cdfe8e195906307ab552
Summary:
I noticed in v0.50.0 all mentions of 'packager' were updated to 'Metro Bundler':
12eb04b236
It seems like command which launches the bundler still sets the terminal title to 'React Packager'. This PR simply updates the title from 'React Packager' to 'Metro Bundler'.
Run `scripts/launchPackager.command`/`scripts/launchPackager.bat` and check title:
<img width="907" alt="screen shot 2018-01-05 at 14 02 53" src="https://user-images.githubusercontent.com/754498/34612337-3e93e8ca-f221-11e7-98f9-c5190674868e.png">
[GENERAL] [ENHANCEMENT] [./scripts]
Closes https://github.com/facebook/react-native/pull/17457
Differential Revision: D6673843
Pulled By: shergin
fbshipit-source-id: 65a072c3b79593391f257191b1372e7e9c8799f1
Summary:
The pull request adds the `--port` option to `run-ios` allowing a developer to build and launch a react-native app using a single command line like this:
```
react-native run-ios --port 8088
```
It defaults to the current port 8081.
This pull request fixes issue #9145 and issue #14113.
This patch also extends `run-android` to properly test and launch the packager with the specified port, extending the work done in PR: ##15316
1. Create a new react-native app, or simply clone this branch and then update your version of react-native using `yarn add file:./path/to/this/fork/of/react-native`
2. run `react-native run-ios --port 8088`
3. watch the packager start on the desired port (8088 in this case) and watch your app in your simulator connect to the packager and launch the app.
Closes https://github.com/facebook/react-native/pull/16172
Differential Revision: D6612534
Pulled By: shergin
fbshipit-source-id: 50af449f5e4c32fb76ba95f4cb7bf179e35526d5
Summary:
👋 Hello! Thanks for react-native, it’s a great project.
I was digging into the Android implementation in _ReactAndroid_ and noticed a couple typos in the documentation. I went through and tried to fix all the typos I could find using [aspell](http://aspell.net).
Not applicable: these changes are only to comments, and CI should be skipped.
[ANDROID][ENHANCEMENT][*] - Correct comment and docblock typos
Closes https://github.com/facebook/react-native/pull/17049
Differential Revision: D6472182
Pulled By: shergin
fbshipit-source-id: 7e62cab118609596b483d1cf16c3abf651d6753b
Summary:
- The version check that ensures the JS and native versions match is now in its own module for two reasons: it is easier to test and it allows react-native-windows to override just this module to implement its own version check (ex: more advanced checks for RNW-specific code).
- Added unit tests for the version checking to specify its behavior more clearly, including parity between dev and prod to avoid prod-only behavior and mitigate SEVs.
- Prefixed the Obj-C `#define` with `RCT_` to conform with other RN globals.
Closes https://github.com/facebook/react-native/pull/16403
Differential Revision: D6068491
Pulled By: hramos
fbshipit-source-id: 2b255b93982fb9d1b655fc62cb17b126bd5a939a
Summary:
unbundle is a useful feature, and it should be exposed. In order to get the most use out of
we expose it as an option at build time in the Build Phase on XCode and the project.ext.react
config in the build.gradle.
Because it is best used with inline requires we add a section under performance that describes
how inline requires can be implemented and how to use with the unbundling feature.
Testing:
- Added a section of the doc which explains how the feature can be enabled
- Use the instructions, build a build on iOS + android (using release so that the bundle is created) and confirm that the bundle has the binary header information.
Closes https://github.com/facebook/react-native/pull/15317
Differential Revision: D6054642
Pulled By: hramos
fbshipit-source-id: 067f4d2f78d91215709bd3e3636f460bc2b17e99
Summary:
This pull request migrates Travis to Circle and pre-starts iOS simulators / tvOS ones as advised in documentation to speed up builds. It also uses Xcode 9.0 to build and test apps.
Note that podspec test is failing and it's been failing for a while on Travis as well (since podspec has been changed to use Cxx bridge by default). I've notified few folks here of that and we are looking to fix this test, but it's not related to the scope of this PR.
Also, previously, podspec tests were only runninng on master (disabled for PR builds) where I think it makes more sense to run them on PR builds as well (all in all, we want to prevent breakage before merging). That said, I've removed `if` check to make it run on all builds.
Other small changes:
- cache `node_modules` properly (previously defined as restore_cache and save_cache but not referenced in following jobs)
Closes https://github.com/facebook/react-native/pull/16354
Differential Revision: D6054858
Pulled By: hramos
fbshipit-source-id: 5165bef0985f4257febced14873be5bcb80b9f51
Summary:
Hi there!
I set up the repo because I want to do a little contribution to the Android side but ran into trouble [running tests](https://facebook.github.io/react-native/docs/contributing.html). The Android environment validation kept failing. While the messages were a little helpful, it would have saved me a bit of time and research if I had some helpful examples to copy-and-paste. In my case, I'm using Android SDK Tools on the command line. Hopefully, this will help others when setting up!
Run `./scripts/run-android-local-unit-tests.sh` with each of the following to see the expanded help messages:
* Make sure `$ANDROID_HOME/platforms/android-$MAJOR` is _not_ present.
* Make sure `$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION` is _not_ present.
* Make sure `JAVA_HOME` is _not_ set and/or is _not_ in `PATH`.
Closes https://github.com/facebook/react-native/pull/16222
Differential Revision: D6044875
Pulled By: ericnakagawa
fbshipit-source-id: febacbd08fb632b349c352035f24eed891fbd154
Summary:
Fails on my machine due to fact that `replace` returns an instance of a String, rather than an instance of ShellString (that includes `to` on its prototype).
Solution is to use an explicit `writeFileSync`. You can see that change in the wild on 0.50-stable branch.
CC janicduplessis (edit by hramos)
Closes https://github.com/facebook/react-native/pull/16303
Differential Revision: D6031331
Pulled By: hramos
fbshipit-source-id: 41c583d53df75bea1a55fa19174d912e414209c0
Summary:
CI is currently failing because of a lint issue, this fixes it and a bunch of other warnings that are auto-fixable.
**Test plan**
Quick manual test, cosmetic changes only.
Closes https://github.com/facebook/react-native/pull/16229
Differential Revision: D6009748
Pulled By: TheSavior
fbshipit-source-id: cabd44fed99dd90bd0b35626492719c139c89f34
Summary:
See https://github.com/facebook/react-native/issues/14423
This adds checks after download that each file is present, and has the
correct sha1 hash. If not, it will retry several times, and fail if
it can't successfully download the file. If a file is downloaded, the
unpack and command will run, even if the third-party dir already
exists. The diagnostics printed in the event of failure are improved.
This should be self-healing for anybody who has a bad ~/.rncache
directory. The checksum will fail, and the files will be
redownloaded.
Reviewed By: hramos
Differential Revision: D5930707
fbshipit-source-id: cb15af949294243448ccc3995ec3f0396b1922b6
Summary:
Basic implementation of the proposal in #15271
Note that this should not affect facebook internally since they are not using OSS releases.
Points to consider:
- How strict should the version match be, right now I just match exact versions.
- Wasn't able to use haste for ReactNativeVersion because I was getting duplicate module provider caused by the template file in scripts/versiontemplates. I tried adding the scripts folder to modulePathIgnorePatterns in package.json but that didn't help.
- Redscreen vs. warning, I think warning is useless because if the app crashes you won't have time to see the warning.
- Should the check and native modules be __DEV__ only?
**Test plan**
Tested that it works when version match and that it redscreens when versions don't before getting other errors on Android and iOS.
Closes https://github.com/facebook/react-native/pull/15518
Differential Revision: D5813551
Pulled By: hramos
fbshipit-source-id: 901757e25724b0f22bf39de172b56309d0dd5a95
Summary:
Following the migration guide. Let's see what happens here.
Closes https://github.com/facebook/react-native/pull/14955
Differential Revision: D5877682
Pulled By: hramos
fbshipit-source-id: 2a40560120b5d8d28bc6c52cc5e5916fd1bba336
Summary:
If the project is in a folder with a path containing a space, the project won't build. This fixes this issue.
Closes https://github.com/facebook/react-native/pull/15608
Differential Revision: D5686861
Pulled By: shergin
fbshipit-source-id: 74ce5b4f0261c18070c1a48966aae24f1ca75492
Summary:
Fixes an issue with installing third party on iOS when the project's path contains a space, no matter where the space is in the path.
__Error__
```
/Users/AwesomeUser/Library/Developer/Xcode/DerivedData/AwesomeProject-xxx/Build/Intermediates.noindex/React.build/Debug-iphoneos/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh: line 3: /Users/AwesomeUser/path contain space/scripts/ios-install-third-party.sh: No such file or directory
/Users/AwesomeUser/Library/Developer/Xcode/DerivedData/AwesomeProject-xxx/Build/Intermediates.noindex/React.build/Debug-iphoneos/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh: line 3: exec: /Users/AwesomeUser/path contain space/scripts/ios-install-third-party.sh: cannot execute: No such file or directory
```
Closes https://github.com/facebook/react-native/pull/15377
Differential Revision: D5572671
Pulled By: shergin
fbshipit-source-id: 102727fc1b820e399e170c9c0cb73fd5d1e018d5
Summary:
This change (initially discussed in https://github.com/react-community/create-react-native-app/issues/26) moves the HelloWorld project template from two nearly identical entry points (`index.android.js` and `index.ios.js`) to a single, minimal `index.js` entry point. The root component is created in `App.js`. This unifies the project structure between `react-native init` and Create React Native App and allows CRNA's eject to use the entry point from the HelloWorld template without any hacks to customize it. Also examples in the docs can be just copy-pasted to `App.js` the same way in both HelloWorld and CRNA apps without having to first learn about `AppRegistry.registerComponent`.
* Created a new project from the template using `./scripts/test-manual-e2e.sh` and verified that:
* The app builds, starts and runs both on Android and iOS.
* Editing and reloading changes works.
* The new files (`index.js`, `App.js`, `__tests__/App.js`) get created in the project folder.
<img width="559" alt="screen shot 2017-08-01 at 19 10 51" src="https://user-images.githubusercontent.com/497214/28835171-300a12b6-76ed-11e7-81b2-623639c3b8f6.png">
<img width="467" alt="screen shot 2017-08-01 at 19 09 12" src="https://user-images.githubusercontent.com/497214/28835180-33d285e0-76ed-11e7-8d68-2b3bc44bf585.png">
<!--
Thank you for sending the PR!
If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!
Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.
Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15312
Differential Revision: D5556276
Pulled By: hramos
fbshipit-source-id: 068fdf7e51381c2bc50321522f2be0db47296c5e
Summary:
Running `./scripts/run-android-local-unit-tests.sh` without having
installed Buck displays this link. Make it point to a URL that exists.
Closes https://github.com/facebook/react-native/pull/15292
Differential Revision: D5529392
Pulled By: hramos
fbshipit-source-id: e100823d04fef79a8ecce0e9626fa05864e0aaf8
Summary:
*See discussion below for updated motivation.*
Anything running in Debug should use the packager anyway; no need to bundle. This saves a **huge amount of time** during development when testing things like push notifications that require a real device.
The code being modified was originally moved here in 9ae3714f4b to make sure bundles are always created in `Release`, but the change can be applied to real devices, too. Ideally there should be very little difference in how a simulator is treated compared to a physical device.
Run a Debug build in Xcode targeting a physical device before and after this commit.
You can use the `FORCE_BUNDLING` and `SKIP_BUNDLING` flags to manually change the default behavior. For example, under **Build Phases** > **Bundle React Native code and images**:
```bash
export SKIP_BUNDLING=true
../node_modules/react-native/packager/react-native-xcode.sh
```
Closes https://github.com/facebook/react-native/pull/14731
Differential Revision: D5444352
Pulled By: javache
fbshipit-source-id: 68324fc0be7976e106fe0f9b31d763afd2b460a9
Summary:
Fixed the test script to properly setup our third-party deps and tweaked the third-party specs a bit so they work correctly.
This currently works for projects using static libraries, but fails when using dynamic libraries (`--use-libraries`)
cc mhorowitz alloy
Closes https://github.com/facebook/react-native/pull/14100
Differential Revision: D5380728
Pulled By: javache
fbshipit-source-id: e78b6bd4466ebf2bf30b7e361eff10ec14b36a55
Summary:
After execution of `scripts/ios-install-third-party.sh` a symlink is created :
`<YOUR-APP-PATH>/node_modules/react-native/third-party/glog-0.3.4/test-driver`
that is pointing to `test-driver -> /usr/share/automake-1.14/test-driver`
This can be executed indirectly by `react-native run-ios`.
This breaks the bundle process if the system don't contain a given file under the link and having this strict dependency on the system setup is not a good practice.
Once the `test-driver` symlink is created android app release is failing, for :
`./gradlew assembleRelease`
the `:app:bundleReleaseJsAndAssets` returns :
```
FAILURE: Build failed with an exception.
* What went wrong:
Could not list contents of '<YOUR-APP-PATH>/node_modules/react-native/third-party/glog-0.3.4/test-driver'. Couldn't follow symbolic link.
```
Related issues:
https://github.com/facebook/react-native/issues/14417https://github.com/facebook/react-native/issues/14464https://github.com/facebook/react-native/issues/14548
1. Create new project with `react-native init <YOUR-APP>`
2. cd `<YOUR-APP>/`
3. Run app on iOS `react-native run-ios` so `scripts/ios-install-third-party.sh` is executed.
4. cd `android/`
5. Run android app release `./gradlew assembleRelease` (it will work properly after this fix and fail if the `test-driver` symlink exists)
IMHO we should resolve the issue with this quick fix and apply the proper fix later after the new version of `google/glog` will be released.
The proper cleanup of files generated by autotools was already applied : https://github.com/google/glog/pull/188
Please let me know if I should provide more details : javache, mhorowitz, hramos
Closes https://github.com/facebook/react-native/pull/14638
Differential Revision: D5292362
Pulled By: javache
fbshipit-source-id: 81ff2273420ea078d624a76e781a5b67b96e6a4e
Summary:
I encountered an issue when building with fastlane gym / xcodebuild where glog would not build because of missing config.h header file. I tracked it down to the ios-configure-glog.sh script that ended up error-ing because of missing valid c compiler. I guess it didn't enter the if to set c compiler env in xcodebuild and that env doesn't have proper values set like it does in xcode so just removing this check fixed it. Also tested that it still works properly in xcode.
Closes https://github.com/facebook/react-native/pull/14267
Differential Revision: D5285691
Pulled By: javache
fbshipit-source-id: df5315926c2d2d78806618df3d9c9bbbb974d1ea
Summary: This is to help debug the root cause of https://github.com/facebook/react-native/issues/14423
Reviewed By: javache
Differential Revision: D5254713
fbshipit-source-id: 1ca90205144b3a069d927ba6636f0ef0138b51a0
Summary:
This diff cleans up some cruft and adds some features:
* It removes the usage of an env variable to control workers.
* It removes the lazy and handwavy calculation on how many workers to use for jest-haste-map. Jest itself uses the maximum amount of workers available and it has never been reported as an issue – especially since it is a one-time startup cost of about 3 seconds on a cold cache only.
* It adds a `--max-workers` flag to replace the env variable. This one is able to control both the number of workers for `jest-haste-map` as well as the transformers.
* It makes the transformers run in the parent process if 1 or fewer workers are are specified. This should help with debugging.
Once you approve this diff, I will publish a new version of metro to npm and update the version used in RN and remove the use of the env variable altogether: https://our.intern.facebook.com/intern/biggrep/?corpus=xplat&filename=&case=false&view=default&extre=&s=REACT_NATIVE_MAX_WORKERS&engine=apr_strmatch&context=false&filter[uninteresting]=false&filter[intern]=false&filter[test]=false&grep_regex=
Note: the process of adding a CLI option is really broken. Commander also has a weird API. We should consider building a better public API for Metro and then consider how to build a new CLI on top of it and simplify our internal integration. I really don't like how Metro is integrated across pieces of the RN cli in ways that is hard to manage. But that is a larger task for another time :)
Reviewed By: jeanlauliac
Differential Revision: D5217726
fbshipit-source-id: 74efddbb87755a9e744c816fbc62efa21f6a79bf
Summary:
When attempting to inverse a Bash boolean, the `!` character converts the meaning to become `[[ ! -n false ]]` (checking that the string "false" is empty) which never matches, and therefore this condition can never occur.
See https://stackoverflow.com/a/2953673
Closes https://github.com/facebook/react-native/pull/14190
Differential Revision: D5137013
Pulled By: javache
fbshipit-source-id: 7df52cc90a4ab79c7b5da54dbfb6c99fba3e8b80
Summary: in order to prepare open sourcing React Native Packager, we have to move scripts specific to React Native to a directory that will continue to exist.
Reviewed By: javache
Differential Revision: D5112193
fbshipit-source-id: eac77d0d981aecef7ee52365a6856340420a5638
Summary:
Thanks for submitting a PR! Please read these instructions carefully:
Currently no subspecs are running on CI which causes us to find bugs in the podspec from time to time we upgrade master.
In order to highlight errors for podspecs users when changes happen we should make sure to run all subspecs even though it might take a bit longer when running the CI
Closes https://github.com/facebook/react-native/pull/14019
Differential Revision: D5079230
Pulled By: javache
fbshipit-source-id: 7b3b5dba5ba147b1fc24e79299ed260f9fc6231b
Summary:
It got broken by https://github.com/facebook/react-native/pull/13173.
When the test scripts are run without the "test" argument, we only
want to compile the code, not run the packager and integration tests.
On Travis we pass the "test" argument so we'll still run the packager and integration tests:
https://github.com/facebook/react-native/blob/master/.travis.yml
Reviewed By: gfosco
Differential Revision: D4905912
fbshipit-source-id: e118e6e4f4a818fa06e89d417574e839c4192c1b
Summary:
**Motivation**
Remove duplicated lines in objc-test-ios.sh and objc-test-tvos.sh
**Test plan**
Travis CI should continue to work as before.
Closes https://github.com/facebook/react-native/pull/13173
Differential Revision: D4812177
Pulled By: hramos
fbshipit-source-id: 40afe0beab896d741f607f4841df7e9b42f4c17d
Summary:
Encourage a little more testing coverage and make it a little easier to do.
Closes https://github.com/facebook/react-native/pull/13040
Reviewed By: shergin
Differential Revision: D4742701
Pulled By: sahrens
fbshipit-source-id: 4398c3b737b09c4113e965725585efc038936515
Summary:
Disabled earlier today, a fix for HMR landed so let's test it works.
Closes https://github.com/facebook/react-native/pull/12943
Differential Revision: D4712940
Pulled By: jeanlauliac
fbshipit-source-id: 38cbfb04a0a16a0a59e8eb4c9c26adb60ab5d635
Summary: I accidentally introduced an exit trap, allthough a cleanup handler already existed. This moves killing of background processes into the existing trap.
Reviewed By: bestander
Differential Revision: D4681289
fbshipit-source-id: f8bcdcac7b246854e3ee024c9335b6c4eb3aacbd
Summary:
**Motivation**: Having full tests for both iOS and tvOS is hard on Travis, and it's probably ok to not run full tests on tvOS. However, we should make sure that tvOS at least builds and doesn't have missing files.
Also fixed a warning import.
Closes https://github.com/facebook/react-native/pull/12642
Differential Revision: D4661571
Pulled By: mkonicek
fbshipit-source-id: 45932113951c01e35d6e8ce91af2522cb135efe8