Commit Graph

4478 Commits

Author SHA1 Message Date
Martín Bigio 4ffb241647 Hot Loading E2E basic flow
Summary:
public

Implement all the necessary glue code for several diffs submitted before to get Hot Loading work end to end:

- Simplify `HMRClient`: we don't need to make it stateful allowing to enable and disable it because both when we enable and disable the interface we need to reload the bundle.
- On the native side we introduced a singleton to process the bundle URL. This new class might alter the url to include the `hot` attribute. I'm not 100% sure this is the best way to implement this but we cannot use `CTLSettings` for this as it's are not available on oss and I didn't want to contaminate `RCTBridge` with something specific to hot loading. Also, we could potentially use this processor for other things in the future. Please let me know if you don't like this approach or you have a better idea :).
- Use this processor to alter the default bundle URL and request a `hot` bundle when hot loading is enabled. Also make sure to enable the HMR interface when the client activates it on the dev menu.
- Add packager `hot` option.
- Include gaeron's `react-transform` on Facebook's JS transformer.

The current implementation couples a bit React Native to this feature because `react-transform-hmr` is required on `InitializeJavaScriptAppEngine`. Ideally, the packager should accept an additional list of requires and include them on the bundle among all their dependencies. Note this is not the same as the option `runBeforeMainModule` as that one only adds a require to the provided module but doesn't include all the dependencies that module amy have that the entry point doesn't. I'll address this in a follow up task to enable asap hot loading (9536142)

I had to remove 2 `.babelrc` files from `react-proxy` and `react-deep-force-update`. There's an internal task for fixing the underlaying issue to avoid doing this horrible hack (t9515889).

Reviewed By: vjeux

Differential Revision: D2790806

fb-gh-sync-id: d4b78a2acfa071d6b3accc2e6716ef5611ad4fda
2015-12-28 16:44:59 -08:00
Martín Bigio 24c908e794 Dependencies for Hot Loading
Reviewed By: vjeux

Differential Revision: D2789683

fb-gh-sync-id: 6c8f5a601040505eb597db3d6f50ec6abaa6cd6e
2015-12-28 16:44:52 -08:00
Martín Bigio 245065be87 Introduce HMR runtime
Summary:
public

Add a very simple runtime for self-accepting modules. The API is the same one as Webpacks's one for now.
The new infra will be end-to-end tested on a follow up diff.

Reviewed By: vjeux

Differential Revision: D2789428

fb-gh-sync-id: c39524814d53c6e4ec9d9d011081ea81089b00b6
2015-12-28 16:44:45 -08:00
Martín Bigio ac9c3c548d Make Packager send fresh modules through HMR interface
Reviewed By: frantic

Differential Revision: D2787951

fb-gh-sync-id: 63c04710b60d99b5161ef9a40b116ba2f72df745
2015-12-28 16:44:38 -08:00
Martín Bigio 90781d3067 Introduce Packager and App HMR WebSocket connection
Summary:
public

This diff adds infra to both the Packager and the running app to have a WebSocket based connection between them. This connection is toggled by a new dev menu item, namely `Enable/Disable Hot Loading`.

Reviewed By: vjeux

Differential Revision: D2787621

fb-gh-sync-id: d1dee769348e4830c28782e7b650d025f2b3a786
2015-12-28 16:44:32 -08:00
Christopher Chedeau f72cfdd9fa Merge pull request #5009 from magus/website-docs
Docs for website setup
2015-12-28 12:58:01 -08:00
Noah Jorgenson dfa541a050 Docs for website setup
- always start website/setup.sh in website
- use setup.sh in website README
2015-12-28 12:47:09 -08:00
sunnylqm 8080583f52 update description about removeClippedSubviews
Summary: Closes https://github.com/facebook/react-native/pull/4998

Reviewed By: svcscm

Differential Revision: D2790689

Pulled By: androidtrunkagent

fb-gh-sync-id: 2db476eabe067fd770b6acce47b62607df348052
2015-12-28 07:56:28 -08:00
sunnylqm 58bbd7bc5b Hint for passing navigator in renderScene
Summary: Closes https://github.com/facebook/react-native/pull/4999

Reviewed By: svcscm

Differential Revision: D2790687

Pulled By: androidtrunkagent

fb-gh-sync-id: af055123b351e37081a37d6153333666a878113c
2015-12-28 06:39:32 -08:00
Satyajit Sahoo 23de42ba3f Merge pull request #4206 from mrcasals/fix_docs
Add Switch docs
2015-12-27 21:03:43 +05:30
Tadeu Zagallo f546dc3790 Move WPO to the minify step
Summary:
public

