Summary:
`react-native-xcode.sh` can fail to execute if `$REACT_NATIVE_DIR` contains spaces.
E.g. if `$REACT_NATIVE_DIR` was `/Users/samn/src/Xcode Projects/AwesomeReact` then `react-native-xcode.sh` would fail with the following error:
```
node /Users/samn/src/Xcode Projects/ReactNativeBeaconTest/node_modules/react-native/local-cli/cli.js bundle .... (elided)
module.js:341
throw err;
^
Error: Cannot find module '/Users/samn/src/Xcode'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:139:18)
at node.js:999:3
Command /bin/sh failed with exit code 1
```
This change properly handles paths with spaces in them by quoting `$REACT_NATIVE_DIR`
Closes https://github.com/facebook/react-native/pull/5651
Reviewed By: svcscm
Differential Revision: D2884600
Pulled By: androidtrunkagent
fb-gh-sync-id: 3784d8f4e16c0c2cadac738c5f085a5023b5ecf7
Summary:
Both LinkingIOS and IntentAndroid are deprecated in favor of Linking but it was not in the website documentation.
Closes https://github.com/facebook/react-native/pull/5642
Reviewed By: svcscm
Differential Revision: D2883999
Pulled By: androidtrunkagent
fb-gh-sync-id: cd2ce6192f84fffef7ab7d4e56f87eb55fb30901
Summary:
- Now using a table layout. While having the link inside of the header worked well in the browser, the search API would put "Edit in GitHub" as part of the title -_-
- Instead of putting the link inside of every section like Props, put it on the page header. This makes it less repetetitive and also works on API pages where the link was absent before
- Remove "Run this example" link as there's a giant Run this example sidebar already.
Closes https://github.com/facebook/react-native/pull/5643
Reviewed By: svcscm
Differential Revision: D2883989
Pulled By: vjeux
fb-gh-sync-id: e810e1677d5130692997dd301d6d59cfe04b948f
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
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
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
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
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
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
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
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
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
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
Summary:
public
Adds the new polyfill to the relevant tests (Resolver/BundlesLayout)
Reviewed By: martinbigio
Differential Revision: D2878697
fb-gh-sync-id: 9681f16dd19a0b337aac63101450c703bf387346
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
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
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
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
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
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
Summary:
should use UIGraphicsEndImageContext rather than UIGraphicsGetCurrentContext
public
Reviewed By: nicklockwood, chaceliang
Differential Revision: D2875657
fb-gh-sync-id: 0fa059e2da3d0bb1ffe5fe50a1bdaeddafc2bbfa
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
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
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
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
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
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
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
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