Commit Graph

18 Commits

Author SHA1 Message Date
Guilherme Bruzzi da81a824a3 FIX #9617 - Correct find local IP address when running on iOS device
Summary:
React native's reload javascript option doesn't always work on iOS devices since version 0.29, as described in https://github.com/facebook/react-native/issues/9617

It only doesn't work when you have a mac on a wireless connection, because react-native-xcode.sh can't find your IP address correctly in this case and will just fallback to use the pre-bundling option on your app.

This small change in react-native-xcode.sh fixed this issue for our project and should fix this issue for all mac users that use wireless connection and that will run a debug version of the app on a real iOS device.
Closes https://github.com/facebook/react-native/pull/9964

Differential Revision: D3923035

fbshipit-source-id: 436cfa2103e10221270034233552ce34720505d3
2016-09-26 01:28:21 -07:00
Alexander Jarvis 053720b66f Check bundle file exists for release builds
Summary:
Motivation: While testing the RC, the bundle step failed (because the reset-cache true flag was still present) for an Archive build causing an app to be distributed without the JS bundle. This was obviously not great because the app just crashed on startup.

This fix just checks that the bundle file is present and if not fails the build, as you would expect it to.
Closes https://github.com/facebook/react-native/pull/9284

Differential Revision: D3749572

fbshipit-source-id: f1ccb8b6cd0b78f6d8267e7b4b0f10b4a3cec5a1
2016-08-21 11:28:46 -07:00
Tom Hayden 0371d8117d reset-cache flag no longer needs boolean
Summary:
When compiling 0.31-rc1 was having issues with xcode running the package script and failing (ie not running and returning the --help info) Was due to this - simply changing the flag to --reset-cache instead of --reset-cache true worked miracles.

**Test plan (required)**

Ran packager without and runs but doesn't build the package, runs with small change and works now. Can copy paste output if you want but it's pretty super verbose for this small change.
Closes https://github.com/facebook/react-native/pull/9177

Differential Revision: D3661831

fbshipit-source-id: 3cebc543806b8fe3e413f83c59c9fb74e5e078f4
2016-08-03 01:13:37 -07:00
Nathan Azaria 69e0375fb9 Changed JS location of examples to source from RCTBundleURLProvider instead.
Summary:
This changes the JS location of the examples (2048, UIExplorer, Movies, and TicTacToe) to be set from RCTBundleURLProvider instead.
This also makes the example apps run the bundle script, which makes the build time longer.

Reviewed By: javache

Differential Revision: D3516371

fbshipit-source-id: 70e53c62feb81c067df4e2298e7d1f1458777490
2016-07-15 10:13:29 -07:00
Nathan Azaria b02f773e6a Implemented automatic IP detection for iOS
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
2016-06-13 15:58:36 -07:00
Mark Oswald 7ca4e764b6 call bundle with reset-cache true as default from standard project
Summary:
addition to #7297

When called from an upstarting app, the bundling process should always be called with a cleared cache. That avoids possible problems with cached files.
Closes https://github.com/facebook/react-native/pull/7324

Differential Revision: D3247420

fb-gh-sync-id: 503ad39cb36455512ccea1af7618e89a80942f0c
fbshipit-source-id: 503ad39cb36455512ccea1af7618e89a80942f0c
2016-05-02 08:03:19 -07:00
Nick 27e79ff0c3 CHORE - Remove Trailing Spaces
Summary:Remove Trailing Spaces.

Why:
Sometimes there are conflicts with trailing spaces
Saves space
Those whose tools automatically delete them will have their pr watered down with trailing space removal
Closes https://github.com/facebook/react-native/pull/6787

Differential Revision: D3144704

fb-gh-sync-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
fbshipit-source-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
2016-04-06 09:21:53 -07:00
Geoffrey Goh 02feea9a5a Create offline package if not running in "Debug" config
Summary:**Problem**: As seen in https://github.com/facebook/react-native/issues/5820, many devs are confused by the fact that the offline bundle is not generated when running against the simulator, even when running in the "Release" configuration which is supposed to mimic "production" scenarios.

This pull request is a small change that fixes https://github.com/facebook/react-native/issues/5820 by updating the `react-native-xcode.sh` shell script to still generate the ofline bundle during Release configuration. It also updates `AppDelegate.m` to better document this behaviour in the comments so as to avoid any surprises.

