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:
Adding jest and its presets to the react-native init command
**Test plan (required)**
run react-native init foo (using `npm link` to use the local `react-native` version)
inside foo there are now a .babelrc file and the package.json is set up as described by
https://facebook.github.io/jest/docs/tutorial-react-native.html#setup
Closes https://github.com/facebook/react-native/pull/9719
Differential Revision: D3843037
Pulled By: bestander
fbshipit-source-id: 004e27ebd3f257a202ed43f378d6fe6cc23ced52
Summary:
Added details about how IOS Native Modules can be initialized & registered manually with custom initializers so that dependencies can be injected to said modules.
Please let me know if there is a more appropriate place to detail this in the documentation or this is in fact detailed elsewhere; I also believe we do not have documentation on how to do the equivalent on Android, however it is a bit more obvious as the automatic MACRO registration mechanism does not exist on Android and modules need to be initialized manually anyway. As I currently understand there isn't currently any documentation detailing this apart from comments in the source.
Please let me know if you would require any style changes (variable names etc), to be more en-keeping with the rest of the documentation.
Closes https://github.com/facebook/react-native/pull/8406
Differential Revision: D3843018
Pulled By: javache
fbshipit-source-id: 5f4001df32d1ddc00a9dacc4fc99b63b408f1536
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:
I'm not sure if this was actually breaking anything, but I don't think `new` before `Promise.race()` is conventional.
Closes https://github.com/facebook/react-native/pull/9817
Differential Revision: D3836814
Pulled By: javache
fbshipit-source-id: 3bde46dca3760c3f7f3427f6346dd5f16f8ac011
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:
It took me a few timeslots of my life to figure out how to make this work. First, I tried to break into 2 files. The app export made no sense to me. But after doing that, I discover a invalid token, the return() was not supposed to be there. So I fixed the sample.
Closes https://github.com/facebook/react-native/pull/9802
Differential Revision: D3841320
Pulled By: mkonicek
fbshipit-source-id: 999227ee1c234b92d34844c2370ef654116b6a1d
Summary:
Current Xcode project does not include settings to enable auto-incrementing build numbers using ```agvtool``` as described [here](https://developer.apple.com/library/ios/qa/qa1827/_index.html). Tools like Fastlane, for example, rely on this for commands like ```increment_build_number```. Having these settings enabled by default ensures that people will have one less thing to worry about setting up CI for RN based projects.
Closes https://github.com/facebook/react-native/pull/9511
Differential Revision: D3841281
Pulled By: javache
fbshipit-source-id: 9b9640edf608efd0835371dbe90a2f51786748af
Summary:
Ugh. We never actually closed the websocket connection. Furthermore, upon calling `closeQuietly()`, `onClose()` is called, which does `reconnect()`. Beautiful. This results in `ReactInstanceManager` leaking after calling `destroy()` and nullifying all references to it.
To fix this I made sure `closeQuietly()` actually closes the connection for good, **and** made sure we actually call it when destroying an instance.
Reviewed By: AaaChiuuu
Differential Revision: D3835023
fbshipit-source-id: 31811805dd97b725ea5887cffed9bed49addda83
Summary:
I removed `$` and `_` (only from the starting substring) as they
cannot be used in creating Android package name according to official
android documentation. Also removed a duplicate function (there is the
same one in `react-native-cli/index.js`). This fixes#7115.
Closes https://github.com/facebook/react-native/pull/7127
Differential Revision: D3841253
Pulled By: mkonicek
fbshipit-source-id: 677c7e4277c783180b04dee57d3ccd509e2b99d3
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:
> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**
Explain the **motivation** for making this change. What existing problem does the pull request solve?
Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.
**Test plan (required)**
Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.
Make sure tests pass on both Travis and Circle CI.
**Code formatting**
Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).
For more info, see
Closes https://github.com/facebook/react-native/pull/9539
Differential Revision: D3840413
Pulled By: hramos
fbshipit-source-id: 9161020f63c6099343fda54de7cb94025d0e461e
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:
Currently, `<Text>` and `<TextInput>` components on Android do not support borders.
This change adds support for the borderRadius, borderColor, and
borderWidth props on the `<Text>` and `<TextInput>` components on Android.
ReactViewGroup already implements this functionality so
we copied its implementation over into the ReactTextView
and ReactEditText classes.
**Test plan (required)**
Verified that the various border props work on Text and TextInput components in a test app.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/9658
Differential Revision: D3819993
Pulled By: lexs
fbshipit-source-id: 183b0aa95369dd781f03b5a1f0f409ab47284e39
Summary:
At the moment, posting RCTReloadNotification in any circumstance causes all RCTBridge instances to reload. This change scopes the notification to the bridge for which it was intended.
Closes https://github.com/facebook/react-native/pull/8762
Differential Revision: D3831914
fbshipit-source-id: ff29574f574ecd1a403057ddd0458dea38f0136e
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:
Similar to the Hero image functionality. If a video URL is present in the post metadata, it will be displayed instead of a Hero image. This will be useful when highlighting videos in blog posts.
Renamed ReadMoreLink into a more generic ExceptLink which will display "Watch video" when the blog post category is "videos".
Currently there is no way of listing blog posts by categories, but it may be useful to do so later once we have a larger catalog of content.
Closes https://github.com/facebook/react-native/pull/9794
Differential Revision: D3828862
Pulled By: mkonicek
fbshipit-source-id: 1a88aab5edcdf7c84bb679263d6b97d52cf201a2
Summary: It's called `timestamp` on iOS, making it consistent.
Reviewed By: foghina
Differential Revision: D3820937
fbshipit-source-id: 2805f1fc10d6445d8b31676e0e3dca348510ffe7
Summary: Casting to long too early here and dropping some precision, resulting in skipped (not dropped) frames.
Reviewed By: sahrens
Differential Revision: D3819153
fbshipit-source-id: 83676cf4c9129638348890c74d563db121049e4a
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