Commit Graph

744 Commits

Author SHA1 Message Date
Satyajit Sahoo 0007bff977 Use promises in 'SourceCodeModule'
Summary: Closes https://github.com/facebook/react-native/pull/5504

Reviewed By: svcscm

Differential Revision: D2861158

Pulled By: dmmiller

fb-gh-sync-id: 3e9c257288539183f6156b8d360b54dc570bc7ad
2016-01-25 12:34:31 -08:00
DougBanksPersonal cc30e2b57c Update RCTNavigator.m
Summary:
I am using ReactNative in a hybrid App.

We have a setup like so:

Native Navigation Controller
  Native Tab Controller
    Native View Controller wrapping React
      React Navigation Controller
        React View Controller 1
          React View Controller 2
  Native View Controller 2.

When I pop Native View Controller 2 off the Navigation stack, I get a seg fault on this line:

NSUInteger indexOfFrom = [_currentViews indexOfObject:fromController.navItem];

I believe what's happening:
Your code is listening to Nav Controller transitions, assuming that they are all from React Native Nav Controllers.
You are catching this one instead, which is actually a Native Nav Controller transition.
You start trying to access the pushed/popped view controllers as if they were react native view controllers.

In this case, the view controllers are not react native -> no navItem field -> seg fault.

Solution: if we are catching this transition but it isn't from our react native nav controller, just
Closes https://github.com/facebook/react-native/pull/5495

Reviewed By: svcscm

Differential Revision: D2857473

Pulled By: nicklockwood

fb-gh-sync-id: cc7f0a16e2e0cea56ca9e49bcb87db4ebd3a0905
2016-01-22 17:27:32 -08:00
Nick Lockwood cd2eed0d36 RCTGzipData() acceps nil input, but was not marked as returning nullable output
Reviewed By: milend

Differential Revision: D2854721

fb-gh-sync-id: 336b3261f1694bcc173f267582561c0314c0cea0
2016-01-22 08:40:29 -08:00
Nick Lockwood 36e0dd2d48 Fixed screen size bug on iPhone6+
Summary:
public

This diff fixes a bug in RCTScreenScale() on iPhone6+. The issue was due to the fact that the iPhone6+'s virtual screen resolution of 414x736 points 3x resolution (1242x2208 pixels) does not match its actual screen resolution, which is 1080p (1080x1920 pixels).

I did not realize that `[UIScreen mainScreen].nativeBounds` reports the *actual* resolution, not the virtual resolution, and was dividing by the virtual scale (3.0) instead of the actual native scale factor (2.6).

This only affects iPhone6+, because for all other iOS devices, the virtual resolution matches the native resolution.

Reviewed By: milend

Differential Revision: D2854663

fb-gh-sync-id: bce8965a151e2f005a02a5f6b54f259d01b9ab12
2016-01-22 08:19:36 -08:00
Martín Bigio c4b948f62e Make "Loading from pre-bundle" message more distinctive
Reviewed By: javache

Differential Revision: D2849126

fb-gh-sync-id: 28b42650de3716b43d228e83ede215aaa9098858
2016-01-22 06:57:28 -08:00
Martín Bigio c434893878 Hot Loading should be disabled by default
Summary:
public

Although the feature itself is gated, once the user is on the experiment we want to make sure hot loading starts disabled up until the feature is enabled through the dev menu.

Reviewed By: javache

Differential Revision: D2850070

fb-gh-sync-id: 66e69e152806d3bb01985afe20827e3b9cffeb41
2016-01-21 14:13:59 -08:00
Martin Kralik c14cc123d5 API for cancelling RCTTouchHandler
Reviewed By: spicyj

Differential Revision: D2846573

fb-gh-sync-id: 652864c773d03c24f0d68dd8335401eb052fc1bf
2016-01-21 13:46:52 -08:00
Kyle Corbitt ba4101dc4a Simplified AlertIOS
Summary:
Ok, so this started as fixing #5273 but ended up getting a little more complicated. 😄