**Test plan**: This is a simple change, the two tests done were
1. In a new React Native project, verify that an offline build is not generated when running against the simulator in "Debug" configuration as per normal.
2. Change to a "Release" configuration via Product > Scheme > Edit Scheme in XCode, then verify that the project runs with the offline build generated.

![screen shot 2016-02
Closes https://github.com/facebook/react-native/pull/6119

Differential Revision: D2970755

Pulled By: javache

fb-gh-sync-id: 64f658512869c73aa19286ca1e3dc6e31b5ac617
shipit-source-id: 64f658512869c73aa19286ca1e3dc6e31b5ac617
2016-02-24 03:11:38 -08:00
Shane Rogers 5d21d04e5a Typo
Summary:
Tiny typo :)

🐝 🍻
Closes https://github.com/facebook/react-native/pull/5665

Reviewed By: svcscm

Differential Revision: D2885581

Pulled By: androidtrunkagent

fb-gh-sync-id: 4f442a95ea05e2f58c47c664644210c99e256943
2016-02-01 07:43:33 -08:00
Sam Neubardt 6891e98578 Handle spaces in $REACT_NATIVE_DIR
Summary:
`react-native-xcode.sh` can fail to execute if `$REACT_NATIVE_DIR` contains spaces.

E.g. if `$REACT_NATIVE_DIR` was `/Users/samn/src/Xcode Projects/AwesomeReact` then `react-native-xcode.sh` would fail with the following error:

```
node /Users/samn/src/Xcode Projects/ReactNativeBeaconTest/node_modules/react-native/local-cli/cli.js bundle .... (elided)

module.js:341
    throw err;
    ^

Error: Cannot find module '/Users/samn/src/Xcode'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:139:18)
    at node.js:999:3
Command /bin/sh failed with exit code 1
```

This change properly handles paths with spaces in them by quoting `$REACT_NATIVE_DIR`
Closes https://github.com/facebook/react-native/pull/5651

Reviewed By: svcscm

Differential Revision: D2884600

Pulled By: androidtrunkagent

fb-gh-sync-id: 3784d8f4e16c0c2cadac738c5f085a5023b5ecf7
2016-01-31 15:51:36 -08:00
Alex Kotliarskyi 7f5f8d10b5 Skip bundling for Simulator
Summary:
Following up on the conversation in https://www.prod.facebook.com/groups/reactnativeoss/permalink/1516993445263951/ I currently don't see any good reason to create an offline bundle for simulator builds.
Closes https://github.com/facebook/react-native/pull/5519

Reviewed By: svcscm

Differential Revision: D2859751

Pulled By: mkonicek

fb-gh-sync-id: f70481e447e258f5531de773729fc31d9ebec6f7
2016-01-26 08:21:29 -08:00
Alex Kotliarskyi e6916ec972 Improve react-native-xcode.sh integration
Summary:
Inspired by conversation in https://github.com/facebook/react-native/pull/5374, this PR improves `react-native-xcode.sh`:

* No longer depends on global `react-native` binary
* Gracefully handles missing `node` dependency and adds a new way to configure the path to `node` in non-standard installation environments

