Commit Graph

1575 Commits

Author SHA1 Message Date
glevi@fb.com 5ec1d354c2 Deploy v0.21.0
Reviewed By: jeffmo

Differential Revision: D2888689

fb-gh-sync-id: fe94e50c7872b9a1344a054acccab365d385f6ed
2016-02-01 17:13:35 -08:00
Gaëtan Renaudeau 9506e5afc7 add animated param in ListView#scrollTo
Summary:
Since scrollTo(x,y,**animated**) params has been introduced, it was not backported to ListView scrollTo method.
Closes https://github.com/facebook/react-native/pull/5661

Reviewed By: svcscm

Differential Revision: D2886049

Pulled By: nicklockwood

fb-gh-sync-id: 016e92beadc7f397be77b8c58dc572119f873556
2016-02-01 14:53:11 -08:00
Jelle van den Hooff debcac59d0 iOS websocket: include cookies with request
Summary:
This PR modifies the Websocket implementation on iOS to pass cookies to the server. Sending cookies is useful for clients that wish to access protected Websocket endpoints without creating a new authentication protocol.
Closes https://github.com/facebook/react-native/pull/5630

Reviewed By: svcscm

Differential Revision: D2881815

Pulled By: martinbigio

fb-gh-sync-id: 31c1640626cd15447bdb4f2058ae4e34dfa52f88
2016-02-01 14:19:32 -08:00
Christopher Chedeau 1491668b35 ColorPropTypes support for isRequired and more precise description
Summary:
The previous implementation of ColorPropType was very hacky as it used `ReactPropTypes.oneOfType([colorValidator, ReactPropTypes.number])`. It turns out that oneOfType also accepts arbitrary functions instead of a type, but doesn't display any of the error message.

