Commit Graph

4928 Commits

Author SHA1 Message Date
Ognjen Dragoljevic 53100ecccb Add support for custom scale types
Summary:
public
This diff adds support for providing custom scaletypes to Drawee. The implementation for the preexisting scale types is preserved.
Breaking changes should be minimal. In fact, only direct usages of `ScalingUtils.getTransform(..., scaleType)` should be converted to `scaleType.getTransform(...)`.

Reviewed By: kirwan

Differential Revision: D2862911

fb-gh-sync-id: ab0355fd13544dc08ce4481eda87287404ea7adb
2016-01-29 04:26:40 -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
Martin Konicek c33e8524c1 [website] Fix warning.png file
Added in PR #5566. Importing binary files doesn't work correctly
yet but it's being worked on.
2016-01-29 12:09:22 +01: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
Marc Horowitz 5e82094fcb Move bridge dependencies into a single ReactTestFactory
Reviewed By: cjhopman

Differential Revision: D2816291

fb-gh-sync-id: 0eb654541cac7816922d948cc38a26fab44fad70
2016-01-29 00:57:35 -08:00
David Aurelio b9ceecb31f Adapt tests to new Object/es7 polyfill
Summary:
public

Adds the new polyfill to the relevant tests (Resolver/BundlesLayout)

Reviewed By: martinbigio

Differential Revision: D2878697

fb-gh-sync-id: 9681f16dd19a0b337aac63101450c703bf387346
2016-01-28 22:02:31 -08:00
David Aurelio 2d9876dedf Add partial reading of files to fastfs
Summary:
public

Adds the ability to read files partially with `readWhile` to `Fastfs`
This feature will be used by for building the haste map, where we only need to read the doc block (if present) to extract the provided module name.

Reviewed By: martinbigio

Differential Revision: D2878093

fb-gh-sync-id: 219cf6d5962b89eeb42c728e176bf9fcf6a67e9c
2016-01-28 21:19:31 -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
Christopher Chedeau 1154f2a371 Document colors
Summary:
<img width="601" alt="screen shot 2016-01-27 at 3 37 22 pm" src="https://cloud.githubusercontent.com/assets/197597/12632329/12084e98-c50c-11e5-96c4-4f56e8219b3b.png">

<img width="303" alt="screen shot 2016-01-27 at 3 37 16 pm" src="https://cloud.githubusercontent.com/assets/197597/12632328/12075e70-c50c-11e5-95a3-5f483b4dcb47.png">

<img width="135" alt="screen shot 2016-01-27 at 3 37 38 pm" src="https://cloud.githubusercontent.com/assets/197597/12632327/12067668-c50c-11e5-92f9-ee0c719302b5.png">
Closes https://github.com/facebook/react-native/pull/5587

Reviewed By: svcscm

Differential Revision: D2878110

Pulled By: vjeux

fb-gh-sync-id: 00330e2857b07aac2e3d3c24f1003cdd9a2516c6
2016-01-28 19:37:33 -08:00
Andrei Coman 7e5247c041 Fix timing initialization bug
Reviewed By: AaaChiuuu

Differential Revision: D2875476

fb-gh-sync-id: a0d5b97524da3a37fc7bd30e8d2e58b9a0a9ba9e
2016-01-28 18:55:30 -08:00
Dmitry Soshnikov 598df0bc20 Add Object.entries and Object.values polyfill
Reviewed By: martinbigio

Differential Revision: D2876430

fb-gh-sync-id: 25c7680a71c9187beb937f6faf030a83c9c81fc5
2016-01-28 17:21:31 -08:00
Ahmed El-Helw 203fdcaa40 Support fade for remote images in React with nodes.
Reviewed By: dkoroskin

Differential Revision: D2804997

fb-gh-sync-id: e143fc16c07856e56182cba6d0eb2884a95c7318
2016-01-28 17:07:27 -08:00
Martín Bigio 181896e4d9 Move HMR to external transformer
Summary:
public

`babel-plugin-react-transform` doesn't support to run on transformed code (it doesn't detect some react components). The reason why HMR was originally on the internal transform was so that it worked with non JS code (TypeScript, Coffeescript, etc), but looks like this is not very popupar in the community, maybe because the JS ecosystem is getting better everyday.

So long story short, for now lets move HMR to the external transformer. This should also give us a perf boost.

Reviewed By: davidaurelio

Differential Revision: D2870973

fb-gh-sync-id: 68ca8d0540b88b9516b9fef10643f93fc9b530d2
2016-01-28 17:02:32 -08:00
Martin Konicek 0c0bd533f5 Remove dummy .so file 2016-01-29 01:48:48 +01:00
Dave Miller 0b39c72bfa Fix bundler to not do as many passes in optimization
Reviewed By: davidaurelio