This is how the error looks like:
![image](https://cloud.githubusercontent.com/assets/192222/12538882/3f9b5c3e-c29a-11e5-84fc-c7ccedf1c46a.png)
Closes https://github.com/facebook/react-native/pull/5518

Reviewed By: svcscm

Differential Revision: D2861116

Pulled By: frantic

fb-gh-sync-id: 9a80eda6c844d066e34369b1cda503955171485b
2016-01-25 12:36:33 -08:00
Henrik Kok Jørgensen 85c016df31 Dont call npm before node is available
Summary:
This fixes an error introduced in `0.18.0-rc`

`node` and `npm` isn't available if the developer is using `nvm` or `nodeenv`. XCode throws an error because of the call to `npm`. Simple move the line to after `node` and `npm` has been setup.
Closes https://github.com/facebook/react-native/pull/5156

Reviewed By: svcscm

Differential Revision: D2807589

Pulled By: androidtrunkagent

fb-gh-sync-id: 30c33145b2cb6f30ff67f6648153d5aa67fb74ed
2016-01-06 11:03:34 -08:00
Louis Pilfold a065510ec8 Add support for nodenv with xcode
Summary:
Hello!

I'm a fan of the *env family of version managers over the *vm family as I find them simpler and less obtrusive, but it seems that they don't currently work so well with react-native on OSX. See #4645

I've made a small addition to the xcode script that resolves the issue for me. Hopefully others will find this useful too :)

If I've not made the right move here, what is the correct way to get react-native projects building in xcode when the binary is not in the $PATH used by the script?

Cheers,
Louis
Closes https://github.com/facebook/react-native/pull/4801

Reviewed By: svcscm

Differential Revision: D2770726

Pulled By: androidtrunkagent

fb-gh-sync-id: 3b0f9e466549b3012a68c94738d2556173f4c21e
2015-12-17 14:10:36 -08:00
Billy Lamberta ab09248540 Add the npm global prefix to PATH.
Summary:
Related to issue https://github.com/facebook/react-native/issues/4034#issuecomment-164134543.
The npm global install path may be set to a non-standard location. `react-native` is assumed to be in `PATH` but doesn't take into account the user's environment so building in Xcode fails:
~~~
react-native bundle --entry-file index.ios.js --platform ios --dev true --bundle-output [...]

../node_modules/react-native/packager/react-native-xcode.sh: line 48: react-native: command not found
Command /bin/sh failed with exit code 127
~~~
This fix uses `npm prefix -g` to get the bin location and adds it to `PATH`.
Closes https://github.com/facebook/react-native/pull/4749

Reviewed By: svcscm

Differential Revision: D2753215

Pulled By: androidtrunkagent

fb-gh-sync-id: 964d1a71ac1bf204545a594a9fa433a7bc367f35
2015-12-12 13:08:31 -08:00
Brian Leonard da0ad0ce4c Allow other Xcode configurations with DEV=false
Summary:
Updates build script to fix https://github.com/facebook/react-native/issues/4362
Closes https://github.com/facebook/react-native/pull/4520

Reviewed By: svcscm

Differential Revision: D2730607

Pulled By: mkonicek

fb-gh-sync-id: 2fc4a9815f19ab867a6a3dc77cf1b6eac8a25616
2015-12-09 04:41:28 -08:00
James Ide 9d88303586 Source nvm.sh (best effort) when running react-native-xcode.sh
Summary: When Node is installed with nvm, scripts invoked from Xcode need to set up nvm. This can be done either by sourcing .profile/.bash_profile/.bashrc/etc... or by sourcing nvm.sh directly -- this diff does the latter and handles the case where nvm may have been installed the official way (under ~/.nvm/nvm.sh AFAIK) or via homebrew.
Closes https://github.com/facebook/react-native/pull/4015

Reviewed By: svcscm

Differential Revision: D2633301

Pulled By: frantic

fb-gh-sync-id: 3c2b9b0d21887ba21d6f85f5d279314d50c1db28
2015-11-09 16:42:30 -08:00
Alex Kotliarskyi cf61ca9002 Generate bundle and assets when building via Xcode
Summary: This integrates React Native into Xcode's build process, which lets us automatically handle bundling and packaging image assets.

Tested the script via https://github.com/frantic/ReactNativeAssetsExample

Loaded from packager:
<img width="432" alt="screen shot 2015-10-19 at 3 11 12 pm" src="https://cloud.githubusercontent.com/assets/192222/10593447/be5bc7e8-7678-11e5-8c70-ecc2a1ee24fc.png">

Loaded from offline bundle:
<img width="432" alt="screen shot 2015-10-19 at 3 10 58 pm" src="https://cloud.githubusercontent.com/assets/192222/10593448/be5d5194-7678-11e5-8b02-d492a26cfb81.png">

Android:
<img width="639" alt="screen shot 2015-10-19 at 3 11 20 pm" src="https://cloud.githubusercontent.com/assets/192222/10593449/be5de2d0-7678-11e5-8d3c-0378fc447f15.png">
Closes https://github.com/facebook/react-native/pull/3523

Reviewed By: mkonicek

Differential Revision: D2557923

Pulled By: frantic

fb-gh-sync-id: 19957e255993696e793b0162662772efd89f5c1a
2015-10-21 18:44:27 -07:00