The Whole Program Optimisation (WPO) pass is quite slow, and can make it painful
to iterate when having `dev=false`. Move it to happen only when both `dev=false` and `minify=true`.

Reviewed By: davidaurelio

Differential Revision: D2773941

fb-gh-sync-id: ac5ca4e1286e233c2d175eecdbf7494d5d3497b2
2015-12-27 06:01:30 -08:00
Satyajit Sahoo 739a6d6be1 Merge pull request #4957 from sunnylqm/patch-5
Use a better way to update react-native package
2015-12-26 23:39:55 +05:30
sunnylqm 019c564941 use a better way to update react-native package 2015-12-26 23:09:14 +08:00
Satyajit Sahoo 28dc5263eb Merge pull request #4983 from sunnylqm/master
Add react-native version output for -v/--version
2015-12-26 20:30:15 +05:30
sunnylqm 1dea58c7df add react-native version output for -v/--version 2015-12-26 22:59:31 +08:00
Satyajit Sahoo 65a9e505bd Merge pull request #4976 from hosainnet/patch-1
Update incorrect WebSocket example in Network.md
2015-12-26 17:12:17 +05:30
Hosain 70c89fa0d2 Update incorrect WebSocket example in Network.md
Using the provided WebSocket example under react-native 0.17, the sample code throws the following error:

"TypeError: ws.on is not a function(…)"

It's listening on ".on" which does not exist, rather than assigning a function to onopen, onmessage, onerror and onclose.

See: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
2015-12-26 11:18:51 +00:00
Patrick Puritscher bde2f30474 Update templates to ES2015
Summary:
I don't know the reasons, why the templates are written with the `react.createClass`method. Today I see lot's of examples using the **ES6 way**. In my own projects I'm using this way, too.