Differential Revision: D2876894

fb-gh-sync-id: b652ff77dd442a82c16f3b446c931fb985a2efcd
2016-01-28 16:36:31 -08:00
David Aurelio a61ab8795a Add transform option to module / module cache
Summary:
public

This adds an option to `Module` (and its callers) that allows to transform code before extracting dependencies. The transform function has to return a promise that resolves to an object with `code`, and optionally `dependencies` and/or `asyncDependencies` properties, if standard dependency extraction cannot be applied

Reviewed By: cpojer

Differential Revision: D2870437

fb-gh-sync-id: 806d24ba16b1693d838a3fa747d82be9dc6ccf00
2016-01-28 16:29:33 -08:00
Nathan Spaun ca8792d2cc Add check to broadcast receiver to prevent exception
Reviewed By: andreicoman11

Differential Revision: D2876479

fb-gh-sync-id: 55b7e31a91cf8a05849a0876bf912ac931233638
2016-01-28 15:51:34 -08:00
Adam Miskiewicz b7b27bdf25 Fixing typo in Bundler
Summary:
With an upgraded Babel dependency, failing tests correctly found this typo.

It does not currently cause a test failure in the current version of master, however,
which is concerning. I found it when testing #5214.

cc martinbigio just because it was your code :)
Closes https://github.com/facebook/react-native/pull/5601

Reviewed By: svcscm

Differential Revision: D2876386

Pulled By: androidtrunkagent

fb-gh-sync-id: 378da39be79ac1b9a950ea9a7442ac24c0c3a87d
2016-01-28 15:18:31 -08:00
Brent Vatne e9f95c1a7d Check for contentView before emitting scroll event
Summary:
I've found that when switching between tabs that each have ScrollViews, sometimes `emitScrollEvent` fires without a `contentView`, which causes the following crash:

```
`D/AndroidRuntime(24496): Shutting down VM
E/AndroidRuntime(24496): FATAL EXCEPTION: main
E/AndroidRuntime(24496): Process: com.listexp, PID: 24496
E/AndroidRuntime(24496): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getWidth()' on a null object reference
E/AndroidRuntime(24496):        at com.facebook.react.views.scroll.ReactScrollViewHelper.emitScrollEvent(ReactScrollViewHelper.java:59)
E/AndroidRuntime(24496):        at com.facebook.react.views.scroll.ReactScrollViewHelper.emitScrollMomentumEndEvent(ReactScrollViewHelper.java:46)
E/AndroidRuntime(24496):        at com.facebook.react.views.scroll.ReactScrollView$1.run(ReactScrollView.java:159)
E/AndroidRuntime(24496):        at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime(24496):        at android.os.Handler.disp
Closes https://github.com/facebook/react-native/pull/5561

Reviewed By: svcscm

Differential Revision: D2876385

Pulled By: androidtrunkagent

fb-gh-sync-id: 33406eaa96352d5adae857088da09fb446b68440
2016-01-28 15:12:50 -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
Nick Lockwood a322ab61fb Fix ImageEditor example
Summary:
public

A fix added to make the ImageEditor example usable on Android inadvertantly broke the cropping logic on iOS, so that zoomed images were cropped incorrectly.

This diff fixes that, and also sets the min/max zoom scale correctly based on the image scale, instead of using a hard-coded value.

Reviewed By: bestander

Differential Revision: D2874576

fb-gh-sync-id: 02c62940c24f4d4266655de6ddbf4fe3bc9c13ce
2016-01-28 09:43:34 -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
Nick Lockwood 4511993ffa Fix duplicate platform labels in UIExplorer examples
Summary:
public
This fixes a bug in UIExplorer, where platform labels on examples like (ios only) or (android only) would be re-appended to the title each time the example was viewed.

Reviewed By: javache

Differential Revision: D2869690

fb-gh-sync-id: 07f3f14007f75eea23a5328b7850f3f620691ac2
2016-01-28 04:07:34 -08:00
Daniel Colascione 96a3a8e9b9 Codemod realtime to CLOCK_MONOTONIC where it makes sense
Reviewed By: rickbrew

Differential Revision: D2860798

fb-gh-sync-id: 35cd188091f6f790809afed81529531850f82d85
2016-01-27 21:56:34 -08:00
Dave Miller f7c48ee0ce Fix per connection timeouts for XHR
Summary:
public

When initially implemented, the timeout for a request was actually set for all requests that the OKHttpClient handled, not just that request.
The fix is to clone the client, set the timeout for the client which will be used for that request.

