Summary:
Syncs the latest changes from the React GitHub repo and takes a dependency on React 16 alpha.
I had to hide the type checker stuff behind `__DEV__` because they now throw in production.
Also disabled flow for findNodeHandle for now since we have some further clean up to do.
Reviewed By: spicyj
Differential Revision: D4526535
fbshipit-source-id: af5d282e75afbb293560b62fc72657461c24bdd1
Summary: Add simple `getRegistry()` so that add can do some custom handling of the registered components, if appropriate.
Reviewed By: shergin
Differential Revision: D4550600
fbshipit-source-id: 367c66b9fddfe4cc81cbc32a7a6043215e0df666
Summary: Makes it easy to render separators between sections, as opposed to between items.
Reviewed By: yungsters
Differential Revision: D4555707
fbshipit-source-id: 34572ab4b2c5b47db640543149fe2551c34ccf7b
Summary:
The PR description has been updated to reflect the new approach.
**Breaking Change Summary**
On Android, the following properties now return a different number:
- `Dimensions.get('window').fontScale`
- `Dimensions.get('screen').fontScale`
- `PixelRatio.getFontScale()`
This is a breaking change to anyone who was using these properties because the meaning of these properties has now changed.
These properties used to return a value representing font scale times density ([`DisplayMetrics.scaledDensity`](https://developer.android.com/reference/android/util/DisplayMetrics.html#scaledDensity)). Now they return a value representing just font scale ([`Configuration.fontScale`](https://developer.android.com/reference/android/content/res/Configuration.html#fontScale)).
**PR Description**
This PR changes a few things:
- Correctly exposes the font scale to JavaScript as `Dimensions.get('screen').fontScale`. UIManager was exporting `DisplayMetrics.scaledDensity` under the name `fontScale`. How
Closes https://github.com/facebook/react-native/pull/11008
Differential Revision: D4558207
Pulled By: astreet
fbshipit-source-id: 096ce7b28051325dfd45fdb2a14b5e9b7d3bc46f
Summary:
The index is used to make sure the layout corresponds to the correct index, which can get
out of sync if cell layout is cached and then cells are re-ordered.
Reviewed By: bvaughn
Differential Revision: D4554721
fbshipit-source-id: 9acb37f390a6e40ad89f813b78f81b399ec11e9a
Summary:
Simple API takes structured `sections` prop instead of `data` array. `sections` is an array of
`Section` objects, each of which has a `key` and an `itemData` array which is analogous to a
`FlatList` `data` prop, plus optional props like `ItemComponent` that can be overridden on a
per-section level, allowing heterogeneous section item rendering via clean composition.
Flattens the sections data and renders with VirtualizedList under the hood. Doesn't support
sticky headers yet.
Reviewed By: yungsters
Differential Revision: D4519354
fbshipit-source-id: 58de959dadb6f55f681245ecd99a5dc356a48f36
Summary:
What existing problem does the pull request solve?
It fixes some formatting issues that appear in the React Native documentation.
**Test plan**
Run the documentation extraction and verify the content appears correctly as `code` formatted sections.
Closes https://github.com/facebook/react-native/pull/12346
Differential Revision: D4553340
Pulled By: hramos
fbshipit-source-id: b8307b3c3e1c3451f740c46222e10ec3c45e3008
Summary:
Simple cleanup for AppRegistry.
Also added `registerSection()` helper to mark registered components as app-specific sections. Sections can be treated in many custom ways, e.g. they could just indicate the top level tabs, or something else. A bunch of helpers are also added.
Reviewed By: yungsters
Differential Revision: D4542788
fbshipit-source-id: 07addecb78a7514e973335bca24414fd8db40997
Summary:
iOS return all 0 metrics for <Text> inside <Text>, which results immediate `onPressOut` event on press in. These kind of response should be ignored
this solved issue #11462
Closes https://github.com/facebook/react-native/pull/11530
Differential Revision: D4541452
Pulled By: ericvicenti
fbshipit-source-id: efd7bf1b380b1aecf7301b23f1fbd5a77a9e9095
Summary:
Flow was complaining about an interpolated value I created in a class constructor, and I realized there was no way to properly import the `AnimatedInterpolation` class type. This allows for using `Animated.Interpolation` as a type to match `Animated.Value`
Closes https://github.com/facebook/react-native/pull/9360
Differential Revision: D4538770
Pulled By: lacker
fbshipit-source-id: 49da2374f2d73ad3d667dafaa6338b77b9aec8a8
Summary:
I discovered this while trying to pinpoint why Nuclide Inspector integration with RN is so flaky. It turns out that, for some reason, if I create a `WebSocket` instance early enough (which I need to when setting up DevTools integration), and the connection is fast enough (which it is on localhost), the `websocketOpen` message may arrive earlier than an `onopen` event handler is registered, causing the `onopen` handler to never fire.
```
mkdir ~/my-server
cd ~/my-server
npm i ws
nano index.js
```
Paste this code:
```js
const ws = require('ws');
const wss = new ws.Server({
port: 8099
});
```
Run the server:
```js
node index.js
```
Now, inside React Native, paste right after [these lines](57010d63b6/Libraries/Core/InitializeCore.js (L193-L194)):
```js
const ws = new window.WebSocket('ws://localhost:8099');
ws.onopen = function() {
alert('open!');
};
```
Closes https://github.com/facebook/react-native/pull/12305
Differential Revision: D4536554
Pulled By: gaearon
fbshipit-source-id: 3021fa26b3bf275cba3704a7f3a30c77db69a1f8
Summary:
added context for easier understanding as 'ellipsizeMode' appears before 'numberOfLines' in https://facebook.github.io/react-native/docs/text.html
Explain the **motivation** for making this change. What existing problem does the pull request solve?
Upon first reading the Text docs, the ellipsizeMode function is confusing. This update aims to remove the confusion.
Closes https://github.com/facebook/react-native/pull/11881
Differential Revision: D4533700
Pulled By: lacker
fbshipit-source-id: 948df16235a0ba02c14e630518bbd7261bc2b802
Summary:
findNodeHandle is considered an internal module. The one to use is ReactNative.findNodeHandle. We need to rely on this because we will have two different renderers and we need the renderers to inject themselves with findNodeHandle before it is used.
I use ReactNative.findNodeHandle from inside the module because I think this leads to a cycle somewhere or might not play well with inline require otherwise.
There is also one in UIManager but that is definitely a cycle so I'm going to try to avoid that one.
Reviewed By: spicyj, bvaughn
Differential Revision: D4533911
fbshipit-source-id: f771641ea5c5366ccbaff68c42202fa6f8c18cb3
Summary:
Looks like a recent change in Yoga causes the height of an absolutely positioned fullscreen view to break.
This works around the issue by using the newly introduced percentage `height` instead.
Reviewed By: jingc
Differential Revision: D4530240
fbshipit-source-id: 86d758576c6984686f30d7504e11f9ec3ce469bd
Summary:
React Native 0.39 introduced a breaking change through a new C-based implementation of css-layout. Developers were encouraged to remove unnecessary flex: 1 styles where no longer required to address any resulting layout issues.
The SwipeableListView has not yet been updated to reflect this change. Specifically, SwipeableRow still sets flex: 1 even though it shouldn't.
This was resulting in a rendering issue for folks when they upgraded to React Native 0.39 and used SwipeableListView that caused significant initial flickering when rendering a SwipeableListView. The solution was simply to remove flex: 1 from the SwipeableRow implementation.
This small change removes flex: 1 to resolve this issue.
Suggested reviewer (initial SwipeableListView contributor): fred2028
See this issue for more details: https://github.com/facebook/react-native/issues/11441
Closes https://github.com/facebook/react-native/pull/11521
Differential Revision: D4532562
Pulled By: lacker
fbshipit-source-id: 5c2907186d00481a731bd81794947a019465a031
Summary: We deprecated `transformMatrix` and `decomposedMatrix` in D3239960 10 months ago. This revision finally removes remains of this functionality from native code.
Reviewed By: mmmulani
Differential Revision: D4515760
fbshipit-source-id: b4d5b7e834ac4a775f4992b28270b4ff961889a6
Summary: Now layout direction (LTR or LTR) can be specified not only for whole app but also for view subtree via `direction` style property.
Reviewed By: mmmulani
Differential Revision: D4510206
fbshipit-source-id: 4e56c5886b6e42f2343165eb76be897e681c5ba4
Summary:
The stall watchdog is handy to detect stalls, but it doesn't really tell us what was
happening. This diff makes it easy to track React perf and bridge traffic during any stall, and
prints it out if the stall exceeds the threshold.
Reviewed By: yungsters
Differential Revision: D4479439
fbshipit-source-id: 87f94913ec341a648d7744249597dc30b29759ab
Summary:
Corresponding iOS PR: https://github.com/facebook/react-native/pull/11002
This adds an onScroll event to TextInput which is useful when a multiline TextInput has so much content that it is scrollable.
**Test plan (required)**
Verified the event works properly in a test app. Also, my team uses this event in our app.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/11001
Differential Revision: D4220941
Pulled By: mkonicek
fbshipit-source-id: 7e420579946f2ae840c9e1fcdc8afab68007da17
Summary:
We really need a better list view - so here it is!
Main changes from existing `ListView`:
* Items are "virtualized" to limit memory - that is, items outside of the render window are unmounted and their memory is reclaimed. This means that instance state is not preserved when items scroll out of the render window.
* No `DataSource` - just a simple `data` prop of shape `Array<any>`. By default, they are expected to be of the shape `{key: string}` but a custom `rowExtractor` function can be provided for different shapes, e.g. graphql data where you want to map `id` to `key`. Note the underlying `VirtualizedList` is much more flexible.
* Fancy `scrollTo` functionality: `scrollToEnd`, `scrollToIndex`, and `scrollToItem` in addition to the normal `scrollToOffset`.
* Built-in pull to refresh support - set set the `onRefresh` and `refreshing` props.
* Rendering additional rows is usually done with low priority, after any interactions/animations complete, unless we're about to run out of rendered content. This should help apps feel more responsive.
* Component props replace render functions, e.g. `ItemComponent: ReactClass<{item: Item, index: number}>` replaces `renderRow: (...) => React.Element<*>`
* Supports dynamic items automatically by using `onLayout`, or `getItemLayout` can be provided for a perf boost and smoother `scrollToIndex` and scroll bar behavior.
* Visibility callback replaced with more powerful viewability callback and works in vertical and horizontal mode on at least Android and iOS, but probably other platforms as well. Extra power comes from the `viewablePercentThreshold` that lets the client decide when an item should be considered viewable.
Demo:
https://www.facebook.com/groups/576288835853049/permalink/753923058089625/
Reviewed By: yungsters
Differential Revision: D4412469
fbshipit-source-id: e2d891490bf76fe14df49294ecddf78a58adcf23
Summary:
The back view in <SwipeableRow /> should not be rendered unless the front view has been
rendered and its layout has been measured.
Reviewed By: fred2028
Differential Revision: D4509584
fbshipit-source-id: 72ad0c8e7dec258ae3a1ba88c0adeb9ad0bfdf6d
Summary:
Added a note to the `refreshControl` prop on ScrollView to call out that the prop only works for vertical ScrollViews.
Fixes#12139
Closes https://github.com/facebook/react-native/pull/12150
Differential Revision: D4508796
Pulled By: mkonicek
fbshipit-source-id: 8e71692f29ee175e32177c3a26a4ed2e8d14f139
Summary:
The `extractOffset` method is previously implemented on `Animated.Value`, along with `setOffset` and `flattenOffset`. Both of the latter methods are proxied on `Animated.ValueXY`, but `extractOffset` is not. This commit adds the missing method.
When creating draggable elements in XY space, in order to compensate for previous gestures' offsets, we currently need to do something like the following at the beginning or end of each gesture:
```
xy.setOffset(xy.__getValue());
xy.setValue({x: 0, y: 0});
```
After this commit, the API is equivalent to using a plain `Animated.Value`:
```
xy.extractOffset();
```
Closes https://github.com/facebook/react-native/pull/12193
Differential Revision: D4508717
Pulled By: mkonicek
fbshipit-source-id: 0976cf1ab68538e59023ffaa2539eb62779ad874
Summary: Exports Flow types for the props related to accessibility.
Reviewed By: fkgozali
Differential Revision: D4498562
fbshipit-source-id: 2fb6e78d4ceaf9f26b6ea88d515b7b28f570de52
Summary: Fixes the prop type of `accessibilityLabel` in `<Image>` so that it matches that of `<View>`.
Reviewed By: fkgozali
Differential Revision: D4499103
fbshipit-source-id: 66bf3dce60bd79857849e0c46c989e7866d83d81
Summary:
This improves JS validations of the transform object and makes it a bit stricter (hence the breaking change). When moving transform objects parsing to native (#10658) the validations got out of sync a bit, this makes sure JS validations are the same or stricter than the native ones to make sure we get consistent errors across platforms.
See #12110 for an example of an error that now gets caught by JS validations.
Also added snapshot tests for the errors to make sure `processTransform` throws when passing invalid values. It only tests the validation since the object parsing is now done natively for iOS and Android.
**Test plan**
Test that there are no errors in UIExplorer
Run new unit tests
Closes https://github.com/facebook/react-native/pull/12115
Differential Revision: D4488933
Pulled By: mkonicek
fbshipit-source-id: a714e6175b2892284a44c870506165099efec1ed
Summary:
This moves the `src` directory one level up and removes the `react-packager` folder. Personally, I always disliked this indirection. I'm reorganizing some things in RNP, so this seems to make sense.
Not sure if I forgot to update any paths. Can anyone advice if there are more places that need change?
Reviewed By: jeanlauliac
Differential Revision: D4487867
fbshipit-source-id: d63f9c79d6238300df9632d2e6a4e6a4196d5ccb