Summary:
Hi there,
when using the ScrollView component with `onScroll` and `scrollEventThrottle = 0` as it is documented in [react-native/docs/scrollview](https://facebook.github.io/react-native/docs/scrollview.html#scrolleventthrottle) this message will appear unnecessary.
This happens because `!this.props.scrollEventThrottle` is `true` when the value is `0`.
So I changed it to `this.props.scrollEventThrottle == null`. Now it is `false` when the value is `0`.
Closes https://github.com/facebook/react-native/pull/10038
Differential Revision: D3909323
fbshipit-source-id: 3c701f23708b64576a8c9f47e140d87159087894
Summary: If a user scrolls the `SwipeableListView`, any open row(s) will close.
Reviewed By: furdei
Differential Revision: D3903787
fbshipit-source-id: efd9ae896ba50ad6e83e72d52bc1f5c0c35efd61
Summary:
Fixes an issue where location request timeout errors always reported "Unable to fetch location within **0s**".
Previously we had `@"Unable to fetch location within %zds.", (NSInteger)(timer.timeInterval * 1000.0)` but from the [NSTimer.timeInterval docs](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/#//apple_ref/occ/instp/NSTimer/timeInterval) "If the receiver is a non-repeating timer, returns 0 even if a time interval was set.".
Change to use `request.options.timeout` instead, which is a `Double` defaulting to `INFINITY`. Tested on an iOS simulator.
Closes https://github.com/facebook/react-native/pull/9888
Differential Revision: D3902788
Pulled By: javache
fbshipit-source-id: aef717d6c39f3177cb7056a17adc35c1bfd94132
Summary:
This fixes https://github.com/facebook/react-native/issues/9751
We were seeing the same issues as the original reporter.
I'm not an expert on this code, so apologies if it's naive, but we haven't seen the crash since making this change.
From my understanding of it, it seems like the `cancelLoad` block was being released before the block returned by `_loadImageOrDataWithURLRequest:` was called.
This PR checks the `cancelled` flag before calling `cancelLoad()`.
Closes https://github.com/facebook/react-native/pull/10016
Differential Revision: D3902723
Pulled By: javache
fbshipit-source-id: 75cd115e28694105c6fc29469986998ca0d4cd09
Summary:
While working on a feature in realized the buttons I built using `TouchableHighlight` were too dark when pressed.
When used white white views, `TouchableHighlight` produces the color `d4d5d5`. This is different from `dedede` which iOS uses.
Let's use opacity 0.85 instead of 0.8 to make the color match iOS. See a React Native view compared to iOS settings screen (same color for pressed items now): http://imgur.com/a/6CyL3
On Android, people should be using `TouchableNativeFeedback` everywhere.
Reviewed By: sahrens
Differential Revision: D3896168
fbshipit-source-id: a7dd12b4bde079b120faaffc36d25292533a2c6d
Summary:
In certain cases, if a navigation title is present in place of an empty nav stack, the first breadcrumb may steal part of the title's touch events since it's hardcoded to sit 1/4 from the left of the screen (for animation reasons). This diff fixes it, allowing titles on an empty nav stack to be entirely touchable while retaining all other breadcrumb functionality.
Also, applied some suggested lint changes.
Reviewed By: hedgerwang
Differential Revision: D3891909
fbshipit-source-id: 97d1fb3bba4e4118401d84cec2d8836b94bfde75
Summary:
Since API 18, Android locations have had the `isFromMockProvider()` function, to verify the validity of a provided location. This was one of many methods one could verify location data, but as of Marshmallow, the other ways of detecting if "Mock Locations" is on in developer settings has been deprecated or defunct.
This means some devices can only detect location mocking by exposing the method on the location object.
This change provides that exposure.
Closes https://github.com/facebook/react-native/pull/9390
Differential Revision: D3858205
Pulled By: bestander
fbshipit-source-id: 3bae429cc0596ea01926c5be204f4403e4a2414f
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?
Copy&paste from the example in the documentation will cause exception because there is no `AndroidPermissions` object. To avoid confusion we should refer to `PermissionsAndroid` instead since this is how this module is named in the API.
Closes https://github.com/facebook/react-native/pull/9956
Differential Revision: D3889080
Pulled By: hramos
fbshipit-source-id: 8f30d8f51ffee1321088a16a1b454ab163a746a2
Summary:
When debugging in VScode or nucleide using a nodejs environment rather than chrome, the JS sources are made to appear as if they exist on disk, rather than coming from a `http://` url. Prior to this change the packager would see these file paths and not know how to handle them.
Since all the application JS will be part of a bundle file, we can switch out the path to the bundle on the filesystem with paths to the bundle served by the packager, and things will work just as though it was debugging in chrome. We stop the replacement once we reach an internal module (`vm.js` in the case of both nucleide and VSCode) since that is the point when the execution switches from inside the app to the surrounding debugging environment.
I've verified that this fixes redbox stack trace symbolication in VSCode, and from my understanding of nucleide's debugging environment it should also work there without requiring any changes.
Closes https://github.com/facebook/react-native/pull/9906
Differential Revision: D3887166
Pulled By: davidaurelio
fbshipit-source-id: e3a6704f30e0fd045ad836bba51f6e20d9854c30
Summary:
Currently, it's hard to find out that it's very easy to use android toasts. The example is very complex and hard to grasp for a beginner. So, I propose to add an easy to understand example.
I'm sure the syntax of this PR is not really correct, it's just a start to show the kind of thing I propose.
Closes https://github.com/facebook/react-native/pull/9859
Differential Revision: D3886274
Pulled By: donyu
fbshipit-source-id: 15e693f5ddb1efea0fc6b7accfa688fd5f99a100
Summary:
This adds support for `Animated.event` driven natively. This is WIP and would like feedback on how this is implemented.
At the moment, it works by providing a mapping between a view tag, an event name, an event path and an animated value when a view has a prop with a `AnimatedEvent` object. Then we can hook into `EventDispatcher`, check for events that target our view + event name and update the animated value using the event path.
For now it works with the onScroll event but it should be generic enough to work with anything.
Closes https://github.com/facebook/react-native/pull/9253
Differential Revision: D3759844
Pulled By: foghina
fbshipit-source-id: 86989c705847955bd65e6cf5a7d572ec7ccd3eb4
Summary:
see also: eb3360b02a (commitcomment-19042340)
commit eb3360b02a recently break some third libraries that was (weakly) relying on traversing `animatedNode.refs.node` to get the original node of the decorated (animated) component (at least 2 libs: gl-react-native and react-native-material-kit).
Instead of now doing `animatedNode._component` (that might later break again), getNode() is a more 'public' solution for these third party.
as you expose a way to create an animated component (`createAnimatedComponent`) you sometimes still want a way to get the reference.
That way, third party components can continue providing some extra native methods to the animated version.
Closes https://github.com/facebook/react-native/pull/9944
Differential Revision: D3885973
Pulled By: foghina
fbshipit-source-id: 43ffdbfe7f9c52f5a1689e6a9a4052d4973f5c5f
Summary:
This adds support for sticky headers on Android. The implementation if based primarily on the iOS one (https://github.com/facebook/react-native/blob/master/React/Views/RCTScrollView.m#L272) and adds some stuff that was missing to be able to handle z-index, view clipping, view hierarchy optimization and touch handling properly.
Some notable changes:
- Add `ChildDrawingOrderDelegate` interface to allow changing the `ViewGroup` drawing order using `ViewGroup#getChildDrawingOrder`. This is used to change the content view drawing order to make sure headers are drawn over the other cells. Right now I'm only reversing the drawing order as drawing only the header views last added a lot of complexity especially because of view clipping and I don't think it should cause issues.
- Add `collapsableChildren` prop that works like `collapsable` but applies to every child of the view. This is needed to be able to reference sticky headers by their indices otherwise some subviews can get optimized out and break indexes.
Closes https://github.com/facebook/react-native/pull/9456
Differential Revision: D3827366
Pulled By: fred2028
fbshipit-source-id: d346068734c5b987518794ab23e13914ed13b5c4
Summary:
This adds support for sticky headers on Android. The implementation if based primarily on the iOS one (https://github.com/facebook/react-native/blob/master/React/Views/RCTScrollView.m#L272) and adds some stuff that was missing to be able to handle z-index, view clipping, view hierarchy optimization and touch handling properly.
Some notable changes:
- Add `ChildDrawingOrderDelegate` interface to allow changing the `ViewGroup` drawing order using `ViewGroup#getChildDrawingOrder`. This is used to change the content view drawing order to make sure headers are drawn over the other cells. Right now I'm only reversing the drawing order as drawing only the header views last added a lot of complexity especially because of view clipping and I don't think it should cause issues.
- Add `collapsableChildren` prop that works like `collapsable` but applies to every child of the view. This is needed to be able to reference sticky headers by their indices otherwise some subviews can get optimized out and break indexes.
Closes https://github.com/facebook/react-native/pull/9456
Differential Revision: D3827366
fbshipit-source-id: cab044cfdbe2ccb98e1ecd3e02ed3ceaa253eb78
Summary: Introduce `overflow:scroll` so that scrolling can be implemented without the current overflow:visible hackiness. Currently we use AT_MOST to measure in the cross axis but not in the main axis. This was done to enable scrolling containers where children are not constraint in the main axis by their parent. This caused problems for non-scrolling containers though as it meant that their children cannot be measured correctly in the main axis. Introducing `overflow:scroll` fixes this.
Reviewed By: astreet
Differential Revision: D3855801
fbshipit-source-id: 3c365f9e6ef612fd9d9caaaa8c650e9702176e77
Summary: Introduce `overflow:scroll` so that scrolling can be implemented without the current overflow:visible hackiness. Currently we use AT_MOST to measure in the cross axis but not in the main axis. This was done to enable scrolling containers where children are not constraint in the main axis by their parent. This caused problems for non-scrolling containers though as it meant that their children cannot be measured correctly in the main axis. Introducing `overflow:scroll` fixes this.
Reviewed By: astreet
Differential Revision: D3855801
fbshipit-source-id: 6077b0bcb68fe5ddd4aa22926acab40ff4d83949
Summary:
We've enabled getters in .flowconfig, so Flow will now understand react-native.js. We no longer need to maintain a separate file for Flow.
cc bestander
Closes https://github.com/facebook/react-native/pull/9892
Differential Revision: D3862560
Pulled By: bestander
fbshipit-source-id: 9efb66bc885dbac80c18b4b5e3cf5362495928a9
Summary:
Fixes https://github.com/facebook/react-native/issues/9216.
As nickzuber describes in #9216, conditional `Picker.Item` elements will lead to exceptions downstream when the `Picker` attempts to construct the collection of items.
[In the picker source](a2fb703bbb/Libraries/Components/Picker/PickerIOS.ios.js (L48-L53)) we can see that `child.props` is accessed when `child` has the potential to be an invalid `React` element.
```js
ReactChildren.forEach(props.children, function (child, index) {
if (child.props.value === props.selectedValue) {
selectedIndex = index;
}
items.push({value: child.props.value, label: child.props.label});
});
```
This change ensures the incoming element is valid
```diff
ReactChildren.forEach(props.children, function (child, index) {
+ if (!React.isValidElement(child)) {
+ return;
+ }
if (child.props.value === props.selectedValue) {
selectedIndex = index;
}
items.
Closes https://github.com/facebook/react-native/pull/9243
Differential Revision: D3847514
Pulled By: spicyj
fbshipit-source-id: f46fbd4b0f81de7a92e1ca3e60b5ed15a9cbbf78
Summary:
Explain that, unlike other APIs, geolocation follows the browser spec and is exposed through `navigator.geolocation` rather than as an `react-native` export.
This can be inferred from the example code but isn't otherwise stated in the docs. See also https://github.com/facebook/react-native/pull/9793
Closes https://github.com/facebook/react-native/pull/9810
Differential Revision: D3841341
Pulled By: javache
fbshipit-source-id: b1423e8bf7fb78c788f5cdc5630a4a948b8178c6
Summary:
Here's a little background. Resizing is inferior to scaling. See http://frescolib.org/docs/resizing-rotating.html#_
Currently, React Native has a heuristic to use resize when the image is likely to be from the device's camera. However, there may be other cases where a developer wants to use resize. For example, when the developer knows they'll be downloading a large image from a service but the image will be rendered at a small size on the device.
This change adds a `resizeMethod` prop to the `Image` component so developers can choose how Fresco resizes the image. The options are 'auto', 'resize', or 'scale'. When 'auto' is specified, a heuristic is used to choose between 'resize' and 'scale'. The default value is 'auto'.
**Test plan (required)**
In a small test app, verified that the `resizeMethod` prop properly influences the mechanism that is used to resize the image (e.g. resize or scale).
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/9652
Differential Revision: D3841322
Pulled By: foghina
fbshipit-source-id: 6c78b5c75ea73053aa10386afd4cbff45f5b8ffe
Summary:
`Navigator` throws an error if using a custom `NavigationBar` component that does not have a `immediatelyRefresh` method present.
Closes https://github.com/facebook/react-native/pull/9438
Differential Revision: D3838928
Pulled By: mkonicek
fbshipit-source-id: 74d62ef09e179f457a4b14f8537dfaf0d4697322
Summary:
Fix for https://github.com/facebook/react-native/issues/9465
We are building a react-native based application which extensively uses WebSockets. The Android app crashes right after waking up being in suspended mode for a coupe of days and throws an exception:
"Cannot send a message. Unknown WebSocket id 1"
Before calling WebSocket.send(...) method from WebSocket.js we always check its readyState. I believe the problem is caused by not updating readyState if case of 'websocketFailed' event. this.close() cause the current used websocket ID to be removed from mWebSocketConnections HashMap (WebSocketModule.java), but readyState stays the same.
Closes https://github.com/facebook/react-native/pull/9487
Differential Revision: D3838675
Pulled By: mkonicek
fbshipit-source-id: e833cef9f1b94c6f7236077241cacf5a56f5824b
Summary:
Resolves#7081 by allowing iCloud to download photos not stored on the device.
**Test plan (required)**
1. Verified existing photos stored on the device still display.
2. Deleted my iCloud photo library from my phone and verified the image downloads and displays.
Closes https://github.com/facebook/react-native/pull/9530
Differential Revision: D3838470
Pulled By: mkonicek
fbshipit-source-id: 810830a4246714b6e166e4411f3fa848b1f1b71c
Summary:
JSC on iOS 8 and above includes TypedArrays so there's no need for the guard statement anymore since React Native officially does not support iOS 7 moving forward.
Closes https://github.com/facebook/react-native/pull/9780
Differential Revision: D3834979
Pulled By: mkonicek
fbshipit-source-id: 6e28a47702d6e3d604fedb9d2d00fe1c539a6926
Summary: Get rid of the old behaviour of JSON encoding in `nativeRequireModuleConfig` and consistently use the same names for function types "async/promise/sync"
Reviewed By: lexs
Differential Revision: D3819348
fbshipit-source-id: fc798a5abcaf6a3ef9d95bd8654afa7825c83967
Summary:
Hi!
I found problem with accessibilityLabel on PickerAndroid.
There's no value in content-desc attribute while accessibilityLabel is correct.
I found that accessibilityLabel is not propagated into native components via
native props.
This PR brings accessibilityLabel for PickerAndroid.
Without this solution my appium tests fails, for example:
My code:
```jsx
<Picker
style={this.props.style}
selectedValue={this.props.value}
onValueChange={this.onChange}
disabled={this.props.disabled}
accessibilityLabel="select_wineType">
// Chilren
</Picker>
```
```sh
✖ Error: element (~select_wineType) still not visible after 5000ms
```
Because xml of this view is (look into content-desc of Spinner):
```xml
<android.widget.Spinner index="0" text="" class="android.widget.Spinner" package="com.hello_github" content-desc="" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" scrollable="true" long-clickable="false" password=
Closes https://github.com/facebook/react-native/pull/8873
Differential Revision: D3831691
Pulled By: spicyj
fbshipit-source-id: a494f22cb8be8cd6964981fe7ef7d9ff3773bcce
Summary: Cleans things up and also defers rendering rows if there is an interaction happening.
Reviewed By: achen1
Differential Revision: D3817231
fbshipit-source-id: fd08d0ca7cb6c203178f27bfc5a0f55469135c3a