Summary:
Returning an object that doesn't have all the required properties from `getItemLayout` doesn't cause a flow error (maybe because we are using `createAnimatedComponent`) and caused ALL items to be rendered which caused perf issues that were hard to debug (typo lenght -> length -_-). This adds a simple warning in DEV mode using checkPropTypes.
**Test plan**
Tested in RNTester by passing a bad `getItemLayout` function.
![image](https://cloud.githubusercontent.com/assets/2677334/26329030/5b32ba90-3f13-11e7-9190-08f05a5c0682.png)
Closes https://github.com/facebook/react-native/pull/14111
Differential Revision: D5283942
Pulled By: sahrens
fbshipit-source-id: 8909532dfddd8628b7fb3380c198f0dfa88f240a
Summary:
Subview clipping still causes issues on Android and would be pretty hard to fix properly, I investigated this a bit and sticky header views are getting removed because it doesn't take transform into consideration. It would also require to recalculate subview clipping on every transform change so I think it is better to just disable subview clipping in when there are sticky headers, especially since we seem to be moving away from subview clipping with things like FlatList.
**Test plan**
Tested that sticky headers work in ListView paging example.
Fixes#14000
Closes https://github.com/facebook/react-native/pull/14010
Differential Revision: D5283723
Pulled By: sahrens
fbshipit-source-id: 183b3202765ae09aaae05497694c3f514e969ea1
Summary:
Curently FlatList does not implement setting native props directly like the old ListView did. This pr introduce the `setNativeProps` function which delegates to MetroListView or VirtualizedList. Thos don't have `setNativeProps` handling either, so, I delegated further to the respective ListView and Scroll components, which do have handling for it, thus, allowing to set the native props through FlatList.
Create a project with a FlatList and change a native property using `setNativeProps`:
```javascript
componentDidMount() {
setInterval(() => {
this.list.setNativeProps({ style: {backgroundColor:"white"} })
}, 1000)
}
render() {
return (
<View style={styles.container}>
<FlatList ref={component => this.list = component}
style={{backgroundColor:"black"}}
data={[{key: 'a'}, {key: 'b'}]}
renderItem={({item}) => <Text>{item.key}</Text>} />
</View>
)
}
```
Fixes#13501
Closes https://github.com/facebook/react-native/pull/13529
Differential Revision: D5283593
Pulled By: sahrens
fbshipit-source-id: 8f96f88e286042d82452fef924689b5a8a783987
Summary:
<details>
Thanks for submitting a PR! Please read these instructions carefully:
- [ ] Explain the **motivation** for making this change.
- [ ] Provide a **test plan** demonstrating that the code is solid.
- [ ] Match the **code formatting** of the rest of the codebase.
- [ ] Target the `master` branch, NOT a "stable" branch.
Please read the [Contribution Guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md) to learn more about contributing to React Native.
</details>
_What existing problem does the pull request solve?
In iOS when sending a silent push notification you need to configure the 'content-available' APS key to the value of 1 (When this key is present, the system wakes up your app in the background and delivers the notification to its app delegate, see [apple docs](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html#//apple_ref/doc/uid/TP40008194-CH17-SW1)).
This PR exposes this property to the notification event handler so app code can handle silent push scenario specifically. Currently this property is not available.
I've updated the PushNotificationIOSExample in the RNTester.
1. Open RNTester in xcode
2. Enable the push notifications capability
3. run on device
4. Go to PushNotificationIOS
5. click on "send fake notification"
6. verify alert message contains 'content-available' with a value of 1.
Closes https://github.com/facebook/react-native/pull/14584
Differential Revision: D5279181
Pulled By: shergin
fbshipit-source-id: d2288e147d89ba267f54265d819aa0a9969095e7
Summary:
When rendering a large list without a getItemLayout (ie SectionList, where it's hard to compute), it freaks out and attempt to render them all, starving the rendering/layout engine from computing the size (and more accurately figurnge out how few it actually should render.)
Before this change, with <FlatList maxToRenderPerBatch={5} data={objectOfLengthN} />, I essentially saw it doing:
```
{first: 0, last: 0}
{first: 0, last: 5}
{first: 0, last: 10}
....
{first: 0, last: N}
```
(no more hiPri renders since all elements have been rendered)
(actually renders and lays out all N objects, and computes their sizes)
(realizes that it doesn't need to show all N for my current screen size and row size)
```{first: 0, last: 55}```
After this change, that whole first part where it keeps incrementing `last` to try to "keep up with the scrolling" disappears.
Closes https://github.com/facebook/react-native/pull/14563
Differential Revision: D5278796
Pulled By: sahrens
fbshipit-source-id: 5db117b40909ec4bc92fba9b5556c6a2add046ac
Summary:
The React Native Remote Debugger page (`debugger.html`) contains an embedded silent sound file to maintain tab priority in Google Chrome.
This revision simply replaces the existing one with a better one that has the following characteristics:
- 1s Duration
- 10Hz Frequency
- -48dBFS Amplitude
- Fades in/out to reduce audible clicks on loop.
- 44.1kHz @ 16bit to maximimize compatibility.
- Smaller size.
Much thanks to Stephane Pigeon (http://stephanepigeon.com/) for designing the sound file specifically for this use case.
Reviewed By: mmmulani
Differential Revision: D5273591
fbshipit-source-id: 81668cc0a829e008263907fc1fa7150b72691371
Summary:
Clarified documentation for keyboardWillShow on Android as seen in issue #14275
Clarifies documentation of keyboardWillShow
None as it is just a comment that changed.
Closes https://github.com/facebook/react-native/pull/14350
Differential Revision: D5275173
Pulled By: shergin
fbshipit-source-id: d4fb08de71e6be40bb363dfc82d38b191570c476
Summary:
Replace object with cached styles from StyleSheet
Create new style object may cause performance problems
Check that ImageBackground position works the same way.
Closes https://github.com/facebook/react-native/pull/14486
Differential Revision: D5274503
Pulled By: shergin
fbshipit-source-id: 09b81e6f7ae2ada7f68854e409909caafd85e56a
Summary: Upgrades `babel-transform-react-native` to v2.0.0, which exposes a factory function. That way, the preset will include/exclude dev tools according to `process.env.NODE_ENV` even when that value changes over time.
Reviewed By: cpojer
Differential Revision: D5246801
fbshipit-source-id: 74a1e7e0fb1476750e1fe21ce4befd475907b415
Summary:
The overflow: visible option does not work on Android. This just add a little note to the docs of that property to make that clear.
See #3198 and https://react-native.canny.io/feature-requests/p/add-overflow-support-to-android .
Make it clear that this property is unavailable on Android. We had to figure this out by trial and error when porting an existing codebase, a small note in the docs would be helpful!
I could not find how to build the website - I tried `cd website && npm install && node ./server/generate.js` but I'm getting an error (*JSDOC_ERROR: There are no input files to process.*). But it is such a small change I can't see how it would break the docs build!
Closes https://github.com/facebook/react-native/pull/14103
Differential Revision: D5225814
Pulled By: shergin
fbshipit-source-id: a3136e791178d2a7090f324041be23628130199e
Summary:
The only thing I found in the spec for this change is the following. Not exactly sure if this is the thing this PR is about:
> For each flex item, subtract its outer flex base size from its max-content contribution size. If that result is not zero, divide it by (if the result was positive) its **flex grow factor floored at 1** or (if the result was negative) by its scaled flex shrink factor, having **floored the flex shrink factor at 1**. This is the item’s max-content flex fraction.
But at least it seems a required change.
Fixesfacebook/yoga#566
Closes https://github.com/facebook/yoga/pull/572
Differential Revision: D5264388
Pulled By: emilsjolander
fbshipit-source-id: 0004d1c3b9bad070a98cd6766c1adc06a54475f8
Summary:
WTF
(I updated it to the latest version too)
Reviewed By: yungsters
Differential Revision: D5256525
fbshipit-source-id: f3c7d620faf817a0e3c1e4c2bed9370318dff40a
Summary:
C++ doesn't provide an implicit cast to an enum value from the enum's backing type. When a `.mm` file calls `RCT_ENUM_CONVERTER`, we end up with the following compiler error:
> Error: cannot initialize return object of type `<TypeName>` with an rvalue of type `NSInteger`
Since `RCT_ENUM_CONVERTER` is a macro, this error will appear whenever we try to expand the macro in a C++ context.
The project compiles and runs as expected when this additional cast is added 😃
Closes https://github.com/facebook/react-native/pull/14408
Reviewed By: javache
Differential Revision: D5215584
Pulled By: jballer
fbshipit-source-id: 7f4464afd7cd9dc9a014f646278bae20731f08ba
Summary: This is to help debug the root cause of https://github.com/facebook/react-native/issues/14423
Reviewed By: javache
Differential Revision: D5254713
fbshipit-source-id: 1ca90205144b3a069d927ba6636f0ef0138b51a0
Summary:
See https://github.com/facebook/react-native/issues/14326 for the bug
this fixes. This is a pretty ugly hack to work around what I think is
a CP bug. Since the C++ dependencies are only needed to build RN
itself, and not applications, don't the conflicting headers as source
files. Instead, use preserve_paths to get them unpacked into the
source tree under Pods/<Pod>, and arrange for them to get used with
HEADER_SEARCH_PATHS. This keeps them out of the project, so they
don't get included in the header map, and other (badly structured)
projects don't get confused.
Reviewed By: javache
Differential Revision: D5254716
fbshipit-source-id: cf33dcbcc71b5247843650c33ccf4fb08378e584
Summary:
The docs don't have a section about `Platform.Version` on iOS, but it's available.
Very simple change. I've used the section for Android as an example.
Closes https://github.com/facebook/react-native/pull/14437
Differential Revision: D5250499
Pulled By: hramos
fbshipit-source-id: 29d1323e443fc1c5710283515c4233a192d354a0
Summary:
Consolidate tips on CONTRIBUTING.md, and reduce the wall of text when opening a new issue. Hoping this will encourage more people to read through the text.
Closes https://github.com/facebook/react-native/pull/14518
Differential Revision: D5250443
Pulled By: hramos
fbshipit-source-id: 91213c4ceca12225d9f54d1e1e81e020c6e463b3
Summary: Makes `babel-preset-react-native` a factory function that allows to include/exclude dev tool transforms per transform.
Reviewed By: jeanlauliac
Differential Revision: D5237158
fbshipit-source-id: aa7be0fc0f471575b4ee1c5a0e266e2ed2477fc6
Summary:
`retainLines` is no longer necessary with the much improved source map generation.
`sourceMaps` is handled by the transformer itself.
Reviewed By: cpojer
Differential Revision: D5237103
fbshipit-source-id: e5c6bf5aa9d553fce9c3f4d59b3ea0057d45cfdc
Summary: It's now unnecessary to declare which JS modules you want to expose on your package. To upgrade, remove all overrides of `createJSModules` and keeping calling your JS modules as before.
Reviewed By: AaaChiuuu
Differential Revision: D5229259
fbshipit-source-id: 1160826c951433722f1fe0421c1200883ba1a348