I removed `use strict`, since *Module code is always strict mode code*, according to the [spec](http://www.ecma-international.org/ecma-262/6.0/#sec-strict-mode-code).

Maybe we should **discuss** the usage of ES6 in the templates.
Closes https://github.com/facebook/react-native/pull/4891

Reviewed By: svcscm

Differential Revision: D2789493

Pulled By: androidtrunkagent

fb-gh-sync-id: 90e70f787017c61dc64cbc9f0beb02331fa749ec
2015-12-25 02:17:30 -08:00
sunnylqm a47fcd44f9 Confusing description about task queue
Summary:
Just can't get the point. What does `the next task that might have been queued up earlier` mean? Earlier than what? `The first task`? Please correct me if I missed something.
Closes https://github.com/facebook/react-native/pull/4970

Reviewed By: svcscm

Differential Revision: D2789390

Pulled By: sahrens

fb-gh-sync-id: 3078fb6cbc7940d26d2dc393ba9448f132721ea2
2015-12-24 19:35:29 -08:00
SangYeob Bono Yu e4272b456e Set encoding to UTF-8 in Android. Fixes #4873
Summary: Closes https://github.com/facebook/react-native/pull/4938

Reviewed By: svcscm

Differential Revision: D2789328

Pulled By: androidtrunkagent

fb-gh-sync-id: c0a0b385be0d832cd052b2495def431cf2c51c8c
2015-12-24 17:18:44 -08:00
Wesley Ellis 36d26c7d3b Don't set height to avoid clipping textinput for XHRExample on android
Summary:
When adding fields to the multipart/form-data Upload section the two `TextInput` fields have a height set that is causing them to be clipped on my Nexus 5 (5.1.1) like so:

![screenshot_2015-09-15-16-50-41](https://cloud.githubusercontent.com/assets/362769/9889808/485a080c-5bca-11e5-9858-6aa51823928b.png)

I've removed the height property, so now it looks like:

![screenshot_2015-09-15-16-50-22](https://cloud.githubusercontent.com/assets/362769/9889806/484f416a-5bca-11e5-9a54-255f0cfc1051.png)
Closes https://github.com/facebook/react-native/pull/2730

Reviewed By: svcscm

Differential Revision: D2789188

Pulled By: androidtrunkagent

fb-gh-sync-id: 4a9ec9bc88d6af8f1db1a6208f138ff05f4eb392
2015-12-24 13:13:36 -08:00
Konstantin Raev 308612314e added emulator support to circle.ci
Summary: Closes https://github.com/facebook/react-native/pull/4911

Reviewed By: svcscm

Differential Revision: D2789142

Pulled By: androidtrunkagent

fb-gh-sync-id: 9fd9520c27fc9acb7b139de6843a71ca3f918249
2015-12-24 10:40:28 -08:00
Adam Miskiewicz c972cce405 Fix InteractionManager-test.js
Summary:
Rather than specifying what not to mock, turn off autoMock for this test suite, and only mock BatchedBridge.

Fixes #4965
Closes https://github.com/facebook/react-native/pull/4967

Reviewed By: svcscm

Differential Revision: D2789079

Pulled By: androidtrunkagent

fb-gh-sync-id: 0d7024f92b630a3c0643ea2e1fde8d673fcdf6e1
2015-12-24 09:25:19 -08:00
Adam Miskiewicz 6cec263ca3 Fix @providesModule not being ignored properly
Summary:
There's quite a bit of code scattered around the packager regarding ignoring the `providesModule` Haste pragma in any file that isn't in `react-native`, `react-tools` or `parse`. There is even a (passing) test case.

However, there's an edge case.

Take, for example, `fbjs`. It has a module inside of it called `ErrorUtils`. `react-relay` requires this file normally, in Common.JS style, by doing `require('fbjs/libs/ErrorUtils')`. But when `react-native` attempts to require `ErrorUtils` using the HasteModule format (in it's JavaScript initialization), it resolves the `fbjs` `ErrorUtils` module, instead of RN's `ErrorUtils`.

This happens, it turns out, because when a module is read (in `Module._read`), it's not caring about whether or not it should pay attention to `providesModule`, and is just assigning the `providesModule` value as the id of the module no matter what. Then when `Module.getName` is called, it will always use that `data.id` that was set, thus creating the wrong dependency tree.

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

Reviewed By: svcscm

Differential Revision: D2632317

Pulled By: vjeux

fb-gh-sync-id: efd8066eaf6f18fcf79698beab36cab90bf5cd6d
2015-12-24 08:32:31 -08:00
Satyajit Sahoo 59885911e3 Merge pull request #4958 from mxstbr/update-contributing-docs
Add mention of the license comment in CONTRIBUTING.md
2015-12-24 14:59:31 +05:30
Max 3a76f83f7b Add mention of the license comment in CONTRIBUTING.md
See this comment of PR #4866: https://github.com/facebook/react-native/pull/4866#issuecomment-166612075
2015-12-24 10:27:29 +01:00
Bhuwan Khattar 7035fbc58d getTransformOptionsModulePath
Summary:
Passing around a `getTransformOptions` function doesn't really work with the CLI utils, so I'm changing this to `getTransformOptionsModulePath` instead, which can easily be injected in through `rn-cli.config.js`.

public

Reviewed By: martinbigio

Differential Revision: D2785789

fb-gh-sync-id: c9fdc358cb5d0db27e0d02496e44c013c77f3d5f
2015-12-24 01:02:30 -08:00
Spencer Ahrens 893a54d0cd Add yieldy, chained async task support to InteractionManager
Summary:
Default behavior should be unchanged.

If we queue up a bunch of expensive tasks during an interaction, the default
`InteractionManager` behavior would execute them all in one synchronous loop at
the end the JS event loop via one `setImmediate` call, blocking the JS thread
the entire time.

The `setDeadline` addition in this diff enables an option to only execute tasks
until the `eventLoopRunningTime` is hit (added to MessageQueue/BatchedBridge),
allowing the queue execution to be paused if an interaction starts in between
tasks, making the app more responsive.

Additionally, if a task ends up generating a bunch of additional tasks
asynchronously, the previous implementation would execute these new tasks after
already scheduled tasks. This is often fine, but I want it to fully resolve
async tasks and all their dependencies before making progress in the rest of the
queue, so I added support for `type PromiseTask = {gen: () => Promise}` to do
just this. It works by building a stack of queues each time a `PromiseTask` is
started, and pops them off the stack once they are resolved and the queues are
processed.

I also pulled all of the actual queue logic out of `InteractionManager` and into
a new `TaskQueue` class to isolate concerns a bit.

public

Reviewed By: josephsavona

Differential Revision: D2754311

fb-gh-sync-id: bfd6d0c54e6410cb261aa1d2c5024dd91a3959e6
2015-12-23 16:12:30 -08:00
Martin Konicek f7de9678d4 Update NewIssueGreeting.md 2015-12-24 01:10:21 +01:00
Martin Konicek 09702478f1 Update NewIssueGreeting.md 2015-12-24 01:08:13 +01:00
James Ide e981732dca Merge pull request #4954 from toomass/patch-1
Added CBS Sports Franchise Football to Showcase
2015-12-23 15:36:44 -08:00
toomass 176d45633a Added CBS Sports Franchise Football to Showcase
Adding CBS Sports Franchise Football to the React Native showcase,
2015-12-23 15:35:14 -08:00
Pieter De Baets 4fde511f5c Remove warnings in RCTBridgeTests
Reviewed By: majak

Differential Revision: D2771228

fb-gh-sync-id: dd935094ceeff196c272565bf7efea5112059a1a
2015-12-23 14:42:31 -08:00
Pieter De Baets 0cfe76399c Improve red boxes coming from RCTWebSocketExecutor
Reviewed By: tadeuzagallo

Differential Revision: D2775452

fb-gh-sync-id: b709e0e725ab76468700466b804237eed9158bfd
2015-12-23 13:32:28 -08:00
Pieter De Baets ae2f556c71 Fix scroll-to-top in MarketPlace
Reviewed By: weicool

Differential Revision: D2779979

fb-gh-sync-id: 72982a8f3142fa2cfd60fe4f68bbe1a42fc793c2
2015-12-23 12:40:33 -08:00
Janic Duplessis 3872e5fd93 Use //# instead of //@ for sourceMappingURL comment
Summary:
I had an issue debugging in chrome 48 on windows where source maps didn't work. I tried changing the sourceMappingURL comment to use the //# syntax instead and it fixed the problem.

According to https://developers.google.com/web/updates/2013/06/sourceMappingURL-and-sourceURL-syntax-changed?hl=en the //@ syntax was deprecated for //#.
Closes https://github.com/facebook/react-native/pull/4892

Reviewed By: martinbigio

Differential Revision: D2781046

Pulled By: davidaurelio

fb-gh-sync-id: 3b85f6153692a2e23509029ecf18dc51d35ba921
2015-12-23 11:39:07 -08:00
Christopher Chedeau d1e5fb8144 Update .travis.yml 2015-12-23 10:29:43 -08:00
StefanT a162f72655 Added ColorPropType
Summary:
Problem: https://github.com/facebook/react-native/issues/4708

Solution: Added a ColorPropType that validates the color used by the dev

Notes:
1) I'm working a Win8.1 machine and couldn't build the react-native using the github repo. As soon as I figure that out, I'll probably figure how to run the tests and how to add some for this feature.
2) It's my first pull request. Be gentle :)
Closes https://github.com/facebook/react-native/pull/4866

Reviewed By: bestander, svcscm

Differential Revision: D2783672

Pulled By: nicklockwood

fb-gh-sync-id: ca22aa3c0999188075681b5d20fff0631496e238
2015-12-23 10:08:38 -08:00
Andreas Stütz 7164c755cb Add props for content insets
Summary:
This PR adds a contentInsetStart and a contentInsetEnd property to ToolbarAndroid, allowing offsetting Toolbar contents to different keylines
Closes https://github.com/facebook/react-native/pull/4699

Reviewed By: svcscm

Differential Revision: D2759294

Pulled By: mkonicek

fb-gh-sync-id: f22aa255f07929ad7a99ac7568981d35e848065b
2015-12-23 10:08:33 -08:00
Mike Fowler 134dd57cd6 Update ToolbarAndroid.android.js
Summary:
Updates the documentation for `ToolbarAndroid.android.js` with proper asset system syntax.
Closes https://github.com/facebook/react-native/pull/4908

Reviewed By: svcscm

Differential Revision: D2783113

Pulled By: mkonicek

fb-gh-sync-id: 321d79cb80025d7a065ccf012678ecebccb35bae
2015-12-23 10:08:28 -08:00
Philipp von Weitershausen 1b80007236 Improvements to the packager for very large projects
Summary:
Here are some small fixes for issues we've encountered with very large RN projects (mostly huge dependency trees in `node_modules`).

cc amasad martinbigio
Closes https://github.com/facebook/react-native/pull/4880

Reviewed By: svcscm

Differential Revision: D2782834

Pulled By: mkonicek

fb-gh-sync-id: e316a62b84ba796b80ac819431414ebf27f7b566
2015-12-23 10:08:24 -08:00
Christopher Dro c74d6403f5 Update dev menu to keep track of element inspector.
Summary:
This PR makes the android dev menu consistent with iOS where toggling the inspector will update the button label accordingly.
Closes https://github.com/facebook/react-native/pull/4628

Reviewed By: svcscm

Differential Revision: D2740549

Pulled By: mkonicek

fb-gh-sync-id: 02458d09b84e1592dcf245290ee2bbfb2863060d
2015-12-23 10:08:18 -08:00
Denis Koroskin d0de0767e3 Implement touch intercepting in RCTView
Summary:
public React allows excluding certain elements from touch handling by assigning `PointerEvents` filter to them, such as BOX_NONE - this element will not receive touch but its children will, BOX_ONLY - only this element will receive pointer event and not children, NONE - neither this element nor its children will receive pointer events, and AUTO - pointer events are allowed for both this element and its children.

This diff adds PointerEvents support to flat RCTView. Most of the implementation is copied from ReactViewManager/ReactViewGroup. One small change is made to TouchTargetHelper to ensure that it works correctly with virtual nodes when their parent has PointerEvents set to PointerEvents.BOX_NONE.

Reviewed By: ahmedre

Differential Revision: D2784208

fb-gh-sync-id: 4b831f9b1bfb8014a99d7b33534ae7ff7b4ab498
2015-12-23 10:08:13 -08:00
Nick Lockwood 83c2e0303b Added JS wrappers for ImageStore and ImageEditor
Summary:
public
Added JS wrappers for ImageStore(Manager) and ImageEditor(Manager) so they can be required in the normal way instead of accessed directly via NativeModules.

Reviewed By: dmmiller

Differential Revision: D2773822

fb-gh-sync-id: 6eeafd3f80a87b1b91a04a2aebad6e2fd31b0e98
2015-12-23 10:08:07 -08:00
Christoph Pojer b7e939b38d Update all tests to use Jasmine 2
Reviewed By: vjeux

Differential Revision: D2782581

fb-gh-sync-id: 1d938a2bbdd8670c917c1793234dfdcb29fd4511
2015-12-23 10:08:01 -08:00
Brent Vatne 43ca8a0da4 Add TransformExample to UIExplorerList.ios.js
Summary:
It wasn't in UIExplorerList.ios.js (only in UIExplorerList.js) so it was not being pulled in on the iOS UIExplorer.
Closes https://github.com/facebook/react-native/pull/2196

Reviewed By: majak

Differential Revision: D2780150

Pulled By: nicklockwood

fb-gh-sync-id: f111ec6e29465c4c7f22ca8faec8fc17a96a80cb
2015-12-23 10:07:56 -08:00
John Ku c34ef25ec5 fix incorrect count for layoutAnimation callback
Summary:
fixes #3106
Having -1 would trigger callback one frame early causing it to be ignored on the next frame.
Closes https://github.com/facebook/react-native/pull/3190

Reviewed By: svcscm

Differential Revision: D2783700

Pulled By: mkonicek

fb-gh-sync-id: 02070f70915055aec3b1543a8d553f2680438611
2015-12-23 10:07:51 -08:00
David Aurelio c866a0a6d0 use a filename for the magic unbundle file that will end up in the apk
Reviewed By: martinbigio

Differential Revision: D2774022

fb-gh-sync-id: 5ccafe606e586c55213a10e00013c6feecc9dbcd
2015-12-23 10:07:47 -08:00
Satyajit Sahoo 935cbb76c0 Add a base activity for React Native apps. Fixes #4043
Summary:
Having a base activity allows us to add new features and fixes without having to change the generated `MainActivity` file.

cc mkonicek arbesfeld
Closes https://github.com/facebook/react-native/pull/4827

Reviewed By: bestander

Differential Revision: D2783527

Pulled By: mkonicek

fb-gh-sync-id: 707b82839809ca2e1775f5d3ac022a6d00bcac5a
2015-12-23 10:07:42 -08:00
Johan Lindskogen afbff9bf88 Add support for binary type data (ArrayBuffer)
Summary:
Entirely based on https://github.com/facebook/react-native/pull/1829
I just updated the diff to be compatible with the current master branch.
Closes https://github.com/facebook/react-native/pull/4483

Reviewed By: svcscm

Differential Revision: D2783425

Pulled By: nicklockwood

fb-gh-sync-id: 1cc67c0741cff3b071530877d688f6b8c1061e3f
2015-12-23 10:07:37 -08:00