Summary:
[Xcode](https://developer.apple.com/xcode/) is spelled with a lowercase `c`. 😄
**Test plan (required)**
ctrl-f project for `XCode`, case sensitive, find-and-replace with `Xcode`.
Make sure tests pass on both Travis and Circle CI.
Closes https://github.com/facebook/react-native/pull/12572
Differential Revision: D4622075
Pulled By: hramos
fbshipit-source-id: d64f0b10254cd624a71844ebaefa6fc29bc1ea57
Summary:
Similar to https://github.com/facebook/jest/pull/2877, this introduces an optional config `HasteImpl` of type `{getHasteName(filePath: string): (string|void)}` that returns the haste name for a module at filePath if it is a haste module or undefined otherwise.
This allows us to inject a custom implementation of haste's module id resolution rather than only relying on `providesModule` annotations
Reviewed By: davidaurelio
Differential Revision: D4589372
fbshipit-source-id: 4d1983dfbf09c9d67faf725e86ae86ab42433b7d
Summary:
This PR allows anyone to publish templates for React Native.
It's possible for people to publish modules for React Native, we should also support custom templates. A suggestion from a Cordova mantainer where they did the same thing suggests this is useful:
https://github.com/mkonicek/AppTemplateFeedback/issues/1
I published a sample template [react-native-template-demo](https://www.npmjs.com/package/react-native-template-demo).
(GitHub: https://github.com/mkonicek/react-native-template-demo)
With this PR anyone can then use that template:
`react-native init MyApp --template demo`
The convention is: if someone publishes an npm package called `react-native-template-foo`, people can use it by running `react-native init MyApp --template foo`.
Use a template called `react-native-template-demo` from npm:
`react-native init MyApp --template demo`
Use a local template:
`react-native init MyApp --template file:///path_to/react-native-template-dem
Closes https://github.com/facebook/react-native/pull/12548
Differential Revision: D4620567
Pulled By: mkonicek
fbshipit-source-id: bb40d457a7fec28edb577f08137e73241072de3a
Summary:
In the .flowconfig in the starter project, we're missing the correct suppression comments.
This should fix the flow issues in the e2e tests.
Closes https://github.com/facebook/react-native/pull/12533
Differential Revision: D4603657
Pulled By: ericvicenti
fbshipit-source-id: a07ec947d3ba746279c58e2d95c2293f54e06933
Summary:
**Test plan**
1. Add fonts using `react-native link` and a `"rnpm"` config in package.json
2. Manually delete one or more fonts from Xcode's Resources folder using Remove References option
3. Run `react-native link` again
With the patch in this PR, the plist will not accidentally get populated with duplicate entries.
Closes https://github.com/facebook/react-native/pull/12048
Differential Revision: D4560432
fbshipit-source-id: aba3733acfd5373f8d654406b06b8338b137bc07
Summary:
Currently it is not trivial for people to get started with React Native. `react-native init MyApp` just creates a simple app with a single screen. People have to spend time figuring out how to add more screens, or how to accomplish very basic tasks such as rendering a list of data or handling text input.
Let's add an option: `react-native init --template navigation` - this creates a "starter" app which can be easily tweaked into the actual app the person wants to build.
**Test plan (required)**
- Checked that 'react-native init MyApp' still works as before:
<img width="487" alt="screenshot 2017-02-02 16 56 28" src="https://cloud.githubusercontent.com/assets/346214/22559344/b2348ebe-e968-11e6-9032-d1c33216f490.png">
<img width="603" alt="screenshot 2017-02-02 16 58 04" src="https://cloud.githubusercontent.com/assets/346214/22559370/c96a2ca6-e968-11e6-91f7-7afb967920fc.png">
- Ran 'react-native init MyNavApp --template'. This prints the available templates:
```
$ react-native init MyNavApp
Closes https://github.com/facebook/react-native/pull/12170
Differential Revision: D4516241
Pulled By: mkonicek
fbshipit-source-id: 8ac081157919872e92947ed64ea64fb48078614d
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.
Now it will be possible to:
1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated
Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app
For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.
Eject step tested in RN app by deleting native folders.
mkonicek, what is the best way to test `react-native init`?
As follow-up items, we can enable the following:
- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes https://github.com/facebook/react-native/pull/12162
Differential Revision: D4509138
Pulled By: ericvicenti
fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
Summary:
Ignores `bundle.js` that is a webpack bundle and got most likely accidentally released. Already cherry-picked to 0.42
Fixes#12183
Closes https://github.com/facebook/react-native/pull/12185
Differential Revision: D4507535
Pulled By: mkonicek
fbshipit-source-id: 2ab404534b345cf531f408b654c34a30abd01458
Summary:
This moves the `src` directory one level up and removes the `react-packager` folder. Personally, I always disliked this indirection. I'm reorganizing some things in RNP, so this seems to make sense.
Not sure if I forgot to update any paths. Can anyone advice if there are more places that need change?
Reviewed By: jeanlauliac
Differential Revision: D4487867
fbshipit-source-id: d63f9c79d6238300df9632d2e6a4e6a4196d5ccb
Summary:
I prefer a darker environment when coding, and having the Chrome window be dark except the part that I cannot hide, is making my eyes hurt. This is for the people that prefer the darker color scheme when developing.
Closes https://github.com/facebook/react-native/pull/11878
Differential Revision: D4494415
Pulled By: mkonicek
fbshipit-source-id: 423473ec073e6ddd0d14322c22ee37abed1c55bc
Summary:
Hi RN team! Thanks for all that you do. 🎉
**Motivation:**
I noticed in the [Buck docs](https://buckbuild.com/article/exopackage.html) (scroll down to Step 2) that it expects third party JARs to live in version control. Currently, the HelloWorld template ignores these dependencies from version control, which is a bit confusing.
Closes https://github.com/facebook/react-native/pull/11738
Differential Revision: D4494423
Pulled By: mkonicek
fbshipit-source-id: 37b946ad9c30af2b47b409bae6830bba5917491a
Summary:
Basic template using 'react-navigation' to make it easy to get started.
Not duplicating all the files in `android` and `ios` folders. These will be taken from the `HelloWorld` template. Let's not duplicate all of these files (it's a lot and they are large, especially the Xcode projects).
**Test plan (required)**
The app works locally. This PR is just a preparation for a next PR that will add support for 'react-native init --template Navigation'. Will have a proper test plan there.
Closes https://github.com/facebook/react-native/pull/12153
Differential Revision: D4494776
Pulled By: mkonicek
fbshipit-source-id: b43eafd7a1424477f9493a3eb4083ba4dd3d3846
Summary:
Currently React Native's local cli is a bit behind in its android gradle plugin version. This PR is an attempt to update the local cli, to allow for better support moving forward.
* Updates the gradle plugin version to 2.2.3
* Updates the gradle wrapper to 2.14.1
* Uses the `all` for the project wrapper to include sources for API completion
**Test plan (required)**
* Perform all required steps here: https://github.com/facebook/react-native/tree/master/react-native-cli
* Run the local npm tests and e2e tests (no longer available)
* Test the local cli by using Sinopia
Make sure tests pass on both Travis and Circle CI.
TO NOTE: In a previous issue (https://github.com/facebook/react-native/issues/11500) I was able to update to 2.2.3 comfortably, however there may be other issue I am not aware of. This PR is intended to start discussion on what it will take to update.
Closes https://github.com/facebook/react-native/pull/11930
Differential Revision: D4489926
Pulled By: mkonicek
fbshipit-source-id: 35ff5ac6b1b8893854538d6b9fe2c2e042ecca9f
Summary:
Largely typing fixes to deal with the glut of new `FlowFixMe` suppressions introduced with flow 0.38 in a4bfac907e
Tested with flow itself. CC gabelevi
Closes https://github.com/facebook/react-native/pull/11985
Differential Revision: D4452045
Pulled By: ericvicenti
fbshipit-source-id: acc46c4c406ae706a679e396be1d40ae2f4ce5a1
Summary:
Support symlinks under `node_modules` for all local-cli commands. PR https://github.com/facebook/react-native/pull/9009 only adds symlink support to the packager.
But other cli commands like `react-native bundle` creates its own instance of packager that doesn't have symlinks as part of its project roots, which results in the bundler breaking since it cannot find modules that you have symlinked.
This change ensures all `local-cli` commands add symlinks to its project roots.
Test plan (required)
1. Create a symlink in node_modules (for instance use npm/yarn link)
2. Run `react-native bundle`.
Closes https://github.com/facebook/react-native/pull/11810
Differential Revision: D4487741
fbshipit-source-id: 87fe44194134d086dca4eaca99ee5742d6eadb69
Summary:
When installing template by `react-native init AwesomeProject` and adding checkstyle to the Gradle setup, it will complain about unused imports
Closes https://github.com/facebook/react-native/pull/12076
Differential Revision: D4470930
fbshipit-source-id: 50a105886607fd1d3a458453fa1a844e9746dafa
Summary:
Also fix lint errors about Buffer being undefined by adding env: node to the eslint config for local-cli.
Tested on windows 10.
Closes https://github.com/facebook/react-native/pull/11959
Differential Revision: D4438903
Pulled By: hramos
fbshipit-source-id: 28d5edd662dd1e63dedf1274ff0a21af4df84f5e
Summary:
Fixes https://github.com/facebook/react-native/issues/11861 - the release config is currently broken for projects created by `react-native init` in `master`, 0.40 and 0.39.
I'm still investigating when and how this got broken but this seems to be a clean fix. I've added `-ObjC` as well to match the main target but I'm not sure yet whether that's necessary.
To test:
```
react-native init fooproject --version react-native@rh389/react-native#missinglinkerflags
```
Open in XCode, Edit scheme (⌘<), Change `Build Configuration` to `Release`, build.
Update: The `-lc++` flag became necessary when 33deaad196 landed because of the libstdc++ dependencies of `RCTLog`. Still not sure about `-ObjC`. javache ?
Closes https://github.com/facebook/react-native/pull/11889
Differential Revision: D4421685
Pulled By: javache
fbshipit-source-id: 954edaef773f8cef7b7ad671fa4d1f2bfc2f20f2
Summary:
A bit late to the party, but upgraded, tests replaced, all green.
Also updated `pbxproj` so that we are testing against React 0.40 init result, not against something old.
To cherry-pick and land once ships.
Closes https://github.com/facebook/react-native/pull/11868
Differential Revision: D4411362
fbshipit-source-id: c485fd76114979d34a7e288bb70e1ecb9b3baf76
Summary:
Introduces a new mechanism to build source maps that allows us to use real mapping segments instead of just mapping line-by-line.
This mechanism is only used when building development bundles to improve the debugging experience in Chrome.
The new mechanism takes advantage of a new feature in babel-generator that exposes raw mapping objects. These raw mapping objects are converted to arrays with 2, 4, or 5 for the most compact representation possible.
We no longer generate a source map for the bundle that maps each line to itself in conjunction with configuring babel generator to retain lines.
Instead, we create a source map with a large mappings object produced from the mappings of each individual file in conjunction with a “carry over” – the number of preceding lines in the bundle.
The implementation makes a couple of assumptions that hold true for babel transform results, e.g. mappings being in the order of the generated code, and that a block of mappings always belongs to the same source file. In addition, the implementation avoids allocation of objects and strings at all costs. All calculations are purely numeric, and base64 vlq produces numeric ascii character codes. These are written to a preallocated buffer objects, which is turned to a string only at the end of the building process. This implementation is ~5x faster than using the source-map library.
In addition to providing development source maps that work better, we can now also produce individual high-quality source maps for production builds and combine them to an “index source map”. This approach is unfeasable for development source maps, because index source map consistently crash Chrome.
Better production source maps are useful to get precise information about source location and symbol names when symbolicating stack traces from crashes in production.
Reviewed By: jeanlauliac
Differential Revision: D4382290
fbshipit-source-id: 365a176fa142729d0a4cef43edeb81084361e54d
Summary:
We don't need to look for `thisDependency` as we already have it. Small improvement as I am working on other fixes.
Closes https://github.com/facebook/react-native/pull/11867
Differential Revision: D4411177
fbshipit-source-id: 1413eb5457cb4d7916ead90f438ffe158f644cad