Reviewed By: andreicoman11

Differential Revision: D2873220

fb-gh-sync-id: c8c102a6eb9dd0ac57d5a7f53c3ba3b7d6db5ef9
2016-01-27 19:00:32 -08:00
Christoph Pojer 3117a334b1 Limit mocks shared with a resolution response
Reviewed By: davidaurelio

Differential Revision: D2872340

fb-gh-sync-id: a76b580ff670115cd4bd0098e7b9f31110239369
2016-01-27 18:47: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 47f863c4da Single quotes in enum values
Summary:
This was driving me crazy :p Turns out that if the value is `'auto' /* default */`, then the docparser will not only trim the comment but also normalize the quote to double quote.

This is not pretty but does the job.
Closes https://github.com/facebook/react-native/pull/5509

Reviewed By: svcscm

Differential Revision: D2872482

Pulled By: vjeux

fb-gh-sync-id: 8ba5dad695f747f82b7680ee26bdc0792e21ea8f
2016-01-27 18:27:01 -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
Janic Duplessis af2f40754a Add global flow types to eslint globals
Summary:
Added a subset of the global flow types from the fbjs eslint config to remove the no-undef errors for flow types as well as a few missing browser globals that were used in the codebase.

I also added a .eslintrc file to Examples to allow using alert there without warnings.
Closes https://github.com/facebook/react-native/pull/5585

Reviewed By: svcscm

Differential Revision: D2872016

Pulled By: vjeux

fb-gh-sync-id: f9b1b511289425393074b7237049dec38ea407b6
2016-01-27 15:55:34 -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
Pieter De Baets 04d14e5a2e Fix colors in RCTDevLoadingView
Reviewed By: martinbigio

Differential Revision: D2862821

fb-gh-sync-id: d763985cc499fc49d7ed1b25341d19b80e1be55d
2016-01-27 11:32:33 -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
Konstantin Raev 21a4c6e853 quick fix circle buck builds
Summary: Closes https://github.com/facebook/react-native/pull/5582

Reviewed By: svcscm

Differential Revision: D2869861

Pulled By: androidtrunkagent

fb-gh-sync-id: 5b004521e11d0e55c237183e69f8251732c6bd14
2016-01-27 08:52:36 -08:00
Martín Bigio 825ba6cf48 Inline Require every module but the preloaded ones
Reviewed By: javache

Differential Revision: D2858983

fb-gh-sync-id: b73de54163d7b75891cb00be96ffb4556d3311a3
2016-01-27 07:41:36 -08:00
Konstantin Raev 83fd314e37 Moving more unit tests to open source
Reviewed By: foghina, mkonicek

Differential Revision: D2865561

fb-gh-sync-id: 7aab67d205b94d657a6ec7bf81a4ecee644eabc2
2016-01-27 07:28:23 -08:00
Matt Apperson fff5dc3943 Add 3dTouch props to touch events
Summary:
This adds the first of the three 3dTouch API types, that found on the touch event.

It adds the `force` prop to touch events when running on iOS 9 devices:
Closes https://github.com/facebook/react-native/pull/3055

Reviewed By: svcscm

Differential Revision: D2860540

Pulled By: nicklockwood

fb-gh-sync-id: 95a3eb433837c844f755b3ed4a3dfcb28452c284
2016-01-27 07:14:34 -08:00
Chirag 4bf418a0e7 Merge pull request #5577 from dobbit/showcase
added ShareHows app android link in showcase
2016-01-27 09:42:11 -05:00
tuyou 3f97c5a340 assign webView's delegate to nil
Summary:
assign webView’s delegate to nil when the delegate release
Closes https://github.com/facebook/react-native/pull/5574

Reviewed By: svcscm

Differential Revision: D2869485

Pulled By: nicklockwood

fb-gh-sync-id: c72ac64e6c8757a2095d4e5d7baa3a0b6bded6ce
2016-01-27 02:50:34 -08:00
SangYeob Bono Yu bccdef00d4 added ShareHows app android link in showcase 2016-01-27 18:14:41 +09: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
Christoph Pojer 7e64ad8fc4 Fix some lint nits
Reviewed By: voideanvalue

Differential Revision: D2862332

fb-gh-sync-id: 19ab5e8a580137ffe6276b21a9018f7b322dd0cb
2016-01-26 11:16:39 -08:00
Christoph Pojer 6b75d7f497 Expose `has` method on Cache.
Reviewed By: davidaurelio

Differential Revision: D2862315

fb-gh-sync-id: 03728a2593b477aef3bbfe01d42382893a05ea50
2016-01-26 10:51:28 -08:00