Commit Graph

8795 Commits

Author SHA1 Message Date
Michał Gregorczyk 46919095aa Simplify bundle loading a little bit.
Reviewed By: amnn

Differential Revision: D4306559

fbshipit-source-id: 9733c508aa5a905251e96855794a59ef79d61cfa
2016-12-09 17:58:32 -08:00
Martin Konicek 1103a91d8d CLI: Remove message 'This might take a while'
Summary: We now show the npm progress bar.

Reviewed By: mkonicek

Differential Revision:
D4307964
Ninja: OSS only, nit

fbshipit-source-id: 7338ab08abe8cf6354f9a9c6d36c51b0cffc69ee
2016-12-09 13:13:31 -08:00
Michael Lee f99f10c7ab Move gmock to shared xplat
Reviewed By: capickett

Differential Revision: D4017736

fbshipit-source-id: 46d9b936fe210040835e4b7222053c1520cb7318
2016-12-09 11:13:33 -08:00
Jirat K 1877e1b1d1 Fix react-native-git-upgrade by get package.json instead of selective field
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

To fixes #11330 and fixes #11334

Regarding to this command (using in `react-native-git-upgrade` - [cliEntry.js#L261](https://github.com/facebook/react-native/blob/master/react-native-git-upgrade/cliEntry.js#L261))
```bash
npm view react-native@latest peerDependencies.react version --json
```
The result from this command are not consistent across a different npm versions.

We better get a whole `package.json` file by calling (remove field and subfield option)

```
npm view react-native@latest  --json
```

**Test plan (required)**

**Setup**
- Publish `react-native-git-upgrade` to `sinopia`
- `npm install -g react-native-git-upgrade`
- Test against multiple npm versions (`2.15.8` or `3.7.5` or `3.10.10` or ` 4.0.3`)
- `react-native init AwesomeApp  --version 0.38.0 && cd AwesomeApp`
- `react-native-git-upgrade` and `react-native-git-upgrade 0.39.0` should be working properly

 ---
Closes https://github.com/facebook/react-native/pull/11348

Differential Revision: D4305894

Pulled By: mkonicek

fbshipit-source-id: 36ea7846926b424f4dd63c77b47db5cb69285027
2016-12-09 07:58:34 -08:00
Ashok Menon 30213757d9 Making CompiledSourceError a C enum, to keep `JSBase.h` as a C header
Reviewed By: javache

Differential Revision: D4299281

fbshipit-source-id: 14cdc6d4502a70300919dc6a98a5f274076134c7
2016-12-08 16:28:27 -08:00
Stepan Hruda 1642b38abe Make React Profiler asm position independent
Reviewed By: compnerd

Differential Revision: D4297098

fbshipit-source-id: 567f640f2d1ed4187e53356e7ca2d066f1412f9d
2016-12-08 14:58:26 -08:00
Theo Yaung 4a6f2ec44a Fail-Fast on Redundant Callback Invokes
Reviewed By: javache

Differential Revision: D4295268

fbshipit-source-id: 1258ffbc02bcf7d7199348c7df8fcd744bb9963f
2016-12-08 13:43:38 -08:00
Eric Sauter 9dcea13795 Remove docs reference to incorrect align-items default
Summary:
Per https://developer.mozilla.org/en-US/docs/Web/CSS/align-items, the default for `align-items` is stretch, so I removed the reference that suggested otherwise

Similar to https://github.com/facebook/react-native/pull/9397, but this section was not updated in that PR.
Closes https://github.com/facebook/react-native/pull/11373

Differential Revision: D4299871

Pulled By: ericnakagawa

fbshipit-source-id: 1bee27b0dced192ef42e21ca8cc800d52edce195
2016-12-08 10:28:36 -08:00
Jeremi Stadler b775f88636 Fix yarn command in git upgrade blog post
Summary:
The yarn global add needs to have global before add, it will otherwise just install in in the local project together with the global package.

https://yarnpkg.com/en/docs/cli/global
Closes https://github.com/facebook/react-native/pull/11364

Differential Revision: D4299909

Pulled By: ericnakagawa

fbshipit-source-id: 7b3a7817d2b1105003b9d48d16cf64756bfa51d5
2016-12-08 10:28:36 -08:00
Adam Ernst cfb8b19126 Expose more of RCTWebSocketObserver
Reviewed By: javache

Differential Revision: D4297162

fbshipit-source-id: 97032ccf3dc6bd259ca0fa2883eff45c0c49347f
2016-12-08 07:44:38 -08:00
Adam Ernst 587606987f Rename and merge files for RCTWebSocketObserver protocol
Summary: No need to have two files; merge it into one and give it an appropriate name.

Reviewed By: javache

Differential Revision: D4296716

fbshipit-source-id: 904d13c23bb8d403b8efcb60f9a4aa5df5b08972
2016-12-08 07:44:37 -08:00
Adam Ernst 2b0c4591e2 Rename RCTWebSocketManager file to reflect its new contents
Reviewed By: javache

Differential Revision: D4296615

fbshipit-source-id: a48da3f0550398cb59478c7405fe971f9246910f
2016-12-08 07:44:37 -08:00
Adam Ernst d0c3e98d1d Eliminate RCTWebSocketManager
Summary: This singleton was unnecessary and can be implemented with a single `static` in `RCTDevMenu`. In another diff, I will rename `RCTWebSocketManager.{h,m}` to reflect the only class that remains.

Reviewed By: javache

Differential Revision: D4296551

fbshipit-source-id: 653971dfb31de5b0a161b531eed82a067f536ce3
2016-12-08 07:44:37 -08:00
Adam Ernst 2ca6138852 Start exposing RCTWebSocketObserver using a protocol
Reviewed By: javache

Differential Revision: D4296387

fbshipit-source-id: 33f92c36168dcb18356d0ccdaf902a84634d94b7
2016-12-08 07:44:37 -08:00
Adam Ernst 574e3daf9f Clean up RCTWebSocketObserver
Summary: Avoid using properties where unnecessary; stick to only one way to modify the delegate.

Reviewed By: javache

Differential Revision: D4296351

fbshipit-source-id: 94d0e3c90904ed584f691a3f28a15a7ac450c3e1
2016-12-08 07:44:37 -08:00
Adam Ernst 28e2f64d07 Remove unused queue ivar from RCTWebSocketManager
Reviewed By: javache

Differential Revision: D4296309

fbshipit-source-id: feee004e24abdb4b3626c5304f662ec3d71118b5
2016-12-08 07:44:37 -08:00
Adam Ernst ac489858f8 Clean up RCTWebSocketProxyDelegate a bit
Reviewed By: javache

Differential Revision: D4296294

fbshipit-source-id: b31e522c21ec490fdf98711655e5e8df22b32a12
2016-12-08 07:44:37 -08:00
Jean Lauliac f0ca55aee8 packager: Resolver&co: @flow
Reviewed By: davidaurelio

Differential Revision: D4285448

fbshipit-source-id: ec9bc6fd3c6d6eae89347762bff8b5b24662394b
2016-12-08 05:13:40 -08:00
Ashok Menon 624104fd0c Listen to Compiled Source Errors in JSCExecutor fallback code.
Reviewed By: javache

Differential Revision: D4284537

fbshipit-source-id: 247717ef55fb6bc0a34a01626c790bd23fd18598
2016-12-08 05:13:40 -08:00
Pieter De Baets 286095292f Fix RN tvOS build
Reviewed By: mkonicek

Differential Revision: D4298869

fbshipit-source-id: fd132b2c1b656707b2dc750888c09e262b503111
2016-12-08 04:13:36 -08:00
David Aurelio 6786cbd3e4 Add fbjs definitions to flow config
Reviewed By: zertosh

Differential Revision: D4291805

fbshipit-source-id: 3dcb8ffe6132bd04a3048edae64e9d273c2dcae4
2016-12-08 02:43:25 -08:00
Travis Stanley b203343b81 update comment to reflect change in function name to renderQuickActions
Summary:
Minor error in commen
Closes https://github.com/facebook/react-native/pull/11351

Differential Revision: D4293263

Pulled By: ericnakagawa

fbshipit-source-id: 19559b210336bfd05794a7585c0133a075e06398
2016-12-07 23:58:25 -08:00
Maxime Lapointe d56530d7d5 Reworking keyboardShouldPersistTaps to have a middle ground
Summary:
Right now, the ScrollView's keyboard hiding behavior is either all or nothing: Hide the keyboard on any tap, or do nothing ever. This PR introduces a third mode to keyboardShouldPersistTaps which is much closer to what I consider should be the default.

In the new behavior, the tap responding is done in the bubbling phase (instead of the capture phase like =true). As a result, a child can handle the tap. If no child does, then the ScrollView will receive the tap and will hide the keyboard. As a result, changing TextInput focus works as a user expects, with a single tap and without keyboard hiding. But taping on Text or on the empty part of the ScrollView hides the keyboard and removes the focus.

You can view the behavior in a monkey patched ScrollView demo on rnplay:
https://rnplay.org/apps/E90UYw
https://rnplay.org/apps/UGzhKA

In order to have a uniform props set, i added 3 values to the keyboardShouldPersistTaps:
'never' and 'always' are the same as false and true.
'handled' is the new behavior.

I don't
Closes https://github.com/facebook/react-native/pull/10628

Differential Revision: D4294945

Pulled By: ericvicenti

fbshipit-source-id: 1a753014156cac1a23fabfa8e1faa9a768868ef2
2016-12-07 21:43:35 -08:00
Christoph Pojer 4d5ef76b1a Add missing slash.
Summary:
This should be there for consistency.
Closes https://github.com/facebook/react-native/pull/11357

Differential Revision: D4294530

Pulled By: kentaromiura

fbshipit-source-id: 6219a7c69a65dde21d96bc032fc9a327386a85ca
2016-12-07 20:58:30 -08:00
Adam Ernst 617eb309a1 Refactor reload command in React Native
Summary: Introduces an API to register a weakly-held listener for the reload (Cmd+R) command. This allows external infrastructure to hook into the reload command before the `RCTBridge` object is even created.

Reviewed By: javache

Differential Revision: D4286980

fbshipit-source-id: 51012fb8cbeb433dc880d9d98d847b07fdbb4c4f
2016-12-07 20:13:22 -08:00
Eming Kwok 40b84fa5f8 fix memory leak in Chrome debugging
Summary:
`RCTWebSocketExecutor` saves every WebSocket callback when sending message to chrome, but does not clear them in a debug session until the JS bridge is reloaded, and there may be thousands of blocks saved in the callback table. This PR removes them after they are called.
Closes https://github.com/facebook/react-native/pull/11341

Differential Revision: D4295710

Pulled By: javache

fbshipit-source-id: 29a02d1aba320115bbb97aee8981e34b89303c91
2016-12-07 17:13:42 -08:00
Eric Palakovich Carr 38d275f8b5 Red Box should open PyCharm at line number of error
Summary:
This is a simple one line change.  When a red box is launching the editor, if `launchEditor.js` is aware of your editor it can also add a line number to open the file at.  So if the stacktrace shows an error on like 56 in `ako.js` then it'll try`wstorm /Users/somelady/src/project/ako.js:56` instead of `wstorm /Users/somelady/src/project/ako.js`.

This adds PyCharm's command line launcher, which is named `charm`.  There is existing logic to handle other JetBrains editors, so I just did a simple one line addition.

**Test plan (required)**

* Install PyCharm (if needed)
* Set environment variable `REACT_EDITOR` to `charm`
* Open PyCharm
* Add/replace the current `charm` command via `Tools -> Create Command-line launcher...` in PyCharm.
* Run a React Native project with an error in the source code.
* In the generated red box, click on one of the entries in the stack trace
* File should open in PyCharm at the correct line number.
Closes https://github.com/facebook/react-native/pull/11275

Differential Revision: D4295724

Pulled By: javache

fbshipit-source-id: 29dec525f76c2f0a3ee203cac67408eecc8ac6b6
2016-12-07 17:13:42 -08:00
Mike Grabowski 6feffe1de0 Better error for ART <Group />
Summary: Fixes #3815

Differential Revision: D4295976

Pulled By: javache

fbshipit-source-id: 034690d3bee75217d820d3361136a410a812cd2c
2016-12-07 17:13:42 -08:00
Andrew Yang dbcfc2b41f Update gradle-download-task from 2.0.0 to 3.1.2 to fix boost zip down…
Summary:
Small pull request

 **motivation**
The doc 'Building React Native from source' is not up to date now.

While i try to build from the source my self, the gradle-download-task(2.0.0) will always fail to download boost zip with a failure of 403.

After i upgrade the gradle-download-task to 3.1.2, the download works well.

**Test plan (required)**
I tested to build the source myself, it works.

This is non-code update, it is document update, hope to help other people who get the same download failure.

**Code formatting**
Non-code update PR.
Closes https://github.com/facebook/react-native/pull/11298

Differential Revision: D4288387

fbshipit-source-id: 5e6feef1ea80f7e3feddcc7e4abf2b5cea82f08f
2016-12-07 16:43:28 -08:00
Pieter De Baets 286a1b2e5e Remove deprecated RCTReloadNotification
Reviewed By: adamjernst

Differential Revision: D4294180

fbshipit-source-id: 6837597df2a798661c993c6f63ec430989954de6
2016-12-07 16:28:33 -08:00
Pieter De Baets 59407f3660 Redo exported headers and include paths for opensource
Summary:
Xcode really sucks, per some discussion on e1577df1fd and https://developer.apple.com/library/content/technotes/tn2215/_index.html, if you use the headers phase, and mark headers in your static library as public, they will actually end up in the final package that's built and you can't submit to the app store! This changes our xcode setup to use a copy files phase instead.

I've also changed the header include path to be $(BUILT_PRODUCTS_DIR)/include, which is added to the include path by Xcode by default, so 3rd party libraries should not be impacted by these changes anymore.

Reviewed By: mkonicek

Differential Revision: D4291607

fbshipit-source-id: 969b9ebcbeb8161f85427f8c429e198d9d0fae30
2016-12-07 15:28:29 -08:00
Andres Suarez 29dce56b90 Remove requestIdleCallback/cancelIdleCallback flow lib
Summary: As of flow 0.36.0, `requestIdleCallback` and `cancelIdleCallback` are part of the builtin lib defs. https://github.com/facebook/flow/pull/2800

Reviewed By: yungsters

Differential Revision: D4280306

fbshipit-source-id: 30328675c7dbfe12f603321f1196c87800a19ba8
2016-12-07 13:13:39 -08:00
Michał Gregorczyk d72c6fd500 Do not call `toString` on functions in buildStyleInterpolator
Reviewed By: vjeux

Differential Revision: D4292618

fbshipit-source-id: cd7cd1a88aeb2c800f2c2941c79855992613ec84
2016-12-07 11:58:28 -08:00
Eric Vicenti 283d0c07f6 Docs: Revise language around mobile web
Summary:
Addresses some criticism: https://twitter.com/ryanflorence/status/806236197731172352

As the author of this original text, I promise no offense was meant towards mobile web technologies.

I just want to help people build apps that feel great.
Closes https://github.com/facebook/react-native/pull/11353

Differential Revision: D4292705

Pulled By: lacker

fbshipit-source-id: 7b86865e4e98cfc37e052e1c02e0b2c3e800d4fc
2016-12-07 10:43:48 -08:00
Martin Konicek 3ab508e99a Upselling ListView in ScrollView's docs
Summary:
Internal research at FB has shown that many devs don't know why they should use ListView instead of ScrollView, or that ListView even exists. This PR changes ScrollView's docs to upsell ListView.

I could put this as a separate guide in the docs, but I think this place will have the best possible reach for target audience.

Suggestions welcome. Let me know if it doesn't make sense or is too verbose.
Closes https://github.com/facebook/react-native/pull/11349

Differential Revision: D4292109

Pulled By: mkonicek

fbshipit-source-id: e4a14e5a55333c9282d0e407461505e71e850b20
2016-12-07 10:43:48 -08:00
Lukas Piatkowski de82931931 Fix SamplingProfiler and HeapCapture for apps that lazy load react modules
Reviewed By: cwdick

Differential Revision: D4291903

fbshipit-source-id: 684ced8d6370494191cdb182a8e172680d69d17b
2016-12-07 10:43:48 -08:00
Martin Konicek 9b0e15cbb2 Remove dependency on Yeoman
Summary:
We stopped using Yeoman in https://github.com/facebook/react-native/pull/10786

I almost forgot to remove the now-unused dependency :)

**Test Plan**

- Published react-native to Sinopia
- Ran `react-native init MyApp`
- The app was generated correctly
- The app's node_modules folder doesn't contain Yeoman

Reviewed By: cpojer

Differential Revision: D4291619

fbshipit-source-id: 44c1ef8035fa2d8c40d4e8c505207245e1a95d3c
2016-12-07 10:43:48 -08:00
Don Yu bfe551d2d1 Implement onViewAppear by creating a new EventListener on ReactRootView listening for when it's attached to a RN Instance
Reviewed By: AaaChiuuu

Differential Revision: D4269272

fbshipit-source-id: 6dd54f8ab7befebd54e82ef355119ba302b9bfe5
2016-12-07 09:58:33 -08:00
Emil Sjolander 7f8c2985a8 Rename directories
Reviewed By: gkassabli

Differential Revision: D4284681

fbshipit-source-id: f0c6855c2c6e4389b7867f48f72cbb697830fc5a
2016-12-07 05:14:12 -08:00
David Aurelio cf3ae6c32a Use absolute paths from repo root
Summary: Rather than using relative paths from the build root, this switches all paths to absolute paths from the build root. This makes integration with a lot of tooling easier.

Reviewed By: jeanlauliac

Differential Revision: D4285474

fbshipit-source-id: 80d20e0f6dc61a310e72112b9654628bff81a4f0
2016-12-06 16:58:33 -08:00
Emil Sjolander a47678b3e9 Remove init from api
Reviewed By: gkassabli

Differential Revision: D4276177

fbshipit-source-id: c4404d0534f381dfacee0625b2847d38de58e038
2016-12-06 14:43:36 -08:00
Martin Konicek d3065f6895 CLI: Show npm / yarn output during 'react-native-init' when installing React and Jest
Summary:
I missed this while doing the Yeoman wipeout.

Currently we just print:

    Installing React...
    Installing Jest...

This diff makes it print the output of those commands.

**Test Plan**

Published react-native to Sinopia, ran `react-native init MyApp`, saw the output:

    Installing Jest...
    ⸨░░░░░░░░░░░░░░░⸩ ⠸ normalizeTree: ...

Reviewed By: bestander

Differential Revision: D4286640

fbshipit-source-id: e554f03a4729c2de85eba527f10f4b727de722e4
2016-12-06 13:58:31 -08:00
Martin Konicek 76cd2f7bf2 Allow configuring the way CLI installs react-native
Summary:
- Added an option to override the install command in CI environments (see comment in code)
- Simplify the verbose mode
- Simplify how options are passed round

Test plan (only tested on Mac OS):

    react-native init TestApp
    react-native init TestApp --version 0.36

In both cases the app was generated, package.json contained the correct version (latest, or 0.36).

    react-native init TestApp --verbose

Saw progress bar.

    react-native init InstallCommandTest --installCommand "npm install bad-package-doesnt-exist"

404 error is printed to stdout correctly.

    react-native init TestApp --installCommand "npm install react-native"

The app was generated.

    react-native init InstallCommandTest --installCommand "npm install react-native --verbose" --verbose

Saw verbose output from npm.

Reviewed By: bestander

Differential Revision: D4284642

fbshipit-source-id: f2cdee52ab64831ae3ca064d50f23c5f73a0301f
2016-12-06 13:28:30 -08:00
John Shelley d21aa92480 Android - Fix Overlay for Marshmallow 23+
Summary:
Currently any React Native apps that target API 23 or greater will crash on the first initial debug/dev build due to the overlay permission.

Sadly there isn't a concrete "request permission" baked into the Marshmallow permission system.
However, we can launch the overlay screen without starting the react app and once its turned on start the app.

 - https://github.com/facebook/react-native/issues/10454 - targetSdkVersion 23 lead crash / App crash for targeting 23+
 - https://github.com/facebook/react-native/pull/10479 - Add the overlay permission information / Larger discussion around targeting API 23+
- Intent to Overlay permission goes directly to the app in question, rather then the general full listing of applications. This allows a developer who is not familiar with the system to easily toggle the overlay without getting confused.

**Test plan (required)**
* Ran UIExplorer App on fresh install with Target 23
```
cd react-native
./gradlew :Examples:UI
Closes https://github.com/facebook/react-native/pull/11316

Differential Revision: D4286351

fbshipit-source-id: 024e97c08c40ee23646dd153794fcde7127b2308
2016-12-06 12:43:36 -08:00
Pieter De Baets 27acb71353 Fix target configuration in React.xcodeproj
Summary: The target config inside React.xcodeproj was messed up, with source files being included in multiple or wrong targets. I went over the files in React.xcodeproj and verified that each .m file was included only once and was in the right target and .h were in the right projects.

Reviewed By: majak

Differential Revision: D4284673

fbshipit-source-id: 99af61083c6ca81311e30f0ea0045d4e7bffc20c
2016-12-06 06:28:33 -08:00
Nelen 2190221c44 Added mocked functions to StatusBarManager
Summary:
**Description:**
Jest tests that use that StatusBar failing because the status bar functions aren't mocked.
Errors I ran into:
`TypeError: StatusBarManager. setNetworkActivityIndicatorVisible is not a function`
`TypeError: StatusBarManager. setHidden is not a function`
`TypeError: StatusBarManager. setStyle is not a function`

**Fix:**
Added mocks for all the functions that the StatusBar offers according to the docs: https://facebook.github.io/react-native/docs/statusbar.html

**Test plan (required)**
Verify that the tests using StatusBar and its functions succeed.
Closes https://github.com/facebook/react-native/pull/11322

Differential Revision: D4284536

Pulled By: cpojer

fbshipit-source-id: b67be8c0595d91ee9aca4784f457c0959d7e45d5
2016-12-06 05:58:32 -08:00
David Aurelio 2ab5d2809f Add bundle building logic
Summary: Adds the necessary functionality to serialize a series of `Module`s to a bundle and a source map in the context of the new Buck/Packager integration

Reviewed By: cpojer

Differential Revision: D4265867

fbshipit-source-id: f2d3e4ffed64a3dca817101faad7bced9f16edc7
2016-12-05 16:43:45 -08:00
David Aurelio 27e818fa69 Support relative paths in haste map
Summary: Since all paths are relative when building with the new Buck integration, `HasteMap` needed support for these.

Reviewed By: cpojer

Differential Revision: D4265888

fbshipit-source-id: 2d454bfd3866028d8d2c268c0fd318b148951dc9
2016-12-05 16:43:45 -08:00
David Aurelio c18373f438 Add source map helper
Summary: Adds a helper to produce index source maps for Buck builds

Reviewed By: cpojer

Differential Revision: D4265911

fbshipit-source-id: 9ca3c49876df5db039bae823c0458c98e6e05619
2016-12-05 16:43:45 -08:00
David Aurelio 67c9fe0b75 Don’t use spaces when amending module wrapper
Summary: since we use the same module wrapper amendment function for dev and prod builds, and code is already minified at this point, we minify ourselves by leaving out space.

Reviewed By: cpojer

Differential Revision: D4265967

fbshipit-source-id: 719a3bbfbc02c9af1bb3fa08317b2f1b92c141a5
2016-12-05 16:43:45 -08:00