Commit Graph

5192 Commits

Author SHA1 Message Date
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
Janic Duplessis 99e56d6e94 Add buck build folders to gitignore 2016-01-30 16:02:32 -05: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
Jan Kassens 1bc03871f3 remove ReactDOM from Jest blacklist
Reviewed By: yungsters, spicyj

Differential Revision: D2875010

fb-gh-sync-id: d316d5befd0d978bded99f70b814dc133c85b40f
2016-01-29 18:18:33 -08:00
Harry Moreno 8b7671a31a Improve ios offline build instructions
Summary: Closes https://github.com/facebook/react-native/pull/5626

Reviewed By: svcscm

Differential Revision: D2881020

Pulled By: androidtrunkagent

fb-gh-sync-id: 7f472d554a334f39c4b85ccfa4db81b7c3f41d38
2016-01-29 14:27:33 -08:00
Andrei Coman 8a10fc629a Remove timeout from MessageQueueThreadImpl creation
Reviewed By: oli

Differential Revision: D2880630

fb-gh-sync-id: bd31395abc69750f16a6ab32d11c55af3ec985a4
2016-01-29 14:12:33 -08:00
Krzysztof Magiera 041fb59146 Fix bug with calculating Y offset in RecyclerViewBackedScrollView.
Summary:
This change fixes a bug in getTopOffsetForItem method of RecyclerViewBackedScrollView that was causing Y offset of onScroll events to be invalid when user would scroll up. I'm also adding some comments to this method which may help to understand its complexity.
Closes https://github.com/facebook/react-native/pull/5610

Reviewed By: svcscm

Differential Revision: D2880743

Pulled By: androidtrunkagent

fb-gh-sync-id: 7183e3d6760fab5683afc49d454864239260fb91
2016-01-29 13:26:35 -08:00
Konstantin Raev 063e8b9ae5 revert D2862911: this broke ReactNative
Reviewed By: balazsbalazs

Differential Revision: D2879926

fb-gh-sync-id: 9f833c209128eaa00b111387ee57dbbc6b74fcb7
2016-01-29 12:21:34 -08:00
Martín Bigio 68f71dab4c Make HMR faster (2)
Summary:
public

The HMR listener needs to be invoked on the non debounced callback to avoid loosing updates if 2 files are updated within the debounce configured time.

Also, improve the time it takes to send HMR updates by avoiding rebuilding the bundle when the listener is defined. Instead just invalidate the bundles cache so that if the user reloads or disables Hot Loading the packager rebuilds the requested bundle.

Reviewed By: davidaurelio

Differential Revision: D2863141

fb-gh-sync-id: 3ab500eacbd4a2e4b63619755e5eabf8afdd1db9
2016-01-29 10:15:41 -08:00
Martín Bigio 65b8ff17f3 Make HMR faster
Summary:
public

At the moment, when the user changes a file we end up pulling the dependencies of the entry point to build the bundle. This could take a long time if the bundle is big. To avoid it, lets introduce a new parameter to `getDependencies` to be able to avoid processing the modules recursively and reuse the resolution responseto build the bundle.

Reviewed By: davidaurelio

Differential Revision: D2862850

fb-gh-sync-id: b8ae2b811a8ae9aec5612f9655d1c762671ce730
2016-01-29 10:15:36 -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
Martin Konicek 715081c4da Update Releases.md 2016-01-29 17:22:36 +01: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
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