Currently, AlertIOS has the following API:

* `alert(title, message, buttons, type)`
* `prompt(title, defaultValue, buttons, callback)`

I've changed the API to look like the following:

* `alert(title, message, callbackOrButtons)`
* `prompt(title, message, callbackOrButtons, type, defaultValue)`

I know that breaking changes are a big deal, but I find the current alert API to be fairly inconsistent and unnecessarily confusing. I'll try to justify my changes one by one:

1. Currently `type` is an optional parameter of `alert`. However, the only reason to change the alert type from the default is in order to create one of the input dialogs (text, password or username/password). So we're in a weird state where if you want a normal text input, you use `prompt`, but if you want a password input you use `alert` with the 'secure-text' type. I've moved `type` to `prompt` so all text input is now done with `pro
Closes https://github.com/facebook/react-native/pull/5286

Reviewed By: svcscm

Differential Revision: D2850400

Pulled By: androidtrunkagent

fb-gh-sync-id: 2986cfa2266225df7e4dcd703fce1e322c12b816
2016-01-21 10:57:26 -08:00
Nick Lockwood 34d5fa2695 RCTUtils Obj-C nullability annotations
Summary:
Add Objective-C nullability annotations to RCTUtils

public

Reviewed By: javache

Differential Revision: D2797331

fb-gh-sync-id: b918179625865760edc8c6fcc189ad78f819f3e3
2016-01-21 07:50:43 -08:00
Nick Lockwood 21fcbbc32c Generalized image decoding and resizing logic
Summary:
public

Standardises the image decoding logic for all image sources, meaning we get the benefits of efficient downscaling of images from all sources, not just ALAssets.

Reviewed By: javache

Differential Revision: D2647083

fb-gh-sync-id: e41456f838e4c6ab709b1c1523f651a86ff6e623
2016-01-20 11:11:13 -08:00
tantan 15f806957f Return a Promise for `Clipboard.getString()`
Summary:
For clipboard, add error callback in Android. Code like
```javascript
Clipboard.getString((content)=>{
    //do something
},(error)=>{
   //do something for error
})
```
Closes https://github.com/facebook/react-native/pull/4792

Reviewed By: svcscm

Differential Revision: D2844937

Pulled By: nicklockwood

fb-gh-sync-id: 19953807ff07238e6a6ef5aedf1a3fcbca7e62a1
2016-01-20 10:54:32 -08:00
Pieter De Baets 1dffd056bf Fix default logger's loglevel, improve default error handler
Reviewed By: majak

Differential Revision: D2834267

fb-gh-sync-id: c89ce5160f03f57409497cc802690c8360d88a4d
2016-01-20 10:28:38 -08:00
Pieter De Baets 8ea9a1bc94 Invalidate JS executor when loading fails
Summary:
This solves https://github.com/facebook/react-native/issues/5090. Since 5b4e873c68 we had better reporting for when calls from native to JS fail. When trying to load an invalid bundle, this would now cause a stackoverflow, since RCTFatal would schedule a JS call to log, which would RCTFatal, which would ...

By invalidating the jsExecutor immediately after loading fails, we prevent any more attempts to log. We can't invalidate the whole bridge at this point since we still need the redbox module to actually display the error.

public

Reviewed By: majak

Differential Revision: D2834251

fb-gh-sync-id: a3e2ad425e40560beae4d3eacb93f66ace5341bf
2016-01-19 14:35:33 -08:00
Dave Miller 0c5f279c9d Standardize Error objects for Promises
Summary:
public

Promises are coming.  And as part of it, we are standardizing the error objects that will be returned.  This puts the code in place on the Android side to always send the proper error format.

It will be an error object like this
  {
    code : "E_SOME_ERROR_CODE_DEFINED_BY_MODULE", // Meant to be machine parseable
    message : "Human readable message",
    nativeError : {} // Some representation of the underlying error (Exception or NSError) , still figuring out exactly, but hopefully something with stack info
  }

Reviewed By: nicklockwood

Differential Revision: D2840128

fb-gh-sync-id: 174d620e2beb53e1fc14161a10fd0479218d98a6
2016-01-19 12:20:37 -08:00
Pieter De Baets c8355d377f Don't register classes only found at runtime
Summary:
This caused issues for me when I tried to provide a native module on init that was also KVO'd (and dynamically subclassed)

On closer inspection, it also seems highly inconsistent to register these classes in DEBUG mode but have them fail silently in production. Reducing the difference between debug and release seems like a safer option.

public

Reviewed By: nicklockwood

Differential Revision: D2819838

fb-gh-sync-id: 79ab72b1152c89eae38c965ff7724aba59a00949
2016-01-19 11:10:32 -08:00
Kyle Corbitt cd89016ee7 PixelRatio.pixel()
Summary:
This implements #5073. It adds a static method `PixelRatio.pixel()` which returns the smallest drawable line width, primarily for use in styles.

It also updates the example apps to use the new function.
Closes https://github.com/facebook/react-native/pull/5076

Reviewed By: svcscm

Differential Revision: D2799849

Pulled By: nicklockwood

fb-gh-sync-id: b83a77790601fe882affbf65531114e7c5cf4bdf
2016-01-15 05:15:31 -08:00
Martín Bigio 0185df57bd Tweak Hot Loading gating code
Reviewed By: mmahoney

Differential Revision: D2815537

fb-gh-sync-id: d0a4d5c2a831c52cf3be6051a348ae9ba996f545
2016-01-14 19:33:34 -08:00
Nick Lockwood e4c53c28ae Improved shadow performance
Summary:
public
React Native currently exposes the iOS layer shadow properties more-or-less directly, however there are a number of problems with this:

1) Performance when using these properties is poor by default. That's because iOS calculates the shadow by getting the exact pixel mask of the view, including any tranlucent content, and all of its subviews, which is very CPU and GPU-intensive.
2) The iOS shadow properties do not match the syntax or semantics of the CSS box-shadow standard, and are unlikely to be possible to implement on Android.
3) We don't expose the `layer.shadowPath` property, which is crucial to getting good performance out of layer shadows.

This diff solves problem number 1) by implementing a default `shadowPath` that matches the view border for views with an opaque background. This improves the performance of shadows by optimizing for the common usage case. I've also reinstated background color propagation for views which have shadow props - this should help ensure that this best-case scenario occurs more often.

For views with an explicit transparent background, the shadow will continue to work as it did before ( `shadowPath` will be left unset, and the shadow will be derived exactly from the pixels of the view and its subviews). This is the worst-case path for performance, however, so you should avoid it unless absolutely necessary. **Support for this may be disabled by default in future, or dropped altogether.**

For translucent images, it is suggested that you bake the shadow into the image itself, or use another mechanism to pre-generate the shadow. For text shadows, you should use the textShadow properties, which work cross-platform and have much better performance.

Problem number 2) will be solved in a future diff, possibly by renaming the iOS shadowXXX properties to boxShadowXXX, and changing the syntax and semantics to match the CSS standards.

Problem number 3) is now mostly moot, since we generate the shadowPath automatically. In future, we may provide an iOS-specific prop to set the path explicitly if there's a demand for more precise control of the shadow.

Reviewed By: weicool

Differential Revision: D2827581

fb-gh-sync-id: 853aa018e1d61d5f88304c6fc1b78f9d7e739804
2016-01-14 14:04:34 -08:00
Nick Lockwood ff6a2c3998 Deprecated `scrollResponderScrollWithoutAnimationTo`
Summary:
public

This diff deprecates `scrollResponderScrollWithoutAnimationTo` and replaces it with an optional `animated` param in `scrollResponderScrollTo`. This is more consistent with our other APIs.

Using the old `ScrollResponder.scrollResponderScrollWithoutAnimationTo` or  `ScrollView.scrollWithoutAnimationTo` functions will still work, but will trigger a warning.

Reviewed By: javache

Differential Revision: D2823479

fb-gh-sync-id: 259966512104ca7b3995c9586144812a91b8d3e9
2016-01-14 07:42:34 -08:00
Gaëtan Renaudeau 963f26cea8 add ScrollResponder#scrollResponderZoomTo animated second argument
Summary:
ScrollResponder was missing a non animated version for zoomToRect.

- scrollResponderScrollTo <> scrollResponderScrollWithoutAnimationTo
- ~~scrollResponderZoomTo <> 🆕 **scrollResponderZoomWithoutAnimationTo**~~
- `scrollResponderZoomTo(rect, animated = true)`
Closes https://github.com/facebook/react-native/pull/5268

Reviewed By: svcscm

Differential Revision: D2823311

Pulled By: nicklockwood

fb-gh-sync-id: ea409d332963f56e8b58ec2c086db3f6815058f7
2016-01-13 02:55:33 -08:00
Nick Lockwood c16095ed85 Fixed border collapse bug
Summary:
public
The fix for border smearing introduced a bug where borders + background would sometimes not be rendered if the view was created at a small size (e.g. zero) and then resized.

This diff fixes that by redrawing the border if the view size changes. There is some opportunity to optimize this in future by performing some logic up-front to detect if the redrawing is necessary, but I thought I'd keep it simple for this bug fix rather than risk introducing further bugs.

Reviewed By: jingc

Differential Revision: D2817365

fb-gh-sync-id: eca164e8ce03a66598677c9e05496791230b5210
2016-01-08 16:15:32 -08:00
Nick Lockwood 7341706884 Disable background color propagation for everything except text nodes
Summary:
public
Blending semitransparent pixels against their background is fairly a fairly expensive operation on mobile GPUs. To reduce blending, React Native has a system called "background color propagation", where the background color of parent views is automatically inherited by child views unless explicitly overridden. This means that translucent pixels can be blended directly against a known background color, avoiding the need to do this dynamically on the GPU.

In practice, this is only useful for views that do their own drawing, which is basically just `<Image/>` and `<Text/>` components, and for image components it only really matters when the image has an alpha component.

The automatic background propagation is a bit of a hack, and often does the wrong thing - for example if a view overflows its bounds, or if it overlaps a sibling, the background color will often be incorrect and need to be manually disabled. Because the only place that it provides a significant performance benefit is for text, this diff disables the behavior for everything except `<Text/>` nodes. It might still be useful for `<Image/>` nodes too, but looking through the examples in UIExplorer, the number of places where it does the wrong thing for images outnumbers the cases where it provides significant reduction in blending.

Note that this diff does not prevent you from eliminating blending on image components by manually setting an opaque background color, nor does it stop you from disabling color propagation on text components by manually setting a transparent background.

Reviewed By: javache

Differential Revision: D2811031

fb-gh-sync-id: 2eb08918c9031c582a3dd2d40e04b27a663dac82
2016-01-08 03:38:31 -08:00
Tadeu Zagallo 473f9bca19 Update createView C function on profiler
Summary:
public

The props argument of the `-[RCTComponentData createView:props:]` method was removed,
but the C function used to swizzle it in the profiler wasn't updated.

Reviewed By: majak

Differential Revision: D2811228

fb-gh-sync-id: 8896638c77370142e29913b5fb80e7fd748254b5
2016-01-07 12:03:38 -08:00
Pieter De Baets 0fa1f8d94f Fix extra native modules missing bridge after reload
Summary:
public

Since we don't actually recreate our native modules every time (will fix in follow-up), we'd never update the reference after reloading the bridge, and all navigation would fail.

Reviewed By: majak

Differential Revision: D2811406

fb-gh-sync-id: 4f4fd73bbdecfe510e1e1554668b2354181f22a8
2016-01-07 12:03:28 -08:00
Nick Lockwood b115277d00 Fixed border smearing issue
Summary:
public
The iOS border rendering code did not follow the CSS spec in cases where the sum of adjacent border radii was greater than the width of the view, resulting in drawing glitches such as pixel smear and borders appearing stretched or squashed.

This diff brings our implementation closer to spec-compliance in these cases. I also fixed a longstanding issue with ghostly diagonal lines appearing at the corners due to antialiasing rounding errors!

Fixes

https://github.com/facebook/react-native/issues/1572
https://github.com/facebook/react-native/issues/2089
https://github.com/facebook/react-native/issues/4604

Reviewed By: tadeuzagallo

Differential Revision: D2811249

fb-gh-sync-id: c3dd2721e0a01a432fa4dc78daa05680595edd08
2016-01-07 12:03:17 -08:00
Nick Lockwood 571e646543 Improved null url handling
Summary:
public
Attempting to load an undefined URL via XMLHttpRequest produced a confusing error deep within the network layer. This diff improves the networking stack to catch such errors earlier, and also adds a helpful error in the JS layer.

Fixes https://github.com/facebook/react-native/issues/4558

Reviewed By: javache

Differential Revision: D2811080

fb-gh-sync-id: 1837427e1080a0308f2c4f9a8a42bce2e041fb48
2016-01-07 04:00:38 -08:00
Nick Lockwood 23cd9febbc Fixed deadlock in RCTModuleData
Summary:
public
Fixed a potential deadlock issue if code attempted to access a module via [bridge moduleForName/Class:] while it was being initialized.

Reviewed By: lry

Differential Revision: D2807827

fb-gh-sync-id: 58cafe9b92c094dde632d17245fb9b342a0fe9e0
2016-01-07 01:30:30 -08:00
Martín Bigio 9037d374e1 Remove Hot Loading option from Dev Menu
Reviewed By: jingc

Differential Revision: D2810788

fb-gh-sync-id: cda3b802ee2b744b76253ec48bbd0c6e45c36d9f
2016-01-06 22:37:32 -08:00
Martín Bigio 0f9c88514c Remove `hot` query string attribut when HL is disabled
Summary:
public

By doing this we fix 2 problems:

1. We use the same url, both the first time the simulator starts with Hot Loading disabled (no `hot` attribute), and after HL has been enabled and then disabled ('hot=false'). By doing so, the packager will rebuild more than one bundle as file changes. We could have ignored this attribute on the packager but I'd rather not contaminate the server with it and instead make the clients send only 2 types of URLs.

2. The code on `RCTBatchedBridge.m` that decides whether or not to enable HMR does so by looking at presence of the query string parameter `hot`. If the parameter is present, even when it's false, it will try to enable HL, which is wrong.

Reviewed By: nicklockwood

Differential Revision: D2807512

fb-gh-sync-id: 728b680c2383c328d8967d34c10e7a6288e455ac
2016-01-06 11:55:33 -08:00
Quentin Valmori 3d0ff69e40 Map follow user location
Summary:
Fix #3105

It's the same PR as #3119 but as I force-pushed in my branch, I can't reopen the PR. I added an example.
![capture d ecran 2016-01-05 a 07 15 37](https://cloud.githubusercontent.com/assets/1107936/12108841/2727f504-b37c-11e5-8250-b53785930aba.png)
Closes https://github.com/facebook/react-native/pull/5126

Reviewed By: svcscm

Differential Revision: D2803052

Pulled By: nicklockwood

fb-gh-sync-id: 2e8978ff1b293d699462a8290b45fa74cc16b4dd
2016-01-06 11:00:34 -08:00
Pieter De Baets 435efadbba Re-enable testUnderlyingBridgeIsDeallocated
Reviewed By: jspahrsummers

Differential Revision: D2803543

fb-gh-sync-id: d62b68b1e23fad2a0b3d4e490459b1f38ca2dca1
2016-01-06 09:03:33 -08:00
Nick Lockwood 17df595e32 Implement Android's dispatchViewManagerCommand interface on iOS
Summary:
public
Android implement ViewManager methods via a dispatch method on UIManager, whereas iOS implements them by exposing the methods on the view manager modules directly.

This diff polyfills Android's implementation on top of the iOS implementation, allowing the same JS API to be used for both.

Reviewed By: javache

Differential Revision: D2803020

fb-gh-sync-id: 0da0544e593dc936467d16ce957a77f7ca41355b
2016-01-06 05:58:37 -08:00
Nick Lockwood 180fc06b7a Fixed iOS 7 support for URL query functions
Summary:
public
Unfortunately, it turns out that NSURLComponents.queryItems only works on iOS 8 and above. This diff re-implements the RCTGetURLQueryParam and RCTURLByReplacingQueryParam functions using functionality available in iOS 7.

Reviewed By: javache

Differential Revision: D2803679

fb-gh-sync-id: 56f10bef4894d16197975b6023b7aa5ab106d8cb
2016-01-05 12:57:44 -08:00
Nick Lockwood af24619592 Increased RCTInlineValueThreshold for asynclocalstorage
Reviewed By: tadeuzagallo

Differential Revision: D2641694

fb-gh-sync-id: e35df5408730ce9ec267cbeeb556f8eba154df1f
2016-01-05 10:01:32 -08:00
Nick Lockwood fc98956b65 Fix race conditions in RCTModuleData
Summary:
public
The logic inside RCTBatchedBridge contained some race conditions that would occasionally cause an error if modules were loaded in the wrong order. This improves that logic and makes it safer by adding a lock to prevent concurrency.

Reviewed By: jspahrsummers

Differential Revision: D2802930

fb-gh-sync-id: d1ad25fa578649363dcaac029cb24dc3a453ae67
2016-01-05 09:04:31 -08:00
Justin Spahr-Summers a5d82c2823 Add context executor API for sync hooks
Summary:
public

This exposes a proper API for adding synchronous callbacks to JS, as an optional feature of the executor.

This is based on nicklockwood's work in D2764492, but avoids refactoring bridge/executor interactions for the time being, since we agree on this API and can move the actual callsites around later.

Reviewed By: nicklockwood

Differential Revision: D2799506

fb-gh-sync-id: af209d9a0be927f3404205feb16e59745cc37aec
2016-01-05 08:00:38 -08:00
Fada Chen 18cdead76b revert D2773664
Reviewed By: dwitte

Differential Revision: D2802582

fb-gh-sync-id: 39d59be297f0f23e6a4e40175ad30284766349cb
2016-01-04 23:52:51 -08:00
Tadeu Zagallo 89ae0e040d Expose flow events to JS + add JS -> Native flows
Summary:
public

Expose JS hooks to create flow events in systrace (the nice arrows to show async work flow) +
add support to the showing all the work enqueued from the JS thread as added in D2743733

Depends on D2743733

Reviewed By: jspahrsummers

Differential Revision: D2773664

fb-gh-sync-id: 4a8854b17b4741b882f5f2cc425e4237a5e4b3eb
2016-01-04 11:11:48 -08:00
Nick Lockwood ed4478a4ff Refactor hot loading implementation on iOS
Reviewed By: milend

Differential Revision: D2795580

fb-gh-sync-id: ad33ba152e40b622b10bfa0122afd6edc28a11bf
2016-01-04 10:40:32 -08:00
Janic Duplessis 44f7a00e95 Cross platform PullToRefreshView component
Summary:
Both iOS and Android currently support some sort of native pull to refresh control but the API was very different. I tried implementing a component based on PullToRefreshViewAndroid but that works on both platforms.

I liked the idea of wrapping the ListView or ScrollView with the PullToRefreshView component and allow styling the refresh view with platform specific props if needed. I also like the fact that 'refreshing' is a controlled prop so there is no need to keep a ref to the component or to the stopRefreshing function.

It is a pretty rough start so I'm looking for feedback and ideas to improve on the API before cleaning up everything.

On iOS we could probably deprecate the onRefreshStart property of the ScrollView and implement the native stuff in a PullToRefreshViewManager. We could then add props to customize the look of the UIRefreshControl (tintColor). We could also deprecate the Android only component and remove it later.
Closes https://github.com/facebook/react-native/pull/4915

Reviewed By: svcscm

Differential Revision: D2799246

Pulled By: nicklockwood

fb-gh-sync-id: 75872c12143ddbc05cc91900ab4612e477ca5765
2016-01-04 08:00:29 -08:00
Jason Brown b8aac8b77a Implement draggable annotations on MapView. Closes #2512
Summary: Closes https://github.com/facebook/react-native/pull/4441

Reviewed By: svcscm

Differential Revision: D2707897

Pulled By: nicklockwood

fb-gh-sync-id: 6f67f711c1ec1f821d03b9b1ea5cc39859d28fd1
2016-01-04 06:38:30 -08:00
Nick Lockwood 64edddadcc Fixed race condition in RCTModuleData.methodQueue
Summary:
public
The implementation of the `methodQueue` lazy initializer in `RCTModuleData` could result in the queue being set twice, because calling `methodQueue` for a module that hasn't been instantiated would call `RCTModuleData.instance` to create the module, which itself calls `methodQueue`.

It's not clear if this was causing a bug, but it may be related to an occasional bug where the `RCTViewManager.methodQueue` returns nil.

Reviewed By: majak

Differential Revision: D2783320

fb-gh-sync-id: 9194da0fd7392f63825da1f5c450363dd300b635
2016-01-04 06:24:28 -08:00
Jed Lau 52220a96f9 Export method to get current status bar height
Summary:
Addresses #2515 .
Closes https://github.com/facebook/react-native/pull/5039

Reviewed By: svcscm

Differential Revision: D2799224

Pulled By: nicklockwood

fb-gh-sync-id: 8f0a0f229a1588b1033b0121868c1f82e4dc6684
2016-01-04 04:31:26 -08:00
Mike Armstrong e42c6d4446 Flows between RN Threads
Reviewed By: tadeuzagallo

Differential Revision: D2743733

fb-gh-sync-id: df4ae69a3501a37e08286857a8d4be3cd27c0ac3
2016-01-04 02:16:31 -08:00
Nick Lockwood d7ad393f22 Fix unused argument warnings
Reviewed By: milend

Differential Revision: D2795407

fb-gh-sync-id: 83f5cc10b115eef3becb4ebab56b366f1a12a3ad
2015-12-30 14:16:29 -08:00
Martín Bigio 5f850fbede Pipe `platform` and `bundleEntry` through WebSocket connection
Reviewed By: vjeux

Differential Revision: D2793572

fb-gh-sync-id: 6ce2467b8d528d1a91c1b4fc51741f2502674022
2015-12-29 18:25:28 -08:00
Martin Bigio 041b1c5e52 Add `RCTBundleURLProcessor` files to Xcode project
Summary: Closes https://github.com/facebook/react-native/pull/5028

Reviewed By: svcscm

Differential Revision: D2793266

Pulled By: martinbigio

fb-gh-sync-id: 6d9ca5bf0391a47d25948ce29282f21c0930db3a
2015-12-29 11:05:42 -08:00
Martín Bigio e43e2146d9 Gate Hot Loading
Summary:
public

Until we support this fature on OSS, don't show the menu option.

Reviewed By: vjeux

Differential Revision: D2791198

fb-gh-sync-id: 11b66d467c1ab784bbf549b893d0a3abd69e2741
2015-12-28 16:45:07 -08:00
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 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