In this diff I properly implement isRequired (sadly we don't export `createChainableTypeChecker` in ReactPropTypes) and provide a lot more context that we have. I copy and pasted the way we displayed this context from the existing checkers.

**Test Plan**

When doing .isRequired and do not provide the value:

![simulator screen shot feb 1 2016 9 56 00 am](https://cloud.githubusercontent.com/assets/197597/12726239/61243f88-c8cb-11e5-889b-6594ffd85973.png)

When providing a bad value:

![simulator screen shot feb 1 2016 10 01 25 am](https://cloud.githubusercontent.com/assets/197597/12726244/6e80aa36-c8cb-11e5-9bd3-a8637de75496.png)
Closes https://github.com/facebook/react-native/pull/5671

Reviewed By: svcscm

Differential Revision: D2886760

Pulled By: vjeux

fb-gh-sync-id: d6be42b5768fca5463fe80fe4b144506d21b0832
2016-02-01 12:47:32 -08:00
Martín Bigio 36efbc341d Hot Loading Indicators
Summary:
public

Introduce a header bar similar to the one shown when loading the bundle to indicate that the packager server is processing an HMR update. Hook into HMR events to show this bar when appropriate.

Reviewed By: javache

Differential Revision: D2873521

fb-gh-sync-id: a77cbb2368b75b045aa8c6ababce2f731baf514b
2016-02-01 12:42:33 -08:00
Michael Tostenson 80a2f5d50f Add headers prop to Android WebViews
Summary:
Related to [issue #5418](https://github.com/facebook/react-native/issues/5418)

This is a follow-up to [this previous pull request.](https://github.com/facebook/react-native/pull/5419)

~~Adds a new ReactProp 'urlWithHeaders' to Android WebViews that takes an object with a 'url' string and a 'headers' map.~~

[Update] Adds a new prop 'source' to Android WebViews
```
{
   html: string,
   url: string,
   headers: map<string, string>,
}
```

Update: resolves TODO 8495359
Closes https://github.com/facebook/react-native/pull/5494

Reviewed By: svcscm

Differential Revision: D2881313

Pulled By: nicklockwood

fb-gh-sync-id: 7cad8490d4932d0a7ef559165f3ec279d873c537
2016-02-01 10:06:35 -08:00
Nick Lockwood ee30433b76 Update Android's ScrollView.scrollTo API to match JS/iOS
Summary:
public
We recently updated the `ScrollResponder.scrollResponderScrollTo` method to accept an `animated` argument, and deprecated the `scrollResponderScrollWithoutAnimationTo` method. This change was reflected in the native iOS implementation, but not on Android.

This diff updates the Android ScrollViewManager implementation to match the JS API, and removes the platform-specific fork in the JS code.

Reviewed By: dmmiller

Differential Revision: D2883515

fb-gh-sync-id: e5a0e1cf470e21af837b2311cf1048162ac3aff5
2016-02-01 04:04:35 -08:00
Christopher Chedeau bee6988f94 Temporarily allow decimals on rgb() and rgba()
Summary:
Animating colors using Animated is currently interpolating rgb and rgba and doesn't round the intermediate values. We need to fix it there but it's not a straightforward change so reverting to the lax version here until we fix it inside of Animated (which is needed to work on web anyway).
Closes https://github.com/facebook/react-native/pull/5654

Reviewed By: svcscm

Differential Revision: D2885051

Pulled By: vjeux

fb-gh-sync-id: dab69b1da11131c9fab2fd08c434c73ec93d59d2
2016-01-31 22:46:38 -08:00
Dotan J. Nahum 5712e0c3eb Typo: Change WebWiew to WebView
Summary: Closes https://github.com/facebook/react-native/pull/5648

Reviewed By: svcscm

Differential Revision: D2884296

Pulled By: androidtrunkagent

fb-gh-sync-id: 50340c0fc06926fbb3dc41c3078aa985ff48ccd3
2016-01-31 08:41:33 -08:00
Martin Konicek 679beb2a3a Tweak docs before releasing 0.19
Reviewed By: mkonicek

Differential Revision:D2883844
Ninja: Only docs and React Native website, doesn't affect any fb apps

fb-gh-sync-id: 4bf56dc695224f172832ca5381cebceab9e5fe4f
2016-01-30 17:11:28 -08:00
Nick Lockwood 9d0242fdc3 Replace direct access of NativeModules.UIManager with require('UIManager')
Summary:
public
Due to the cross-platform polyfills we have added (and will add in future) to `UIManager.js`, accessing UIManager directly via NativeModules instead of importing the wrapper is discouraged.

This diff fixes a few places where we were doing this inside our own modules.

Note: As a general policy, we should avoid accessing modules via NativeModules anyway. Using wrapper classes allows us to provide static declarations for all the native methods and properties, which can be checked at build time by flow. If we access the modules directly, those interfaces are only known at runtime.

Reviewed By: vjeux

Differential Revision: D2881300

fb-gh-sync-id: 6737358ea8ea6d722cc1941a4b9fa0123a87fc29
2016-01-30 07:36:34 -08:00
Christopher Chedeau c8a0a3eff6 Reimplement color processing
Summary:
**Problem:**

As I was trying to document what color formats we supported, I realized that our current implementation based on the open source project tinycolor supported some crazy things. A few examples that were all valid:

```
tinycolor('abc')
tinycolor(' #abc ')
tinycolor('##abc')
tinycolor('rgb 255 0 0')
tinycolor('RGBA(0, 1, 2)')
tinycolor('rgb (0, 1, 2)')
tinycolor('hsv(0, 1, 2)')
tinycolor({r: 10, g: 10, b: 10})
tinycolor('hsl(1%, 2, 3)')
tinycolor('rgb(1.0, 2.0, 3.0)')
tinycolor('rgb(1%, 2%, 3%)')
```

The integrations of tinycolor were also really bad. processColor added "support" for pure numbers and an array of colors!?? ColorPropTypes did some crazy trim().toString() and repeated a bad error message twice.

**Solution:**

While iteratively cleaning the file, I eventually ended up reimplementing it entierly. Major changes are:
- The API is now dead simple: returns null if it doesn't parse or returns the int32 representation of the color
- Stricter parsing of at
Closes https://github.com/facebook/react-native/pull/5529

Reviewed By: svcscm

Differential Revision: D2872015

Pulled By: nicklockwood

fb-gh-sync-id: df78244eefce6cf8e8ed2ea51f58d6b232de16f9
2016-01-29 09:13:32 -08:00
Christoph Jerolimov cb874a55aa Add MapView annotation callback when it gets / lost the focus
Summary:
For my project it was required to receive a notification when the MapView annotation was deselected.

So I renamed `onAnnotationPress` to `onAnnotationSelected` and added a new method `onAnnotationDeselected`, this names was "inspired" by the underlaying iOS API. The old API was still called and marked as deprecated.

But maybe you have an idea for a better naming (onAnnotationFocus/-Blur?) -- or should a deselected call the press method again without an annotation (undefined)?
Closes https://github.com/facebook/react-native/pull/5167

Reviewed By: svcscm

Differential Revision: D2869695

Pulled By: nicklockwood

fb-gh-sync-id: 91795ac3f1e4533b250af8901534d8870729d9db
2016-01-29 06:26:30 -08:00
Martin Konicek 1dd5ba7021 Add a cross-platform Picker
Summary:
The basic API is consistent with iOS; there are several platform-specific props.

Also fixed the flickering when a value is selected.

public

Reviewed By: bestander

Differential Revision: D2871092

fb-gh-sync-id: f5cdf6858cb7344b28ee46954cb6b0a3b144b646
2016-01-29 03:59:54 -08:00
Janic Duplessis 1c6e837504 Add a deprecatedPropType module to show deprecation warnings
Summary:
To allow smoother API changes for users we often deprecate props and keep them around for a while before removing them. Right now it is all done manually, this adds a consistent way to show a warning when using a deprecated prop.

This also adds a deprecation warning of the website generated from the deprecatedPropType.

<img width="643" alt="screen shot 2016-01-26 at 7 43 08 pm" src="https://cloud.githubusercontent.com/assets/2677334/12600172/7af28fb0-c465-11e5-85e5-3786852bf522.png">

It also changes places where we added the warnings manually to use deprecatedPropType instead.
Closes https://github.com/facebook/react-native/pull/5566

Reviewed By: svcscm

Differential Revision: D2874629

Pulled By: nicklockwood

fb-gh-sync-id: c3c63bae7bbec26cc146029abd9aa5efbe73f795
2016-01-29 02:05:38 -08:00
Kudo Chien 8de86a0d65 Add onPageScrollStateChanged for ViewPagerAndroid
Summary:
I have an issue when combining `PullToRefreshViewAndroid` and `ViewPagerAndroid`.
`ViewPagerAndroid` will not able to scroll that gesture handler is being taken by `PullToRefreshViewAndroid`
One solution is to disable `PullToRefreshViewAndroid` if `ViewPagerAndroid` is scrolling (i.e. not idle).
[Reference solution here](http://stackoverflow.com/a/29946734/2590265)

So here need to expose the `onPageScrollStateChanged` event.
Some code referenced from  DrawerLayoutAndroid, especially the `VIEWPAGER_PAGE_SCROLL_STATES` array.
Please feel free give me comments.
Thanks.
Closes https://github.com/facebook/react-native/pull/5026

Reviewed By: svcscm

Differential Revision: D2830623

Pulled By: andreicoman11

fb-gh-sync-id: c2a6920c6f4c7daab0115f13864db83b93b31abf
2016-01-29 01:17:35 -08:00
Christopher Chedeau 54e5033221 More helpful description for native-js prop mismatch
Summary:
A lot of people see this error and end up posting in our support group. The root cause is that their js and native versions are out of sync. Adding a helpful description here will unblock them on their own.
Closes https://github.com/facebook/react-native/pull/5605

Reviewed By: svcscm

Differential Revision: D2878376

Pulled By: martinbigio

fb-gh-sync-id: 10dedbdbb4bee3fce5119367223ebb42a3c1b6a4
2016-01-28 20:14:34 -08:00
Wenjing Wang b55dcbe0af Fix CPU spike: should use UIGraphicsEndImageContext rather than UIGraphicsGetCurrentContext
Summary:
should use UIGraphicsEndImageContext rather than UIGraphicsGetCurrentContext

public

Reviewed By: nicklockwood, chaceliang

Differential Revision: D2875657

fb-gh-sync-id: 0fa059e2da3d0bb1ffe5fe50a1bdaeddafc2bbfa
2016-01-28 14:25:35 -08:00
Jan Kassens 4a226fc1af Add guard to ErrorUtils mock
Summary:
This method is defined in the implementation but is missing from the mock.

public

Reviewed By: cpojer

Differential Revision: D2875173

fb-gh-sync-id: 6544c34a3d707ff9cecacc0608ab8320b950bfb7
2016-01-28 12:08:50 -08:00
August Flanagan 0f7477f9f9 add flag to enable momentum scrolling on iOS
Summary:
Expose a `decelerationNormalEnabled` flag on WebView, which, when enabled, will WebView's ScrollView's `decelerationRate` to `UIScrollViewDecelerationRateNormal`. This gives the WebView the same "momentum" style scrolling as other iOS views.

This was discussed with ide in #5447. Please let me know if there's anything I'm missing, or anything else you'd like to see in this pull request.
Closes https://github.com/facebook/react-native/pull/5527

Reviewed By: svcscm

Differential Revision: D2870312

Pulled By: nicklockwood

fb-gh-sync-id: 7dbfd06a349e3365a5df40c3bacf25a4fdb306cf
2016-01-28 05:36:33 -08:00
Tim Yung 23f772061d RN: Update / Fix PixelRatio Manual Mock
Reviewed By: cpojer

Differential Revision: D2872990

fb-gh-sync-id: 34c644ec79b424954a14e049b996c658f6b69610
2016-01-27 18:27:06 -08:00
Christopher Chedeau 2529179769 Remove min/max Width/Height in the docs
Summary:
An initial implementation was done on css-layout but isn't working correctly on many cases. The binding from React Native has been removed a long time ago. Let's not confuse people and remove it from the docs :)
Closes https://github.com/facebook/react-native/pull/5522

Reviewed By: svcscm

Differential Revision: D2859665

Pulled By: vjeux

fb-gh-sync-id: 4aa008dd93a6cea6b79a7bce444c94148791eee4
2016-01-27 18:26:56 -08:00
Martín Bigio c56f280af2 Disable Flow on Packager
Reviewed By: frantic

Differential Revision: D2870105

fb-gh-sync-id: c95db83e40b3558c53614b08240a5361c14e0e6c
2016-01-27 15:33:31 -08:00
Martín Bigio f2438b440d Hot Loading Sourcemaps
Summary:
public

To make sourcemaps work on Hot Loading work, we'll need to be able to serve them for each module that is dynamically replaced. To do so we introduced a new parameter to the bundler, namely `entryModuleOnly` to decide whether or not to process the full dependency tree or just the module associated to the entry file. Also we need to add `//sourceMappingURL` to the HMR updates so that in case of an error the runtime retrieves the sourcemaps for the file on which an error occurred from the server.

Finally, we need to refactor a bit how we load the HMR updates into JSC. Unfortunately, if the code is eval'ed when an error is thrown, the line and column number are missing. This is a bug/missing feature in JSC. To walkaround the issue we need to eval the code on native. This adds a bit of complexity to HMR as for both platforms we'll have to have a thin module to inject code but I don't see any other alternative. when debugging this is not needed as Chrome supports sourceMappingURLs on eval'ed code

Reviewed By: javache

Differential Revision: D2841788

fb-gh-sync-id: ad9370d26894527a151cea722463e694c670227e
2016-01-27 14:55:36 -08:00
Andreas Drivenes b85a52a461 Update Image docs and examples to the new asset system
Summary:
After the release of 0.14, static images should be placed in the source code tree and then required as explained in the [Images guide] (https://facebook.github.io/react-native/docs/images.html). This pull request updates the image documentation and examples to the new asset system. UIExplorer tested on iOS and Android.
Closes https://github.com/facebook/react-native/pull/4987

Reviewed By: svcscm

Differential Revision: D2796276

Pulled By: bestander

fb-gh-sync-id: 732ffa2f136391bb8a3e40a54b5b1ff5022c97f2
2016-01-27 13:47:45 -08:00
Konstantin Raev 1d819e9503 Open sourced <ImageEditor>, <ImageStore> for Android
Reviewed By: mkonicek

Differential Revision: D2869751

fb-gh-sync-id: 862c266601dd83ca3bf9c9bcbf107f7b17b8bdfd
2016-01-27 10:50:54 -08:00
Jean Regisser b84f5fb6c9 Added iOS indicatorStyle prop to ScrollView
Summary:
Hi,

The doc wording was adapted from https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIScrollView_Class/#//apple_ref/doc/c_ref/UIScrollViewIndicatorStyle

Note that the iOS doc is misleading, and `UIScrollViewIndicatorStyleDefault` is the same as `UIScrollViewIndicatorStyleBlack` (since iOS 7 I think).

Let me know what you think.
Closes https://github.com/facebook/react-native/pull/5583

Reviewed By: svcscm

Differential Revision: D2870011

Pulled By: nicklockwood

fb-gh-sync-id: d28a96e1a2d4610cbeaee0ae70108ab9d9f05fdb
2016-01-27 10:16:33 -08:00
Nick Lockwood f685878938 Improved 3D touch implementation, and added example
Summary:
public
This diff improves the implementation of 3D touch by adding a `forceTouchAvailable` constant to View that can be used to check if the feature is supported.

I've also added an example of how you can use the `force` property of the touch event to measure touch pressure in React Native.

Reviewed By: vjeux

Differential Revision: D2864926

fb-gh-sync-id: 754c54989212ce4e4863716ceaba59673f0bb29d
2016-01-27 09:05:36 -08:00
Satyajit Sahoo e33e6ab1f0 Add cross-platform Linking module
Summary:
A promise based API for handling Link for Android and iOS. Refer #4971

The iOS part doesn't handle errors. Will need someone with iOS knowledge to do that.

cc skevy ide brentvatne mkonicek vjeux nicklockwood
Closes https://github.com/facebook/react-native/pull/5336

Reviewed By: svcscm

Differential Revision: D2866664

Pulled By: androidtrunkagent

fb-gh-sync-id: 67e68a827e6b85886bfa84e79b897f079e78b1b5
2016-01-26 14:34:31 -08:00
Jed Lau affd6230fe self -> this in ScrollResponder
Summary:
I *think* this is causing a crash for me in a release build (curiously, not a debug build):
```
ReferenceError: Can't find variable: self
```

I saw this in 0.18.1, which I assume was renamed to v0.19.0-rc.
Closes https://github.com/facebook/react-native/pull/5562

Reviewed By: svcscm

Differential Revision: D2866491

Pulled By: androidtrunkagent

fb-gh-sync-id: 196f718bf807c5eef676f66f1e15d7bde9475d5b
2016-01-26 14:23:32 -08:00
Martin Konicek 9a0539d2c4 Open source Android date and time pickers
Reviewed By: bestander

Differential Revision: D2856486

fb-gh-sync-id: 0bb81136289e2f121387649765ba682103e4701b
2016-01-26 10:31:17 -08:00
Hedger Wang 1edcf4c6ac Disable navigation bar right button when it's transparent.
Reviewed By: chaceliang

Differential Revision: D2863157

fb-gh-sync-id: ca73545303607333fe32cd8e2e8f040134ee1d24
2016-01-26 01:28:34 -08:00
Alex Kotliarskyi c1aed7ba41 Fix warnings generated by Elements Inspector
Summary:
public

When using dev menu - elements inspector, a yellow box appears
with React warning regarding missing key prop in elements array.
This commit fixes this issue.

Reviewed By: martinbigio

Differential Revision: D2835332

fb-gh-sync-id: 3fcb37dfb6bdcff3788963b36416b7da190b9a84
2016-01-25 18:43:47 -08:00
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
asmockler dad462258f Ensure perspective value is non-zero
Summary:
Setting `transform: {perspective: 0}` was causing app failure due to `NaN` produced by divide by zero in [MatrixMath.js](96553cf553/Libraries/Utilities/MatrixMath.js (L118)).

See issue #2616
Closes https://github.com/facebook/react-native/pull/5457

Reviewed By: svcscm

Differential Revision: D2851748

Pulled By: bestander

fb-gh-sync-id: d2872fb73b4d95ba0b6e5ed2bee814158645cf73
2016-01-25 06:01:53 -08:00
Nick Lockwood 481f560f64 Added support for auto-resizing text fields
Summary:
public
This diff adds support for auto-resizing multiline text fields. This has been a long-requested feature, with several native solutions having been proposed (see https://github.com/facebook/react-native/pull/1229 and D2846915).

Rather than making this a feature of the native component, this diff simply exposes some extra information in the `onChange` event that makes it easy to implement this in pure JS code. I think this is preferable, since it's simpler, works cross-platform, and avoids any controversy about what the API should look like, or how the props should be named. It also makes it easier to implement custom min/max-height logic.

Reviewed By: sahrens

Differential Revision: D2849889

fb-gh-sync-id: d9ddf4ba4037d388dac0558aa467d958300aa691
2016-01-25 05:46:29 -08:00
Noam Bartov f68281a0d8 added support for overlayColor property for image
Summary:
In Android, Fresco's default rounding corners support mode is BITMAP_ONLY which doesn't work in all cases (such as animated GIF's, some scale types, etc.).
Specifying the new "overlayColor" property on an Image will cause Fresco to switch to the other rounding corners mode, OVERLAY_COLOR, and will draw rounded corners by overlaying the solid color specified.

Fresco's behaviour is explained here: http://frescolib.org/docs/rounded-corners-and-circles.html
Closes https://github.com/facebook/react-native/pull/5366

Reviewed By: svcscm

Differential Revision: D2854696

Pulled By: mkonicek

fb-gh-sync-id: 251701ee8a64acbfc22694e9d4661c40eef75725
2016-01-24 14:00:39 -08:00
Christopher Dro 2b309a426a Updates to Text & IntentAndroid
Summary: Closes https://github.com/facebook/react-native/pull/5496

Reviewed By: svcscm

Differential Revision: D2858772

Pulled By: androidtrunkagent

fb-gh-sync-id: 5edf52af256efe6bb7ae1f8bcc2622d7e6a1298c
2016-01-23 11:01:33 -08:00
Elliot Hesp f644af34ef Correctly bind Touchable.js setTimeout
Summary:
Fixes https://github.com/facebook/react-native/issues/5337

`this.setTimeout` is undefined and the scope wasn't being passed through causing a RedBox error.
Closes https://github.com/facebook/react-native/pull/5376

Reviewed By: svcscm

Differential Revision: D2838623

Pulled By: androidtrunkagent

fb-gh-sync-id: 513210298b6c39d812047a03d8f2edd5c11e46f6
2016-01-22 14:45:35 -08:00
David Aurelio a0c5fb99a0 Backout "Use numeric identifiers when building a bundle"
Summary:
public

The reverted change doesn’t play nice with inline requires, let’s revert it for now.
I will bring it back after fixing it or adapting inline requires

Reviewed By: martinbigio

Differential Revision: D2854771

fb-gh-sync-id: 32fdbf8ad51240a9075b26502decb6328eed4b29
2016-01-22 11:39:30 -08:00
Nick Lockwood 2cbc912756 Added support for width & height for text images
Summary:
public

Previously, `<Image>` elements embedded inside `<Text>` ignored all style attributes and props apart from `source`. Now, the `width`, `height` and `resizeMode` styles are observed. I've also added a transparent placeholder to be displayed while the image is loading, to prevent the layout from changing after the image has loaded.

Reviewed By: javache

Differential Revision: D2838659

fb-gh-sync-id: c27f9685b6976705ac2b24075922b2bf247e06ba
2016-01-22 11:32:32 -08:00
Sokovikov c2d75d7a65 Android AppState
Summary: Closes https://github.com/facebook/react-native/pull/5152

Reviewed By: svcscm

Differential Revision: D2850250

Pulled By: mkonicek

fb-gh-sync-id: 0b5063fa7121d4e304a70da8573c9ba1d05a757c
2016-01-21 11:47:21 -08:00
Huang Yu f453e14c8f Fix StyleSheet 'textAlign' for AndroidTextInput. Closes #2702
Summary:
change `setTextAlign` and `setTextAlignVertical` to receive argument of type `String` (the same as in `StyleSheet`), so that native props and stylesheet props are calling the same ReactMethod

- add demo (may not be necessary)
Closes https://github.com/facebook/react-native/pull/4481

Reviewed By: svcscm

Differential Revision: D2823456

Pulled By: mkonicek

fb-gh-sync-id: 349d17549f419b5bdc001d70b583423ade06bfe8
2016-01-21 11:08:34 -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
David Aurelio cb4fca3590 Use numeric identifiers when building a bundle
Summary:
public

Since the combination of node and haste modules (and modules that can be required as both node and haste module) can lead to situations where it’s impossible to decide an unambiguous module identifier, this diff switches all module ids to integers. Each integer maps to an absolute path to a JS file on disk.

We also had a problem, where haste modules outside and inside node_modules could end up with the same module identifier.

This problem has not manifested yet, because the last definition of a module wins. It becomes a problem when writing file-based unbundle modules to disk: the same file might be written to concurrently, leading to invalid code.

Using indexed modules will also help indexed file unbundles, as we can encode module IDs as integers rather than scanning string IDs.

Reviewed By: martinbigio

Differential Revision: D2842418

fb-gh-sync-id: 97addd28e964ac5f2b5081dcd3f36124d2864df8
2016-01-21 10:37:15 -08:00
David Aurelio 2902701566 Remove now unnecessary tweaking of global
Summary:
public

When we were debugging in the main window JS context in Chrome, the global environment had to be tweaked so that DOM features wouldn’t be detected.

Since we switched to debugging within a web worker, we don’t need to do this tweaks any more.

Reviewed By: bestander

Differential Revision: D2850239

fb-gh-sync-id: 886f2f7ac5c579c3fd4a424d5341bc6bc0432c0d
2016-01-21 10:26:33 -08:00
Dave Miller 747be0bf5c Change the js signature to be Promise based and dynamically detect it used as a callback
Summary:
Making the default people see when they look at the module the Promise based version

public

Reviewed By: davidaurelio

Differential Revision: D2850048

fb-gh-sync-id: e0815983ed798c202047cb071e65ce63a52fd1af
2016-01-21 09:49:34 -08:00
sunnylqm edb523c6d7 adjust getSize so that its doc can be shown on the page
Summary: Closes https://github.com/facebook/react-native/pull/5426

Reviewed By: svcscm

Differential Revision: D2848229

Pulled By: nicklockwood

fb-gh-sync-id: d1cc28af889c3b1e26a098044e85e0b10032a776
2016-01-21 08:23:36 -08:00
Dave Miller 9baff8f437 Make CameraRoll work with Promises
Summary:
public
This is the first module moving to the new model of working with Promises.

We now warn on uses of callback version.  At some point we will remove that.

Reviewed By: davidaurelio

Differential Revision: D2849811

fb-gh-sync-id: 8a31924cc2b438efc58f3ad22d5f27c273563472
2016-01-21 08:07:41 -08:00
Janic Duplessis d33b554f5d Make the packager work with babel strict mode transform
Summary:
At the moment we have to disable strict mode for the transform-es2015-modules-commonjs because strict mode leaks to the global scope and breaks the bridge. It was due to the way the polyfills were bundled in the package. To fix it, I wrapped the polyfill modules in an IIFE. Then when strict mode was enabled some polyfills were broken due to strict mode errors so that was fixed too. Also removed the IIFE from the polyfills that included one.

This diff doesn't enable the strict mode transform since some internal facebook modules depend on it not being enabled. When #5214 lands we could make the default babel config shipped with OSS react-native use strict mode modules and facebook could just modify the babel config to disable it if needed.

This will allow removing `"strict": false` from https://github.com/facebook/react-native/blob/master/packager/react-packager/.babelrc#L16

Fixes #5316
Closes https://github.com/facebook/react-native/pull/5422

Reviewed By: svcscm

Differential Revision: D2846422

Pulled By: davidaurelio

fb-gh-sync-id: a3e2f8909aa87dabab2b872c61b887e80220fb56
2016-01-21 07:23:34 -08:00
Jeff Berg 48117ce6c4 Fix TouchNativeFeedback so that the ripple starts from where a person touches
Summary:
It needs the touch coordinates for with-in the element, not for on the page.
Closes https://github.com/facebook/react-native/pull/5400

Reviewed By: svcscm

Differential Revision: D2848834

Pulled By: androidtrunkagent

fb-gh-sync-id: 88cf0fd7bd2332eb3db835b26438064412c8358c
2016-01-20 20:36:38 -08:00
Tim Yung ab87033185 RN: Teach YellowBox to Count
Reviewed By: kassens

Differential Revision: D2846410

fb-gh-sync-id: 03127ff30cac54679ed0dbb225551efafb0cafa8
2016-01-20 15:14:31 -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
Andy Prock 9b87e6c860 Added an optional options parameter for WebSockets
Summary:
This enables overriding origin, and other request headers. Similar to the https://github.com/websockets/ws api.
Closes https://github.com/facebook/react-native/pull/4629

Reviewed By: svcscm

Differential Revision: D2839951

Pulled By: mkonicek

fb-gh-sync-id: 3578af4343f90572b8851ff28342a05945498ef6
2016-01-20 11:01:39 -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
Martin Konicek eef56de376 CameraRoll: remove comment about missing Android support
Reviewed By: bestander

Differential Revision: D2840793

fb-gh-sync-id: a8dca1044242b93283953ff342bf76cd844b5e14
2016-01-20 08:42:28 -08:00
Nick Lockwood cb45eaa0e8 Made Map & Set polyfills available globally
Summary:
public

Map and Set are a standard JavaScript features, but are only supported in a subset of JSC versions that we target (e.g. iOS 7's JSC doesn't support Set).

The consequence of this is that failing to require('Set') before using it won't error during testing on a modern OS, but will fail on older OS versions. This diff makes the Map and Set polyfills available globally to all RN apps to avoid that problem.

Reviewed By: davidaurelio

Differential Revision: D2833997

fb-gh-sync-id: 713d8b69f6a1bce2472a1b2e6b84f69d75f30289
2016-01-20 08:27:38 -08:00
Martín Bigio 4f37fe6f68 Improve error wording when packager dies and simulator was on debug mode
Reviewed By: jingc

Differential Revision: D2835719

fb-gh-sync-id: 694aac79cd9a76cfac32f7808c3f1bbb85d6bfb0
2016-01-19 16:37:34 -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
Huang Yu 88c2aa61b9 fix lint warnings
Summary:
added two semi colons, separated from other lint commits to avoid potential conflicts
Closes https://github.com/facebook/react-native/pull/5217

Reviewed By: svcscm

Differential Revision: D2818391

Pulled By: mkonicek

fb-gh-sync-id: 94e3640a30fb7ab932b15bfd84a0ab346c82d5d7
2016-01-18 14:28:34 -08:00
Janic Duplessis bd4bf8ca39 Fix a crash in ViewPagerAndroid when passing a null child
Summary:
Fixes #5195
Closes https://github.com/facebook/react-native/pull/5236

Reviewed By: svcscm

Differential Revision: D2819197

Pulled By: androidtrunkagent

fb-gh-sync-id: cea451802c659512f64c1e90905647b8fbe4490b
2016-01-18 13:57:30 -08:00
Connor McEwen b8ff6212f8 bind this in onreadystatechange call
Summary:
I ran into this problem that `this` is undefined in `onreadystatechange` function calls while using this github api library: https://github.com/michael/github/blob/master/github.js#L72

It seems that in the browser, the `onreadystatechange` function expects `this` to be bound. This example on the xhr spec website can be seen using `this` similarly: https://xhr.spec.whatwg.org/#the-getresponseheader()-method
Closes https://github.com/facebook/react-native/pull/5373

Reviewed By: svcscm

Differential Revision: D2838940

Pulled By: nicklockwood

fb-gh-sync-id: e42184887c7abb0af9c4358a5f33b8c97155624c
2016-01-18 08:55:35 -08:00
Alex Roman 1303e6d039 Implement XHR timeout for Android and IOS natively.
Summary:
Opening this in a separate PR but the discussion can be viewed on #4832.

Basically, this is a native implementation and is a bit more elegant. The consensus on my previous PR was that it should be done natively rather than in JS.

There's now no maximum valid timeout value and a timeout of 0 will never time out.

ontimeout isn't implemented (yet) in this PR.

cc nicklockwood ide philikon
Closes https://github.com/facebook/react-native/pull/5038

Reviewed By: svcscm

Differential Revision: D2838743

Pulled By: nicklockwood

fb-gh-sync-id: 774f864ac35082bf522f7665f4311bd3affbe82c
2016-01-18 08:10:59 -08:00
Aleksei Androsov 5ea4d397a9 TextInput should call blur and focus methods of selectionState
DocumentSelectionState returns anchor and focus offsets only in focused state. So TextInput should set proper state to selectionState when blur and focus.
2016-01-16 14:49:40 +03:00
Horcrux 274a3e0585 add onLoading* prop for WebView
Summary:
add onLoadingStart,onLoadingError,onLoadingFinish prop for WebView
Closes https://github.com/facebook/react-native/pull/5335

Reviewed By: svcscm

Differential Revision: D2834003

Pulled By: nicklockwood

fb-gh-sync-id: bbe84297ebeb5a6c2bf1caaacee8c59e0bcef1db
2016-01-15 09:31:33 -08:00
Konstantin Raev 18437093f2 Open sourced spinner aka picker aka drop down for android
Reviewed By: mkonicek

Differential Revision: D2830803

fb-gh-sync-id: e6b6fcdbe33d942180cf2c1041076ad71d0473ce
2016-01-15 06:25:16 -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
Philipp von Weitershausen 66158ab2bf Make the RCTSRWebSocketDelegate protocol part of RCTWebSocketModule public
Summary:
This allows consumers to subclass and extend `RCTWebSocketModule` and make use of the `RCTSRWebSocketDelegate` methods.

The use case here is to do some pre-processing of WebSocket data before handing it off to JS. Consumers could that in the following way:

```

interface MyWebSocketModule : RCTWebSocketModule
end

implementation MyWebSocketModule

// Don't use RCT_EXPORT_MODULE macro for this so we replace the existing RCTWebSocketModule.
+ (NSString *)moduleName { return @"RCTWebSocketModule"; }

RCT_EXTERN_METHOD(connect:(NSURL *)URL socketID:(nonnull NSNumber *)socketID)
RCT_EXTERN_METHOD(send:(NSString *)message socketID:(nonnull NSNumber *)socketID)
RCT_EXTERN_METHOD(close:(nonnull NSNumber *)socketID)

- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message
{
  [super webSocket:webSocket didReceiveMessage:[DoSomethingWith message]];
}

end
```

... and then returning a `MyWebSocketModule` ins
Closes https://github.com/facebook/react-native/pull/5321

Reviewed By: svcscm

Differential Revision: D2832374

Pulled By: nicklockwood

fb-gh-sync-id: f208516b2b2f76276223ffc972871d96afe87e27
2016-01-14 16:13:33 -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
Andrei Coman 25c3dd140f Add phone-pad keyboard
Summary:
With the numeric keyboard now being an actual numeric keyboard (before
it was actually phone-pad), we need a proper phone-pad keyboard as well.

public

Reviewed By: dmmiller

Differential Revision: D2830707

fb-gh-sync-id: 80a1d314eac730e691de73a31342c014a2fa5ba6
2016-01-14 11:42:34 -08:00
Martín Bigio 469bb7fbfd Improve error wording when fail to launch debugger
Reviewed By: javache

Differential Revision: D2829484

fb-gh-sync-id: a3402ece1f5cd19e8408fa3ab89adf7a26c66de9
2016-01-14 10:02:34 -08:00
Nick Lockwood e5381072dd Fixed transparent border around UIExplorer headers
Summary:
public

This was caused by the change to background color propagation, but was actually due to having an unnecessary wrapper view around the headers, which was itself a workaround for a padding bug that was fixed some time ago :-)

Reviewed By: tadeuzagallo

Differential Revision: D2830890

fb-gh-sync-id: b64e701dedb90b357ed7c463b745de021f38637b
2016-01-14 09:56:35 -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 1abd12b68b configureScene: add routeStack in second argument
Summary:
Giving routeStack in second parameter of configureScene allows to do more advanced scene configuration.
I have use-case where I can only determine the scene config from the navigation context (not only from the route object but also from where it's located).
Closes https://github.com/facebook/react-native/pull/5254

Reviewed By: svcscm

Differential Revision: D2828415

Pulled By: androidtrunkagent

fb-gh-sync-id: 27b6c79b24cbc194e080541e9202ca84c55a0bc4
2016-01-13 13:27:31 -08:00
Janic Duplessis f5062d0840 Add doc for RefreshControl on the website
Summary:
Exposes the doc for RefreshControl and add a link to the component page in ScrollView.
Closes https://github.com/facebook/react-native/pull/5209

Reviewed By: svcscm

Differential Revision: D2818217

Pulled By: mkonicek

fb-gh-sync-id: eb1ae70103e6a02af3a12866509f68eacc413dfd
2016-01-13 11:34:31 -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
Eric Raio 5fb1966509 Adding `resetTo` documentation in Navigator methods
Summary: Closes https://github.com/facebook/react-native/pull/5220

Reviewed By: svcscm

Differential Revision: D2818993

Pulled By: bestander

fb-gh-sync-id: 0bc0feb68e6c6f6132203daef586d78489047731
2016-01-12 04:47:37 -08:00
Aleksei Androsov 5061fde317 FormData can append only string or object with uri
Summary:
I fix FormData type checking.

Simple test case:
```js
var fd = new FormData();

// JS Error.
// Because all non-string values threaded as "blob"
fd.append('number', 1);
```
Closes https://github.com/facebook/react-native/pull/4390

Reviewed By: svcscm

Differential Revision: D2818377

Pulled By: nicklockwood

fb-gh-sync-id: 8b3f27476af21c5fd65b844034579372172ea73c
2016-01-12 03:25:33 -08:00
Morgan Pretty 43dcdaffe2 ActionSheetIOS support for presentation from modal view controller
Summary:
Currently the RCTActionSheetManager attempts to present itself from the 'rootViewController' of the key window, presenting a modal from a view controller which is already presenting a modal is not allowed on iOS and this fails with the following error appearing in the XCode debugger (but not the chrome debugger):

```
Warning: Attempt to present <UIAlertController: 0x7fca85b14f40> on <UINavigationController: 0x7fca84812000> whose view is not in the window hierarchy!
```

This change recursively looks through modally presented view controllers until it finds the top one and then uses that to present the action sheet.
Closes https://github.com/facebook/react-native/pull/5263

Reviewed By: svcscm

Differential Revision: D2823201

Pulled By: nicklockwood

fb-gh-sync-id: aad1ad88115563f633fd9aaea8e27d1d155a6c27
2016-01-12 03:14:35 -08:00
Sebastian Gronewold 6623e482b2 See issue #4886
Summary:
brentvatne this is the pull request you requested
See issue #4886

On iOS the plist key NSLocationAlwaysUsageDescription was ignored and the location could not be retreived when using this key. Now both keys NSLocationWhenInUseUsageDescription and NSLocationAlwaysUsageDescription are supported. If NSLocationAlwaysUsageDescription is set, NSLocationWhenInUseUsageDescription will be simply ignored according to https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW18

I read the contribution guidelines regarding the Objective-C coding standards. Hopefully my line length breaks are okay - otherwise just give me a shout and I will fix that. Didn't write any line of Objective-C before so^^
Closes https://github.com/facebook/react-native/pull/5093

Reviewed By: svcscm

Differential Revision: D2823206

Pulled By: nicklockwood

fb-gh-sync-id: dd856a18416796749025e4b32d9c72895401916d
2016-01-12 03:11:31 -08:00
Ben 09250aa184 multiline textinput view not wrapping in multiline on ios
Summary:
It's because the view doesn't update itself after setText.
Closes https://github.com/facebook/react-native/pull/5247

Reviewed By: svcscm

Differential Revision: D2819520

Pulled By: nicklockwood

fb-gh-sync-id: 06f5342d94f242fc63f862dac738da9b96842183
2016-01-11 03:33:30 -08:00
Olivier Notteghem e14b24936d Move THFeedListView to right location
Reviewed By: hnery

Differential Revision: D2815711

fb-gh-sync-id: 261343ea6c57786beb9c02917c56a3bef544d85b
2016-01-08 16:38:46 -08:00
Nick Lockwood 336984214f Fixed ART background color
Summary:
public
Disabling background color propagation had the unexpected effect of turning ART views black. This diff re-enabled propagation for ART views.

Reviewed By: jingc

Differential Revision: D2816402

fb-gh-sync-id: f2a4c44f3b4a16e04cbf6051391bb8fb1c0a7ed2
2016-01-08 15:42:32 -08:00
Oleg Lokhvitsky de392b5351 Fix Network::FormData to support non-string, non-object values
Reviewed By: pvulgaris, nicklockwood

Differential Revision: D2805463

fb-gh-sync-id: 30e847760be1fe557497080adb8fa372f19f00c3
2016-01-08 11:42:32 -08:00
Martin Konicek 1dc56a6758 Add support for global alert() on Android
Summary:
Use the new cross-platform [`Alert`](https://github.com/facebook/react-native/blob/master/Libraries/Utilities/Alert.js) API to implement global `alert()`.

public

Reviewed By: vjeux

Differential Revision: D2773589

fb-gh-sync-id: 4297c5dce6a55391af89d2675f2b9ac4dc715bb6
2016-01-08 10:12:29 -08:00
Christoph Pojer b84ad2ab0d Updates for haste2 inside of jest
Summary:
I'm working on deploying haste2 with jest. This updates all the files that require changes for this to work and they are backwards compatible with the current version of jest.

* package.json was just outdated. I think haste1's liberal handling with collisions made this a "non-issue"
* env.js didn't properly set up ErrorUtils, also unsure why that isn't a problem in jest right now already?
* some things were mocking things they shouldn't
* Because of the regex that matches against providesModule and System.import, it isn't possible to list module names more than once. We have multiple tests reusing the same providesModule ids and using System.import with modules that only exist virtually within that test. Splitting up the strings makes the regexes work (we do the same kind of splitting on www sometimes if we need to) and using different providesModule names in different test files fixes the problem. I think the BundlesLayoutIntegration-test is going to be deleted, so this doesn't even matter.

public

Reviewed By: voideanvalue

Differential Revision: D2809681

fb-gh-sync-id: 8fe6ed8b5a1be28ba141e9001de143e502693281
2016-01-08 06:52:29 -08:00
Lukas Benes 5a3b272f7e Fix missing Alert in react-native.js.flow
Summary: Closes https://github.com/facebook/react-native/pull/5192

Reviewed By: svcscm

Differential Revision: D2815060

Pulled By: androidtrunkagent

fb-gh-sync-id: cbf9058e4e6b36584d8487fc132faa2a5c52bbe0
2016-01-08 04:36:28 -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
olivier notteghem 47d0e3c288 introduce custom listview to be experimented in groups that fixes tail-fetch and improve skipped frame
Reviewed By: nspaun

Differential Revision: D2810265

fb-gh-sync-id: b5b312858f9096f82f14e2262d205d0580ac9e46
2016-01-07 18:19:00 -08:00
Andrei Coman cc449b394e Refactor text input keyboards
Reviewed By: foghina

Differential Revision: D2807491

fb-gh-sync-id: e7e5fb8c235f3637f619b2f44053749c51f379f0
2016-01-07 13:40:33 -08:00
Martín Bigio fe77ce1c62 Show red boxes on HL mode
Summary:
public

We should further improve this on the future by showing the actual stacktrace instead of the `HMRClient` one. Also, we need to integrate this with the dev plugin that opens in the default editor the file/line the user clicks on.

Reviewed By: vjeux

Differential Revision: D2798889

fb-gh-sync-id: 2392966908c493e86e11b0d024e7b68156c9066c
2016-01-07 13:15:28 -08:00
realaboo b659d7f0d1 Get response url from XMLHttpRequest
Summary:
An HTTP request may be redirected to another URL, sometimes we need to know the URL where the  response comes from.

If the server is in control, we can add an HTTP header X-Request-URL for the redirect URL. However there will be cases that 3rd party services are used.

This PR retrieves the response URL from native networking module and passes to it XMLHttpRequest. The fetch API built on XMLHttpRequest also benefits from this feature.
Closes https://github.com/facebook/react-native/pull/4981

Reviewed By: svcscm

Differential Revision: D2811392

Pulled By: lexs

fb-gh-sync-id: 3ec356fb92f8011b6a243d6879172877a3dc498a
2016-01-07 12:03:48 -08:00
David Aurelio b064094687 Add support for promise rejection tracking
Summary:
Adds support for tracking unhandled rejections with `console.warn` (= yellow box).

I will create a follow-up with proper error stack formatting.

related: #4971
fixes: #4045, #4142

public

{F59857438}

{F59857439}

Reviewed By: bestander

Differential Revision: D2803126

fb-gh-sync-id: 376b33e42a967675a04338cbff3ec315a77d1037
2016-01-07 12:02:56 -08:00
realaboo a45219966c ProgressBarAndroid: default value for styleAttr
Summary:
Current default value of ProgressBarAndroid's styleAttr is "Large" which sets the ProgressBar's style to [Widget_ProgressBar_Large](http://developer.android.com/reference/android/R.style.html#Widget_ProgressBar_Large) at native side. But large is not the default style for the native side ProgressBar.

For example, the size of the ProgressBar is 48dip for default style, but 76dip for large and 16dip for small as in the Material themes. Although the size of ProgressBarAndroid could be set in JS, it'll be better to have the same default style as in native side themes.

My PR adds a "Normal" value for styleAttr prop and makes it the default value.
Closes https://github.com/facebook/react-native/pull/4974

Reviewed By: svcscm

Differential Revision: D2811229

Pulled By: bestander

fb-gh-sync-id: 087f68d1919fe933d86e5194112bf7a5f5b3f3c6
2016-01-07 12:02:37 -08:00
Dave Miller 6dc6794881 Add onSelectionChange for Android TextInput
Summary:
public

Add an onSelectionChange method to TextInput that works on Android same as iOS

Reviewed By: andreicoman11

Differential Revision: D2780131

fb-gh-sync-id: 9b3b8fbd9ea653d43e3107a338e4bc08bde2e8c6
2016-01-07 12:02:06 -08:00
Lauri Lehmijoki 857dd59340 Fix minor typo in PanResponder
Summary:
Replaces https://github.com/facebook/react-native/pull/4469
Closes https://github.com/facebook/react-native/pull/4487

Reviewed By: svcscm

Differential Revision: D2713948

Pulled By: bestander

fb-gh-sync-id: b072379ad99b8891168ce64defeebfaf5442e394
2016-01-07 12:01:56 -08:00
Gaëtan Renaudeau 4f9086f0e7 Fixes error when navigationBar is set back to null
Summary:
This fixes a regression introduced in df70005c12

If you set navigationBar props (on Navigator) and then later set it back to null, it will crashes.
(N.B. this should be possible as navigationBar is optional)

cc satya164
Closes https://github.com/facebook/react-native/pull/4941

Reviewed By: svcscm

Differential Revision: D2788889

Pulled By: bestander

fb-gh-sync-id: f8f1cd6cc2ce13b1b1b86fa76d3b22c26a8adb5b
2016-01-07 12:01:37 -08:00
pecheriere ac72611bb1 Add soundName config for UILocalNotification
Summary:
Current version wasn't triggering any sound when a local notification was fired. I added the possibility to provide a custom sound and fallback to the default iOS sound if not provided.
Closes https://github.com/facebook/react-native/pull/4836

Reviewed By: svcscm

Differential Revision: D2807381

Pulled By: bestander

fb-gh-sync-id: c25e8f3c30a0714a5d9558c0c1fe344d0e93321e
2016-01-07 12:01:26 -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
Olivier Notteghem b75c939d59 Fix corner case bug in ListView
Reviewed By: sahrens

Differential Revision: D2802885

fb-gh-sync-id: e4bb82e3c63ded2af46f5b078b712636d3afa156
2016-01-06 19:16:32 -08:00