Commit Graph

3462 Commits

Author SHA1 Message Date
Chris Knepper cc1a4b0915 Clarify documentation for ScrollView component
Summary:
The documentation for the prop `scrollEnabled` on the `ScrollView` component does not clarify that scrolling is still possible by calling `scrollTo` on the view ref.

Please see [this expo snack demo](https://snack.expo.io/BJKTVMM-Z) showing scrolling is allowed while `scrollEnabled` is `false`.

This PR makes the documentation for this prop more clear, in that setting it to false will only disable scrolling by touches, not universally.

In my opinion, this also raises the question of a need for an additional prop which would disable all scrolling, even when calling `scrollTo`.

I have attached a screenshot of what this part of the documentation looks like with my edit:

![screen shot 2017-05-23 at 3 38 59 pm](https://cloud.githubusercontent.com/assets/4976096/26374045/e73a035e-3fd1-11e7-93cd-3617c4ac4db8.png)
Closes https://github.com/facebook/react-native/pull/14140

Differential Revision: D5138593

Pulled By: shergin

fbshipit-source-id: db1a5f9c8ac41ecfce952e7b1fce9428b2068162
2017-05-26 12:48:37 -07:00
Brian Vaughn 94c565a2c4 Flat ReactNative renderer bundle [WIP]
Reviewed By: trueadm

Differential Revision: D5013497

fbshipit-source-id: 1e23b08751b8b6e2dd570ff584c815c8a9b8f35f
2017-05-26 11:03:06 -07:00
Janic Duplessis c87524e0a6 Native Animated: Prevent views driven by native animated from being optimized away
Summary:
When using native animated we don't go through the shadow thread and use the NativeViewHierachyOptimizer so we have to make sure the views won't get optimized away. Also since we are not passing certain props because they are driven by native it is possible that the view will be marked as layout only when in fact it is not.

**Test plan**
Animated a simple view that will be collapsed with native animated and reproduce the error (it's actually just an error log in logcat now and no longer a redscreen) and checked that this fixes it.

Fixes #12975
Closes https://github.com/facebook/react-native/pull/12983

Differential Revision: D4811420

Pulled By: javache

fbshipit-source-id: f217f244baca64df2b76cbe08cce2d847c0dc985
2017-05-26 04:46:51 -07:00
Janic Duplessis 11424a8bc6 Native Animated - Support Animated.loop on iOS
Summary:
Follow up to #11973 to add support to Animated.loop with useNativeDriver on iOS.

**Test plan**
Test with new UIExplorer example
Run unit tests
Closes https://github.com/facebook/react-native/pull/13359

Differential Revision: D4960754

Pulled By: javache

fbshipit-source-id: caa840281f1b060df7a2b1c50405fcae1e1b0de6
2017-05-26 03:30:33 -07:00
Adam Comella e40d1a1065 iOS: Introduce API for moving screen reader's focus
Summary:
This change introduces an API, `setAccessibilityFocus`, which moves the screen reader's focus to the passed in element. This causes VoiceOver to announce the element and draw a focus rectangle around it.

Similar functionality is already available in RN Android through the `sendAccessibilityEvent` method. Here's an example of what exists today in RN Android:

```
RCTUIManager.sendAccessibilityEvent(
  node,
  8 /* TYPE_VIEW_FOCUSED */);
```

Called `setAccessibilityFocus` on a couple of elements to verify that focus does indeed move when VoiceOver is enabled. Additionally, my team is using this change in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14169

Differential Revision: D5137002

Pulled By: javache

fbshipit-source-id: 466e8b187e625de7c0f0d36e0400327dcd8d192a
2017-05-26 03:19:21 -07:00
Jason Noah Choi ff78a8de22 Add newly recommended method for RCTLinkingManager due to deprecation
Summary:
What existing problem does the pull request solve?

Beginning in iOS9, Apple has deprecated `-application:openURL:sourceApplication:annotations:`

`- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(id)annotation NS_DEPRECATED_IOS(4_2, 9_0, "Please use application:openURL:options:") __TVOS_PROHIBITED;`

This PR uses the newly recommended method:

`- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)`

while meanwhile, leaving the deprecated one for developers wishing to use the older `-application:openURL:sourceApplication:annotations:` for apps that support versions 8.x or less.

Benefits will include:
- [x] less warnings
- [x] official deprecation should happen when iOS 11 is deployed
- [x] TVOS support
Closes https://github.com/facebook/react-native/pull/13615

Differential Revision: D4987980

Pulled By: javache

fbshipit-source-id: ae07715a55ca627860262a9c8cf7df1e3c5e752b
2017-05-25 11:31:23 -07:00
Daniel Zlotin 9b4a644fec XMLHttpRequest withCredentials defaults to "true"
Summary:
see https://github.com/facebook/react-native/issues/14063
Closes https://github.com/facebook/react-native/pull/14064

Differential Revision: D5117654

Pulled By: ericvicenti

fbshipit-source-id: 7c3d376f5251e3b28c34383c5b58658e17d6c032
2017-05-25 11:01:14 -07:00
Caleb Meredith f702cbecba Render section footer in <SectionList> sections with no data
Summary:
Fixes https://github.com/facebook/react-native/issues/13784

The section footer was only rendered with the last item of the section. However, that meant in sections where no items were rendered, no section footer would be rendered. This patch makes sure that when there are no items the section footer is rendered with the section header in addition to adding tests asserting the existance of section footers in empty lists.

One potential point of contention is whether or not a section separator (as defined by the `SectionSeparatorComponent` prop to `<SectionList>`) should be rendered in an empty list. I did not include a section separator for empty lists, but let me know if you think one should be included. See the test plan below for an image of an empty section rendered without a section separator.

I was also running into a lint error, `no-alert`, in `SectionListExample.js` around line 135 that blocked me from publishing. This error looks to be triggered when the `alert()` global function is called, so to fix the error I added an import for the `Alert` module and called the `alert()` function on that module.

To help debug the `scrollToLocation()` behavior that was modified as a part of this PR I added three buttons (can be seen in the test plan image) which scroll to arbitrary points in the list.

Reviewed By: sahrens

Differential Revision: D5084095

fbshipit-source-id: 4c98bebc1c3f1ceaa5a634fa144685d83d1072df
2017-05-25 10:30:55 -07:00
Marcus do Nascimento 3c64d95413 Exposes requestAuthorization method.
Reviewed By: javache

Differential Revision: D5129014

fbshipit-source-id: 1e0be6a8a00a2f38ca7b5b20d891148c5ba97467
2017-05-25 07:07:50 -07:00
Pieter De Baets 7837bdbf7c Add error message when calling sync methods from the Chrome debugger
Reviewed By: yungsters

Differential Revision: D5123286

fbshipit-source-id: a7ac3fcc0b18e8d9562d99eb60268a3d98b3d647
2017-05-25 06:18:36 -07:00
Janic Duplessis fc45471af2 Native Animations - Fix edge case with restore default values
Summary:
There was an edge case where sometimes a view could be added and removed in the same batch so this caused issues because we ran `disconnectAnimatedNodeFromView` before `connectAnimatedNodeToView`. This separates restoring default values from `disconnectAnimatedNodeFromView` so we can run only `restoreDefaultValues` on the pre-operations queue and just do nothing in case the view doesn't exist (it is fine because we know it will be removed immediately).

**Test plan**
Tested that native animations still work properly in RNTester and tested that the edge case crash was fixed.
Closes https://github.com/facebook/react-native/pull/14114

Differential Revision: D5128989

Pulled By: javache

fbshipit-source-id: 9f47a2d3aafeb06d8ed1a4dd1800b8af225edb7d
2017-05-25 06:18:36 -07:00
ashoat 803a9168f2 Pass data prop instead of props to _updateViewableItems in _onScroll
Summary:
This is a simple bugfix. `_updateViewableItems` expects the `data` prop, as it calls `getItemCount` on it. Without this, `onViewableItemsChanged` updates twice for each scroll position, once from `_onScroll` with the incorrect results, and once from `_updateCellsToRender` with the correct results. This means the callback nigh-on unusable.

I simply logged the results of `onViewableItemsChanged` and made sure they were correct.
Closes https://github.com/facebook/react-native/pull/14162

Differential Revision: D5128363

Pulled By: sahrens

fbshipit-source-id: 3faef812068921a26ed871339da79870fd0d911c
2017-05-25 03:15:22 -07:00
david 7cddaa02d6 call toString on fontWeight else throws error if passed an integer
Summary:
expects a string, throws error NSNumber cannot be converted to NSString if passed an integer, added toString() method to allow integers, and keep consistency, fontSize allows int.
Closes https://github.com/facebook/react-native/pull/10483

Differential Revision: D5128581

Pulled By: shergin

fbshipit-source-id: 21b1ddd35210c8f061506d71b936cc0ff490d999
2017-05-25 01:34:53 -07:00
Xinbo Wang eac399b696 Add flexWrap warning
Reviewed By: sahrens

Differential Revision: D5117970

fbshipit-source-id: 11b542bd6cd7b1ab22ba8f6822d471df94fa7da2
2017-05-25 00:00:38 -07:00
Francisco Sales 457616fe5f Adding supported formats to Image component docs
Summary:
The lack of very clear docs on supported image formats is causing unnecessary issues (#13806).
This should mitigate and keep the issue list cleaner.

Its only a documentation change. No code changes made.
Closes https://github.com/facebook/react-native/pull/13807

Differential Revision: D5023002

Pulled By: javache

fbshipit-source-id: b1e3562ae7649cf71833b300e125966d6e832a69
2017-05-24 12:18:14 -07:00
Valentin Shergin 9637dd4a1b Introducing <ImageBackground>, replacement for <Image> which supports nesting views
Summary:
We are removing support of nesting views inside <Image> component. We decided to do this because having this feature makes supporting `intrinsinc content size` of the `<Image>` impossible; so when the transition process is complete, there will be no need to specify image size explicitly, it can be inferred from actual image bitmap.

And this is the step #0.

<ImageBackground> is very simple drop-in replacement which implements this functionality via very simple styling.
Please, use <ImageBackground> instead of <Image> if you want to put something inside.

Reviewed By: yungsters

Differential Revision: D5100021

fbshipit-source-id: 640c0fb2d1066e166d974efba39b4cfaaee7dd45
2017-05-24 11:30:48 -07:00
Seraj Ahmad 047961fbf7 Added Cookie Header to XML and Websocket request
Summary:
Continuation of Pull Request #7167

https://github.com/facebook/react-native/pull/7167

Needed to clean my repository. So created this Pull Request
Closes https://github.com/facebook/react-native/pull/10575

Differential Revision: D4955291

Pulled By: shergin

fbshipit-source-id: 94b9a086b7cf70ee6cc152d0b1a36c260140450e
2017-05-24 09:47:37 -07:00
James Isaac 48156b7967 Fix ScrollView documentation markup
Summary:
Documentation for `ScrollView` was not correctly marked up, causing it to render incorrectly on the website.  See for example https://facebook.github.io/react-native/docs/scrollview.html#keyboarddismissmode - what should be a bullet list of possible values has been collapsed into a single paragraph.

I've added the missing linebreaks and backticks, for consistent formatting with other documentation pages, such as https://facebook.github.io/react-native/docs/view.html
Closes https://github.com/facebook/react-native/pull/14141

Differential Revision: D5120360

Pulled By: javache

fbshipit-source-id: 74b0f87c2a34f59ddf540ee2575b1b61c37d694f
2017-05-24 05:35:25 -07:00
Matt Mahoney 05ec85043b Add Prop type for View
Reviewed By: yungsters

Differential Revision: D5098891

fbshipit-source-id: 5e1304344744e57c4d7f97455f49e1444fb7a42b
2017-05-23 08:01:48 -07:00
Reem Helou a975c1e834 Fix Keyboard avoiding View component
Reviewed By: ericvicenti

Differential Revision: D5059434

fbshipit-source-id: 3720aa8ee60ed7cc9fd6c3ab7efa38986b806302
2017-05-22 13:18:22 -07:00
Jean Regisser fc09c54324 Document image blurRadius is working on Android too
Summary:
Hi,

I saw blurRadius is now working on Android. Updated the doc to show it.

It is available since 0.44, see 0b348095b6

See RNTester screenshot on Android:
![blur-android](https://cloud.githubusercontent.com/assets/57791/26244353/97fa4f96-3c8f-11e7-8910-5c60f5ad93fc.png)

Also I noticed it's a bit different than on iOS:
![blur-ios](https://cloud.githubusercontent.com/assets/57791/26244396/bbaf9158-3c8f-11e7-96cc-534d8ee042fb.png)

Looking briefly at the code, it looks like it's caused by the fact that the Android version applies blur to the original image data in full size (and applies `PixelUtil.toPixelFromDIP(blurRadius)`), but the iOS version applies it to the resized version.
I'll open an issue for this.
Closes https://github.com/facebook/react-native/pull/14055

Differential Revision: D5103240

Pulled By: javache

fbshipit-source-id: 16d8c8755cd27a4f13c28e8831017733327ca491
2017-05-22 05:45:29 -07:00
Neo 872fbc27fe fix stickySectionHeader re-render issue
Summary:
Close #13500

I've been bothered by this issue for quite a long time, finally get some time to look into it.

I find the root cause is that after a prop of the native driven node is assigned with a plain value, if you set it to be a `Animated.Value` again , it will take no effect any more, so I just keep it be a `Animated.Value` all the time.

`value --> Animated.Value () --> value () --> Animated.Value ()`

ping janicduplessis
Closes https://github.com/facebook/react-native/pull/13885

Differential Revision: D5077094

Pulled By: javache

fbshipit-source-id: 3fb5d8196d94101200394b2bb2b95c776fb1d2f3
2017-05-22 03:30:27 -07:00
Janic Duplessis 0518a0ba12 Fix sticky headers when rerendering
Summary:
There was an issue that sometimes sticky headers would stop moving when re-rendering because we did not reattach events properly. This makes sure that we always detach and reatach on rerender in case the scroll view ref changes.

**Test plan**
Tested that this fixes issues with sticky headers we discovered when updating Expo to RN 0.44.
Closes https://github.com/facebook/react-native/pull/14012

Differential Revision: D5094418

Pulled By: javache

fbshipit-source-id: a56050ae786712e8a3de2a6e3b4e8749a2fde86e
2017-05-19 03:35:04 -07:00
Gabe Levi 3ddc7d47d5 Fix react-native function call arity errors
Reviewed By: zertosh

Differential Revision: D5081816

fbshipit-source-id: 5978770c30a69fb287d03aa7511999ce30f856a1
2017-05-18 16:55:55 -07:00
Adam Perry ca2d57c744 Update examples in docs and address version lag of CRNA
Summary:
cc hramos

Pretty sure I've hit all of the places where AppRegistry is called in CRNA-pastable examples. Let me know whether you think we need to approach the version lag differently, I figure a caveat is as natural a place to call it out as any.

If you end up finding anything else that needs tweaking before cherry picking, I'm happy to push that up here too.
Closes https://github.com/facebook/react-native/pull/13744

Differential Revision: D5071038

Pulled By: hramos

fbshipit-source-id: 4a4a6f2a73079aca627f17d75a4e4b395ecbd4a8
2017-05-16 23:51:28 -07:00
Johan af949877e6 updated docs with iOS 10 compatible linking code
Summary:
Thanks for submitting a PR! Please read these instructions carefully:

- [x] Explain the **motivation** for making this change.
- [x] Provide a **test plan** demonstrating that the code is solid.
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch, NOT a "stable" branch.

The current code for IOS contains deprecated code for incoming urls.
in iOS 10 deprecated openURL.
more details here: https://useyourloaf.com/blog/openurl-deprecated-in-ios10/

1. Create an RN app with iOS 10. set up linking as per instructions.

2. Using the iOS9 code snippet, with the app is open, navigate to the apps url scheme (in safari)  appname://value1/value2, the eventListener will not trigger.  note: it will however trigger getInitialURL if app is closed.

3. Replace the old iOS9 code with the iOS 10 and trigger an incoming url from a browser appname://
with the new code in the doc it will trigger for both open and closed apps.
Closes https://github.com/facebook/react-native/pull/13942

Differential Revision: D5071851

Pulled By: hramos

fbshipit-source-id: 8394de73014a1d2a5982b22b1b6fd09e0cf524dd
2017-05-16 18:02:14 -07:00
Aaron Chiu 28c07f8698 allow inspector to show if not Systrace profiling
Reviewed By: gaearon

Differential Revision: D5060716

fbshipit-source-id: 9a00f80be8ef28da37d7aa672a4c0805182c1582
2017-05-15 05:16:48 -07:00
Arsen Ghazaryan 49e6d3965f Add missing license to UnimplementedView.js
Summary:
Added a missing license header to UnimplementedView.js

No code logic got changed, just added a comment. So the regular CircleCI tests should be fine.
Closes https://github.com/facebook/react-native/pull/13952

Differential Revision: D5056778

Pulled By: javache

fbshipit-source-id: feb106946a9a34cfdf2df63de21305ac779296f4
2017-05-12 17:49:03 -07:00
Spencer Ahrens 962e664c33 Fix prop-types warning in LayoutAnimation
Summary:
And clean it up.

**TestPlan**

No more warning when launching RNTester

LayoutAnimationExample still works, also without warnings.

Reviewed By: fkgozali

Differential Revision: D5055050

fbshipit-source-id: a3a6cdf25632dc4f9455d795e8a2e3c00f968e09
2017-05-12 15:06:17 -07:00
Aaron Chiu d334cdd590 remove yellow box from systrace
Reviewed By: alexeylang

Differential Revision: D5024794

fbshipit-source-id: 5551135c16adb6f93d2f5957171f41d63b9a6bf9
2017-05-11 21:00:50 -07:00
Aaron Chiu 105d219935 make systrace look more like prod
Reviewed By: alexeylang

Differential Revision: D5023354

fbshipit-source-id: ed9d4b43d042c9aa12d7c74901b026a105b31d9c
2017-05-11 15:21:27 -07:00
cailenmusselman f088bca580 ProgressBarAndroid checks indeterminate prop type manually
Summary:
Causes a YellowBox warning: "You are manually calling a React.PropTypes validation function for 'indeterminate' prop on 'ProgressBarAndroid'."

Initially reported here: https://github.com/facebook/react-native/issues/9692 but closed by the creator because he switched to using ActivityIndicator.

Fixed as per the guidelines here: https://facebook.github.io/react/warnings/dont-call-proptypes.html

```
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * flow
 */

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  View,
  ProgressBarAndroid
} from 'react-native';

export default class AwesomeProject extends Component {
  render() {
    return (
      <View style={styles.container}>
	<ProgressBarAndroid indeterminate={true} styleAttr="Horizontal"/>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1
  }
});

AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);

```
Closes https://github.com/facebook/react-native/pull/11791

Differential Revision: D4998602

Pulled By: davidaurelio

fbshipit-source-id: e210684e2f2497238e4d3d0adf2754075be81e98
2017-05-10 05:16:06 -07:00
Pieter De Baets 885856c6a1 More attempts to fix Travis CI runs
Summary:
* Add RCTBridge+Private to exported headers for unit tests
* Fix tvOS build
Closes https://github.com/facebook/react-native/pull/13840

Reviewed By: ericvicenti

Differential Revision: D5027887

Pulled By: javache

fbshipit-source-id: 7a17ee2f84eb1cb87e71373444ef25559959c24a
2017-05-10 04:32:54 -07:00
Spencer Ahrens d40a7ea7f9 TouchableHighlight needes to set _isMounted false when it unmounts.
Summary:
D5016368 to suppress the warning had a typo which meant `_isMounted` would never get set
`false` and thus some functions could be called on unmounted refs.

Reviewed By: yungsters

Differential Revision: D5034076

fbshipit-source-id: 6334db6ee2f9e19c1bb4da2572987dc10773e28d
2017-05-09 21:05:52 -07:00
Alexey Lang ffbb2a0ec1 Clean up unused metrics
Reviewed By: AaaChiuuu

Differential Revision: D5020126

fbshipit-source-id: decaa9dd4b2ba5c25eed24a29836a3e7bdba0233
2017-05-09 13:30:26 -07:00
Dan Abramov 074c3cef14 Work around a false positive warning
Summary:
This works around a false positive `isMounted()` deprecation warning when using latest React DevTools and selecting components in the hierarchy.

Before:

![screen shot 2017-05-09 at 7 03 39 pm 1](https://cloud.githubusercontent.com/assets/810438/25865249/3a5cc9e2-34ea-11e7-9930-6d0d8436b390.png)

After:

![screen shot 2017-05-09 at 7 02 54 pm](https://cloud.githubusercontent.com/assets/810438/25865274/4d2d573a-34ea-11e7-8bdd-807e32c54594.png)
Closes https://github.com/facebook/react-native/pull/13873

Reviewed By: bvaughn

Differential Revision: D5029550

Pulled By: gaearon

fbshipit-source-id: cbe941368e8204a335de17ad3d444580aef9d833
2017-05-09 12:38:07 -07:00
Valentin Shergin 712b1dd20a RCTUIManagerObserverCoordinator: new way to subscribe for granular notifications from UI Manager
Reviewed By: majak

Differential Revision: D4868591

fbshipit-source-id: 24a09ffa3e69dec5ce1f0a8715c7e4701d781996
2017-05-08 12:52:09 -07:00
Jiajie Zhu bd004568d3 fix warnings in create view
Reviewed By: fred2028

Differential Revision: D5016368

fbshipit-source-id: 60fae5769f66bf94de6fa2fe75a509862270c401
2017-05-08 11:31:21 -07:00
Valentin Shergin cf975bbd2e Fixed default placeholder text color for multiline <TextInput>
Reviewed By: javache

Differential Revision: D5018823

fbshipit-source-id: 6ad4a1e8d03b6429a436e0cfdd9a127cd5dc1c2b
2017-05-08 11:31:21 -07:00
Valentin Shergin 5058e7eb05 Several layout related helper methods of RCTShadowView was moved to new (+Layout) category.
Reviewed By: javache

Differential Revision: D4865327

fbshipit-source-id: 4df71b57433370ee09c3f1288c4d6241a33f440a
2017-05-08 11:31:20 -07:00
Eric Vicenti 4a80dceac7 Re-license and rename UIExplorer integration test app as RNTester
Reviewed By: yungsters

Differential Revision: D4950085

fbshipit-source-id: 44574b5d0ef0d2ad5dfc714309b18dc69cbad9ff
2017-05-08 11:31:19 -07:00
liushigit c7d37a208a Correcting a mistake in the minimal example in the FlatList doc
Summary:
The list items' selected state is inside the `selected` Map, not inside the `state`.

This PR corrects a small mistake in the minimal example in the Documentatioin of the FlatList component.

1. Create a vanilla React Native project.
2. Create the components involved in the minimal example of FlatList.
3. Run to see if the `selected` property of the `MyListItem` changes as intended.

Currently the example has this mistake so an error will show up when running:
![2017-05-05 2 00 12](https://cloud.githubusercontent.com/assets/5442413/25735154/c091f11a-319b-11e7-9646-427c6a56f901.png)
Closes https://github.com/facebook/react-native/pull/13795

Differential Revision: D5010105

Pulled By: javache

fbshipit-source-id: 09585cea2f2e3e6746419ef54ef8da9dbdb8dbb1
2017-05-05 11:49:26 -07:00
Pieter De Baets e7680131d7 Merge RCTPackagerClient into RCTPackagerConnection
Reviewed By: mmmulani

Differential Revision: D4988204

fbshipit-source-id: 78e0df5268bfc11e4e0edf8e60494e55022cd9f2
2017-05-05 08:49:28 -07:00
Fred Liu 71e84e6ee8 Export an object instead of array for asset type
Summary: Exporting an object instead of an array so it can be used as an enum by other files.

Reviewed By: sahrens

Differential Revision: D5007488

fbshipit-source-id: 8253a424f0dbb51511b889b1da637f366c0f290a
2017-05-04 21:49:45 -07:00
Emily Janzer 8ae4c3fcfd Add request/cancelAnimationFrame to jest setup
Reviewed By: cpojer

Differential Revision: D5005587

fbshipit-source-id: 653c281df9025a75ed8eecd22a2e64eaf188bf3e
2017-05-04 17:35:06 -07:00
Brian Vaughn 909fb7239d findNodeHandle properly handles ReactCurrentOwner.current Fiber type
Reviewed By: spicyj

Differential Revision: D5005265

fbshipit-source-id: 218ba3461514fa1dd603ad53c129dd37d7309050
2017-05-04 16:02:50 -07:00
Louis Lagrange 264d67c424 Add ListEmptyComponent prop
Summary:
Hey there :)

Please let me know if the name `ListEmptyComponent` should be changed. I also thought about `ListNoItemsComponent`. Or maybe `ListPlaceholderComponent`?

- [x] Explain the **motivation** for making this change.
- [x] Provide a **test plan** demonstrating that the code is solid.
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch, NOT a "stable" branch.

In a FlatList, I wanted to show some placeholder when my data is empty (while keeping eventual Header/Footer/RefreshControl).
A way around this issue would be to do something like adding a `ListHeaderComponent` that checks if the list is empty, like so:
```js
ListHeaderComponent={() => (!data.length ? <Text style={styles.noDataText}>No data found</Text> : null)}
```
But I felt it was not easily readable as soon as you have an actual header.

This PR adds a `ListEmptyComponent` that is rendered when the list is empty.

I added tests for VirtualizedList, FlatList and SectionList and ran `yarn test -- -u`. I then checked that the snapshots changed like I wanted.
I also tested this against one of my project, though I had to manually add my changes because the project is on RN 0.43.

Here are the docs screenshots:
- [VirtualizedList](https://cloud.githubusercontent.com/assets/82368/25566000/0ebf2b82-2dd2-11e7-8b80-d8c505f1f2d6.png)
- [FlatList](https://cloud.githubusercontent.com/assets/82368/25566005/2842ab42-2dd2-11e7-81b4-32c74c2b4fc3.png)
- [SectionList](https://cloud.githubusercontent.com/assets/82368/25566010/368aec1e-2dd2-11e7-9425-3bb5e5803513.png)

Thanks for your work!
Closes https://github.com/facebook/react-native/pull/13718

Differential Revision: D4993711

Pulled By: sahrens

fbshipit-source-id: 055b40f709067071e40308bdf5a37cedaa223dc5
2017-05-04 00:16:25 -07:00
Andres Suarez 37f3ce1f2c Fix parseFloat mistaken uses of "radix"
Summary: It doesn't take a radix. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat

Reviewed By: yungsters

Differential Revision: D5000954

fbshipit-source-id: fe13896196f0369b1dce132cd4f30d086638740e
2017-05-03 23:00:39 -07:00
周中原 f5056f844d Update AppRegistry.registerComponent's parameter.
Summary:
Update AppRegistry.registerComponent's second parameter name from "component" to "getComponentFunc".
Because the second parameter is NOT a component , it is like ` () => ReactClass<any>;`.

Using 'component' will mislead people who use this function.

- react-native 4.2 docs: [static registerComponent(appKey, getComponentFunc) ](http://facebook.github.io/react-native/releases/0.42/docs/appregistry.html#registercomponent)
- react-native 4.4 docs: [static registerComponent(appKey, component, section?) ](http://facebook.github.io/react-native/docs/appregistry.html#registercomponent)

No need to test. Update the parameter name will not mislead the people who use registerComponent.
Closes https://github.com/facebook/react-native/pull/13747

Differential Revision: D4994037

Pulled By: javache

fbshipit-source-id: 1609d6ff7d63bdc15d7e8e5a94cbf4e029ab427c
2017-05-03 18:01:32 -07:00
Brian Vaughn ef0bd5c71d Sync React 16 from alpha 6 to 12
Reviewed By: spicyj

Differential Revision: D4926070

fbshipit-source-id: c23c79ccd53eb594447d9b47fe3ac6e82499bd42
2017-05-03 17:16:48 -07:00
Jeff Case beeffb89fe Made `getItem` and `getItemCount` required props (VirtualizedList)
Summary:
The main reason to use **VirtualizedList** is to set the `getItem` and `getItemCount` props, so having default values for these props makes things error prone.

* In **VirtualizedList**, changed the `getItem` and `getItemCount` props from optional to required, and removed default values.
* Ensured that implementing classes **FlatList** and **SectionVirtualizedList** are always passing these props.
* Updated VirtualizedList-test.js accordingly.

Reviewed By: sahrens

Differential Revision: D4980236

fbshipit-source-id: ad1838931253bc61ff9068c40929f6e9c755b92c
2017-05-03 10:34:58 -07:00
Spencer Ahrens 52e50af56d Fix and optimize VirtualizedList update triggers
Summary:
- If the initial render doesn't extend past `onEndReachedThreshold` it is likely that onEndReached won't get called until scroll, which can be a bad experience if the `initialNumToRender` is very close to the viewport height. This happens because when `onContentSizeChange`, `onLayout` may not have fired yet so we don't know what the `visibleLength` is. Fix is to also call `maybeCallOnEndReached` in `_onLayout` as well.

- We have an optimization that does hi-pri render window updates when scrolling quickly and the content reaches the edge of the viewport, but there is also an important case where the user has scrolled to the end of the content and is waiting for a network response. Once the new data comes in, we want to render it ASAP because the user is waiting for it. To solve this we refactor our scheduling code into a shared function that always checks if it should be a hi-pri update instead of just in `_onScroll`.

Reviewed By: bvaughn

Differential Revision: D4975314

fbshipit-source-id: 8d64832ecbcbdbac430a08a4018d7a32b2216a85
2017-05-03 10:34:58 -07:00
Spencer Ahrens 5084e1ba0f use $ReadOnlyArray for section stuff
Reviewed By: kassens

Differential Revision: D4983581

fbshipit-source-id: 7951b6d225aee62932ac12047afb89a34fc58722
2017-05-03 10:34:57 -07:00
janus_wel 9a2d6da8bb Fix key name required with accessing CameraRoll
Summary:
- [x] Explain the **motivation** for making this change.
- [ ] ~Provide a **test plan** demonstrating that the code is solid.~
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch, NOT a "stable" branch.

The key name required to access the CameraRoll in iOS is incorrect.
Closes https://github.com/facebook/react-native/pull/13755

Differential Revision: D4994048

Pulled By: javache

fbshipit-source-id: 9ec2f793f03f529e9cf0f89106f88445fde50f2a
2017-05-03 10:17:10 -07:00
Sokovikov 70632615f3 return findNodeHandle to public api
Summary:
findNodeHandle used in my app few times.
after f3dbddcf2b it is not available.
cc janicduplessis.
closes #13688
proof of the publicity of the API https://facebook.github.io/react-native/docs/nativemethodsmixin.html#measurelayout
Closes https://github.com/facebook/react-native/pull/13694

Differential Revision: D4977477

Pulled By: javache

fbshipit-source-id: b377805568c140b6eef9b089fb962d3ba45e58f0
2017-05-02 13:45:07 -07:00
Blair Vanderhoof a974c140db Add method on YellowBox to ignore warnings
Reviewed By: yungsters

Differential Revision: D4979460

fbshipit-source-id: 090a29009a1256809bd975184ad4957b2f6fc36d
2017-05-02 12:16:00 -07:00
Spencer Ahrens 8d373f3186 Make section key optional
Summary: People rarely re-order sections so this is an annoying requirement and we can just use the index by default.

Reviewed By: thechefchen

Differential Revision: D4972154

fbshipit-source-id: 256c445b36c9ba101277614d30a6dc1dbd477ee0
2017-05-01 21:31:46 -07:00
Valentin Shergin f73464851b Revert D4680300: [RN] BREAKING: Better TextInput: `contentSize` property was removed from `<TextInput>.onChange` event.
Differential Revision: D4680300

fbshipit-source-id: 20f7299c53cc54215fb333e97d7e11de087e303d
2017-05-01 21:15:44 -07:00
Eric Vicenti 3544b76c26 Cleanup Xcode project references to UIExplorer
Summary: The xcode project for these bundled libraries should not depend on UIExplorer

Reviewed By: yungsters

Differential Revision: D4979629

fbshipit-source-id: 440b225805e9ebaf0a02b39a35c3ab9c2a83ad05
2017-05-01 14:15:36 -07:00
Valentin Shergin 99e24ecc67 BREAKING: Better TextInput: `contentSize` property was removed from `<TextInput>.onChange` event.
Summary:
`contentSize` was removed from both iOS and Android, tests was updated.
USE `onContentSizeChange` INSTEAD.

Why?
 * It always was a hack;
 * We already have dedicated event for it: `onContentSizeChange`;
 * `onChange` has nothing to do with layout actually;
 * We have to maintain `onChange` handler as fast and simple as possible, this feature complicates it a lot;
 * It was undocumented feature;
 * We already have native auto-expandable <TextInput>, so it illuminates 99% current use cases of this feature.

Reviewed By: mmmulani

Differential Revision: D4680300

fbshipit-source-id: 337836deef0767e5f26350f5a8ce73adb4146a02
2017-04-30 23:02:25 -07:00
Jan Kassens a8f4d166d8 Change data to $ReadOnlyArray
Reviewed By: leebyron

Differential Revision: D4968884

fbshipit-source-id: 9f202d05f7311a192cd939e6d8d72902a54b03a2
2017-04-28 11:00:35 -07:00
Karin Wefald b12677b797 Update AdSupportIOS.js
Summary:
Looks like RN unlinked the RCTAdSupport module from the React project because it triggers some automatic detection from Apple. (from this thread facebook/react-native#1303). So this includes the instructions to manually add RCTAdSupport files from node_modules.

See: https://github.com/facebook/react-native/issues/12623
Closes https://github.com/facebook/react-native/pull/12657

Differential Revision: D4962321

Pulled By: hramos

fbshipit-source-id: ed9aed3b4c16e72d1f9557f5c16fcdadfdd743ea
2017-04-28 06:34:21 -07:00
Brendan Rius 0ff16f63dd Update documentation to stop using search path and old import syntax
Summary:
I don't think editing the search path is necessary anymore for notifications since [0.40](https://github.com/facebook/react-native/releases/tag/v0.40.0).

I removed the part that says to edit the search paths, and changed `#import "RCTPushNotificationManager.h"` to `#import <React/RCTPushNotificationManager.h>` in the documentation

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.

What existing problem does the pull request solve?

A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI or updates the website. See [What is a Test Plan?][1] to learn more.

If you have added code that should be tested, add tests.

Sign the [CLA][2], if you haven't already.

Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

Make sure all **tests pass** on both [Travis][3] and [Circle CI][4]. PRs that break tests are unlikely to be merged.

For more info, see the ["Pull Requests"][5] section of our "Contributing" guidelines.

[1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
[2]: https://code.facebook.com/cla
[3]: https://travis-ci.org/facebook/react-native
[4]: http://circleci.com/gh/facebook/react-native
[5]: https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests
Closes https://github.com/facebook/react-native/pull/13700

Differential Revision: D4969728

Pulled By: javache

fbshipit-source-id: d72aee1c5b8578cea27d6b7d45ee7a7f269433fc
2017-04-28 05:56:58 -07:00
Vojtech Novak 7888c06a7b clarify the picker onValueChange
Summary:
In the current docs, it's not quite clear, at the first sight, what the `lang` parameter passed to `onValueChange` is. This makes it obvious.
Closes https://github.com/facebook/react-native/pull/13617

Differential Revision: D4969592

Pulled By: javache

fbshipit-source-id: e94bedefebbe19d838d010f0c79d9a76743a4341
2017-04-28 04:04:14 -07:00
Garrett McCullough 8da9b04bb6 update docs for Linking.openURL
Summary:
What existing problem does the pull request solve?

I was seeing errors in the crash monitoring software for my app in production.  Many took the form of, `Unable to open URL: telprompt:5551231234`

After some research, I found that when the user attempts to call a phone number, a dialog pops up in iOS asking the user to confirm or cancel the call.  If the call is canceled, the promise returned by `openURL` is rejected.

This PR improves the documentation around what happens to the promise returned by `openURL`.

No test plan, text changes only.

Sign the [CLA][2], if you haven't already.

Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

Make sure all **tests pass** on both [Travis][3] and [Circle CI][4]. PRs that break tests are unlikely to be merged.

For more info, see the ["Pull Requests"][5] section of our "Contributing" guidelines.

[1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
[2]: https://code.facebook.com/cla
[3]: https://travis-ci.org/facebook/react-native
[4]: http://circleci.com/gh/facebook/react-native
[5]: https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests
Closes https://github.com/facebook/react-native/pull/13624

Differential Revision: D4962161

Pulled By: javache

fbshipit-source-id: c8d5ffbc24ba4c14c85db6ea799a6f95339b94c8
2017-04-28 04:04:14 -07:00
rh389 0a55e42ef6 Refactor MessageQueue
Summary:
Looking to address a few new `FlowFixMe`s I had to do some minor refactoring of `MessageQueue`. Has the advantage of (IMO) making things clearer by removing a redundant counter and some gratuitous bitwise operations.

Previously `_callbacks` was an array of `?Function`s where even elements were failure callbacks and odd elements were successes. Each new call incremented `_callID` by one and `_callbackID` by two. I've changed this to use two arrays `_successCallbacks` and `_failureCallbacks` indexed by `callID`. That made the `_callbackID` counter unnecessary and reduced the need for computed indices.

Tested with flow and a quick play with UIExplorer.
Closes https://github.com/facebook/react-native/pull/11986

Differential Revision: D4962162

Pulled By: javache

fbshipit-source-id: 17dddfedc0cb5950dbdd9bd06fae6eb6de4c4a7d
2017-04-28 04:04:14 -07:00
Spencer Ahrens 5c7c65e964 fix bug: flipped leading/trailing separators.updateProps
Reviewed By: thechefchen

Differential Revision: D4964000

fbshipit-source-id: bd0562e30811d6206cd5441f6a9413c4b503bbfa
2017-04-27 15:50:15 -07:00
Gabriel Bull d5a6152582 Fixed issue where the copy item would be added to the tooltips on the…
Summary:
This PR solves issue #13618.

Selectable text still behaves the same way:

```jsx
<Text selectable={true}>yo yo yo</Text>
```

![capture d ecran 2017-04-21 a 17 10 51](https://cloud.githubusercontent.com/assets/671923/25296285/85eba646-26b5-11e7-8773-e5e55ee0d7bb.png)

Text that is not selectable and has a custom tooltip now do not include the copy item:

```jsx
import * as React from 'react';
import { Text } from 'react-native';
import ToolTip from 'react-native-tooltip';

const MyComponent = () => (
  <Text>
    <Text>This is my text.</Text>
    <ToolTip
      actions={[
        {text: 'My', onPress: (): any => null },
        {text: 'Context', onPress: (): any => null },
        {text: 'Menu', onPress: (): any => null },
      ]}
      underlayColor='transparent'
      longPress={true}
      arrowDirection='down'
    >
      <Text>You can long press me for a tooltip.</Text>
    </ToolTip>
    <Text>This is the rest of my text</Text>
  </Text>
);

export default MyComponent;
```

![capture d ecran 2017-04-21 a 17 10 56](https://cloud.githubusercontent.com/assets/671923/25296297/970949ba-26b5-11e7-8378-3bf0289d1a5a.png)
Closes https://github.com/facebook/react-native/pull/13619

Reviewed By: shergin

Differential Revision: D4936900

Pulled By: ericvicenti

fbshipit-source-id: 82028b0958c37d63b8a80882196295be4aebecb4
2017-04-27 15:50:15 -07:00
Eli White c7e0f56d75 Flowify Process Color
Reviewed By: achen1

Differential Revision: D4924691

fbshipit-source-id: 11ff623be63062f01cb71c7d77e1438d3e495035
2017-04-26 11:31:56 -07:00
Janic Duplessis f3dbddcf2b BREAKING - Remove React forwarding and wrong import warnings
Summary:
Importing `react` modules from `react-native` has been deprecated since 0.25 so I think it's safe to remove it now since everyone has migrated their code and it is now well know and documented that you import from different packages. This finishes the spring cleanup of `react-native-implementation.js` :)

**Test plan**
Tested that UIExplorer still works.
Closes https://github.com/facebook/react-native/pull/13354

Reviewed By: bvaughn

Differential Revision: D4928785

Pulled By: javache

fbshipit-source-id: 38c623c309b06b2cb5e73074833342d2745ab198
2017-04-26 10:02:32 -07:00
Adam Perry 0c9b41f2c0 Include Create React Native App in Getting Started
Summary:
cc hramos

Create React Native App was designed to reduce "time to hello world" to 5-10 minutes for React Native apps. This PR would make CRNA the first way to get started that new users encounter. Included also is some text to help advanced users navigate the question of whether to use CRNA or whether to go straight to `react-native init`. It also includes a new banner for the iOS and Android guides, since they do not apply to CRNA users.

Changes are only to the website, screenshots below. This branch was created from the last CI-passing master commit this morning, dependencies were freshly installed and these screenshots are from a clean build.

[The Getting Started page](https://www.dropbox.com/s/1s7f3wu3oxr6gpo/Screenshot%202017-04-04%2015.12.29.png?dl=0)

[The "native builds only" banner](https://www.dropbox.com/s/nyv51xdiibdkn57/Screenshot%202017-04-04%2015.13.25.png?dl=0)

[Pages which still apply to CRNApps have no banner](https://www.dropbox.com/s/qgl0h6uzynqkmy2/Screenshot%202017-04-04%2015.14.10.png?dl=0)

<details>

* [x] Decide how to handle native code & react-native-cli references outside of the `banner: ejected` guides
  * [x] [Debugging: Accessing Console Logs](https://facebook.github.io/react-native/docs/debugging.html#accessing-console-logs) isn't needed in CRNA (logs are forwarded alongside packager output)
  * [x] [Debugging: With Stetho](https://facebook.github.io/react-native/docs/debugging.html#debugging-with-stetho-http-facebook-github-io-stetho-on-android) requires native code
  * [x] [Debugging: Debugging Native Code](https://facebook.github.io/react-native/docs/debugging.html#debugging-native-code) is native-only
  * [x] [AppRegistry](https://facebook.github.io/react-native/docs/appregistry.html) only applies to ejected apps, since this is generated from code, I don't think we can set `banner: ejected`?
  * [x] [Linking](https://facebook.github.io/react-native/docs/linking.html) involves changing Android manifests and other native-side things
  * [x] [PermissionsAndroid](https://facebook.github.io/react-native/docs/permissionsandroid.html) may be flaky in the Expo client, I can't recall (cc jesseruder)
  * [x] [PushNotificationIOS](https://facebook.github.io/react-native/docs/pushnotificationios.html) won't work inside Expo, as it has to [handle its own push notifs](https://docs.expo.io/versions/v15.0.0/guides/push-notifications.html)
  * [x] [Geolocation](https://facebook.github.io/react-native/docs/geolocation.html) requires a polyfill that will most likely ship with next week's release, but that won't have any manifest changes necessary
* [ ] Figure out a strategy to handle the fact that CRNA will lag stable RN releases by ~1 week
* [x] Confirm linking out to CRNA docs is an OK strategy as opposed to moving ejecting, etc. docs in-tree
* [ ] Answer questions (I'll add some review comments to call out a few things)

</details>
Closes https://github.com/facebook/react-native/pull/13303

Differential Revision: D4950661

Pulled By: hramos

fbshipit-source-id: 3dd43828f38ca6ede3f2b0683608c56420dc6525
2017-04-26 07:16:18 -07:00
Rich R 066bebbb7f Minor doc fix
Summary:
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.

What existing problem does the pull request solve? Minor omission in doc.

A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI or updates the website. See [What is a Test Plan?][1] to learn more.

If you have added code that should be tested, add tests.

No code changes.

Sign the [CLA][2], if you haven't already.

Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

Make sure all **tests pass** on both [Travis][3] and [Circle CI][4]. PRs that break tests are unlikely to be merged.

For more info, see the ["Pull Requests"][5] section of our "Contributing" guidelines.

[1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
[2]: https://code.facebook.com/cla
[3]: https://travis-ci.org/facebook/react-native
[4]: http://circleci.com/gh/facebook/react-native
[5]: https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests
Closes https://github.com/facebook/react-native/pull/13666

Differential Revision: D4953796

Pulled By: javache

fbshipit-source-id: 131c2326d6631fe193f6ccae124e1f09af3f5c73
2017-04-26 04:00:09 -07:00
Spencer Ahrens 28aaa88808 Many improvements
Summary:
These got smashed together with some weird rebase snafu. They are pretty intertwined anyway so the value of
separate commits is minimal (e.g. separate commits would not revert cleanly anyway).

== [lists] better fill rate logging (previously D4907958)

After looking through some production data, I think this will address all the issues we're seeing. Now:

- Header/Footer getting no longer counted as blank.
- Avoid floating point for Scuba.
- Compare actual time of blankness, not just samples.
- Include both "any" vs. "mostly" blank (similar to 1 and 4 frame drops).
- Include events where there is no blankness so we have a baseline.
- Remove events with too few samples

**Test Plan: **

A bunch of scrolling in FlatListExample

T17384966

== [Lists] Update SectionSeparatorItem docs (previously D4909526)

Forgot to update the language here when we modified the behavior with the introduction of separator
highlighting support.

** Test Plan: **
nope.

== [Lists] Add renderSectionFooter prop to SectionList (previously D4923353)

Handy for things like "see more" links and such.

The logic here is to render the footer last, *after* the bottom section separator. This is to preserve
the highlighting behavior of the section separator by keeping it adjacent to the items.

**Test Plan: **
Added to snapshot test and example:

{F66635525}

{F66635526}

== [SectionList] Add a bunch more info for rendering items and separators (previously D4923663)

This extra info can be helpful for rending more complex patterns.

**Test Plan: **
Made snapshot test more comprehensive and inspected the output.

== [Lists] reduce render churn (previously D4924639)

I don't think the velocity based leadFactor is helping and might actually be hurting because
it causes a lot of churn in the items we render.

Instead, this diff introduces fillPreference which biases the window expansion in the direction of scroll,
but doesn't actually affect the final bounds of the window at all, so items that are already rendered are
more likely to stay rendered.

**Test Plan: **

Played around in debug mode and watched the overlay - seems better. Also tests all pass.

T16621861

== [Lists] Add initialScrollIndex prop

Makes it easy to load a VirtualizedList at a location in the middle of the content without
wasting time rendering initial rows that aren't relevant, for example when opening an infinite calendar
view to "today".

**Test Plan: **
With debug overlay, set `initialScrollIndex={52}` prop in `FlatListExample` and
and see it immediately render a full screen of items with item 52 aligned at the top of the screen. Note
no initial items are mounted per debug overlay. Scroll around a bunch and everything else seems to work
as normal.

No SectionList impl since `getItemLayout` isn't easy to use there.

T17091314

Reviewed By: bvaughn

Differential Revision: D4907958

fbshipit-source-id: 8b9f1f542f9b240f1e317f3fd7e31c9376e8670e
2017-04-25 14:50:14 -07:00
Jean Lauliac 1f8d1002ef packager: buck library: expose asset content
Reviewed By: davidaurelio

Differential Revision: D4945778

fbshipit-source-id: ea132a3d284ed09c59c69afbdd7b707af9e521b9
2017-04-25 12:04:01 -07:00
Janic Duplessis 6c434f9404 Native Animated - Support decay on iOS
Summary:
This is one of the last feature that is missing from native animated, it was already supported on Android and this implementation is based on it.

**Test plan**
Test that the existing decay animation example now works on iOS
Run unit tests
Closes https://github.com/facebook/react-native/pull/13368

Differential Revision: D4938061

Pulled By: javache

fbshipit-source-id: 36b57b1029a542e9daf21e048a06d3b3347e9659
2017-04-24 04:31:43 -07:00
Andrew Y. Chen 88a63980b5 Fix disabled prop for Text
Reviewed By: antiarchit

Differential Revision: D4929450

fbshipit-source-id: b6c508d5dec695d04858b83ce38ca89d250c360e
2017-04-21 18:02:09 -07:00
Pieter De Baets 6b19419cdb Merge all copies of RUN_RUNLOOP_WHILE in UIExplorerUnitTests
Reviewed By: mhorowitz

Differential Revision: D4921344

fbshipit-source-id: 8b00acba108e46c55374df54a027015d4327d683
2017-04-21 08:35:46 -07:00
Tom Haynes f98d9f5ea8 Small grammar edit
Summary:
Small edit to comment, shouldn't require a test plan.
Closes https://github.com/facebook/react-native/pull/13604

Differential Revision: D4928784

Pulled By: javache

fbshipit-source-id: b8f4aff1580a7c5e8c80bbec3f52252b5e62c852
2017-04-21 03:15:17 -07:00
Daniel Farrell 32eab54781 Apple TV Support: Add tvOS build support for ART library
Summary:
The ART library backend did not get build support for tvOS when other libraries did.  We are writing an application that will run on tvOS, and wanted to use ART, so it was important to have this. This PR adds that build support.

Verified that this builds and works on tvOS simulator for development of this project.
Closes https://github.com/facebook/react-native/pull/12547

Differential Revision: D4925864

Pulled By: lacker

fbshipit-source-id: f72c650d7620e9c7f59d9ae68cfc39f0e7bab12b
2017-04-20 16:15:38 -07:00
Marc Horowitz 325228d6cf Remove RCTBatchedBridge rule and all uses from the tree
Reviewed By: AaaChiuuu, javache

Differential Revision: D4889438

fbshipit-source-id: ba103ace8802f0976e09af6b491442e9aa723f49
2017-04-19 17:00:43 -07:00
Emily Janzer bd0f9fbacb Only start observing in requestPermissions() if not already observing
Reviewed By: javache

Differential Revision: D4903744

fbshipit-source-id: d2700f59bae521de6c76f8a3d11d6d48f1c0e7d9
2017-04-19 11:30:36 -07:00
Steffen Forkmann a9ad81a085 Update documentation to use newer version of fresco - fixes #13345
Summary:
Thanks for submitting a PR! Please read these instructions carefully:

React Native crashes hard on fresco 0.11.0 - see #13345

Repro case in #13345
Closes https://github.com/facebook/react-native/pull/13419

Differential Revision: D4913258

Pulled By: javache

fbshipit-source-id: 8beb55102e0f2d362c77698a35ea7d57fdcba48d
2017-04-19 05:02:09 -07:00
Fran e974798656 Udpate scrollTo example
Summary:
This PR updates the example of scrollTo that uses `;` instead of `,` to separate x, y and animated values.
Closes https://github.com/facebook/react-native/pull/13318

Differential Revision: D4913285

Pulled By: javache

fbshipit-source-id: 02c219fbeae0f9e3b63f4b64eb4cca34868641c1
2017-04-19 04:36:09 -07:00
Ben Alpert 8f2d73d50b React Native Fiber: Fix errors in children management
Reviewed By: bvaughn

Differential Revision: D4905062

fbshipit-source-id: 43c24e7bcaf06eb4c7385b7022d0f20cf42d6f2f
2017-04-18 18:33:30 -07:00
Van der Auwermeulen Grégoire 23e8fcc68c ListItem JSX tag is not closed when used in SectionList
Summary:
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.

When copy pasting the SectionList, got an error with a non closing JSX tag
What existing problem does the pull request solve?
Closing the JSX tag in 2 files
no test required
A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI or updates the website. See [What is a Test Plan?][1] to learn more.

If you have added code that should be tested, add tests.

Sign the [CLA][2], if you haven't already.

Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.
Closes https://github.com/facebook/react-native/pull/13525

Differential Revision: D4908495

Pulled By: javache

fbshipit-source-id: f2dc49c9238d1da8906f7daf144429a57ad725a3
2017-04-18 16:45:28 -07:00
Mohamed Habib a5dea8d612 Fixed a typo in open function documentation
Summary:
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.

What existing problem does the pull request solve?

A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI or updates the website. See [What is a Test Plan?][1] to learn more.

If you have added code that should be tested, add tests.

Sign the [CLA][2], if you haven't already.

Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

Make sure all **tests pass** on both [Travis][3] and [Circle CI][4]. PRs that break tests are unlikely to be merged.
Closes https://github.com/facebook/react-native/pull/13556

Differential Revision: D4908506

Pulled By: javache

fbshipit-source-id: 17f6a57e31e68dc79ac9b5303bf56461663d7edd
2017-04-18 15:36:20 -07:00
Sue Ann Ioanis cc4648ba86 Omit units from zero values.
Summary:
It's recommended to remove units for all zero length values because
these units aren't being used and therefore can be safely removed to
save bytes.
Closes https://github.com/facebook/react-native/pull/13518

Differential Revision: D4905286

Pulled By: javache

fbshipit-source-id: 4119eb8034b4b5b864228316c5a450978d4328e9
2017-04-18 14:00:18 -07:00
Ben Roth 09e7dbc9cb Protect against fatal YellowBox error when stack frame has no file
Summary:
Motivation: When viewing a stack trace in YellowBox where one or more of the stack frames has no `file`, JS will encounter the fatal error `null is not an object (evaluating 'file.split')`. This can happen, for example, when running a bundle for which no source maps were generated.
Closes https://github.com/facebook/react-native/pull/13512

Differential Revision: D4896480

Pulled By: javache

fbshipit-source-id: 202c793a47abb83a4700a5778a92b0b5828b01a3
2017-04-18 09:39:31 -07:00
Tony Tan 3e7aa5f14e Fix bug - FlatList component did not render more items when content was filtered
Summary:
**Bug Description**

The FlatList component receives content items via the data prop, and renders an initial number of items on the app's view. When a user scrolls to the end of the list, the component will append and render more available items at the end of the list. There was a bug where when the content was filtered, there were more available items but the component did not append/render them. This is due to the current appending/rendering logic in VirtualizedList, which does not account for data changes as a condition for updating/rendering. VirtualizedList is a dependency of FlatList, so this issue affects FlatList as well.

**Approach to Fixing Bug**

(i) Reproduce bug on iOS view of FlatList.
(ii) For VirtualizedList component:
  # Isolate onEndReached function that appends more data to component UI.
  # Isolate _onContentSizeChange function that is called when list content changes.
  # Write snapshot tests using jest, based off existing test for FlatList.
  # Refactor logic to append more data to list into _maybeCallOnEndReached function.
  # Call _maybeCallOnEndReached in both _onContentSizeChange and _onScroll.
(iii) Run snapshot tests and observe jest output.
(iv) Bring up iOS view of FlatList and check that component now renders more items when content is filtered.

Many thanks to sahrens for guidance in developing this code!

Reviewed By: sahrens

Differential Revision: D4877388

fbshipit-source-id: c10c9eef1912f491450a62b81a9bc41f7f784203
2017-04-17 18:15:37 -07:00
Gabe Levi 92f900c79d Upgrade to v0.44.0
Reviewed By: zertosh

Differential Revision: D4893660

fbshipit-source-id: ed85f5d4c585164d464a7e009888a28e5af339cd
2017-04-17 09:33:20 -07:00
Emil Sjolander d5601a3e12 Align ios api with android
Reviewed By: kittens

Differential Revision: D4897832

fbshipit-source-id: ff3215b45de389b91825371a987314e4bab5421f
2017-04-17 07:30:18 -07:00
Jakub Šimo 82f3964f2d Change Promise.done to Promise.then
Summary:
- [X] Explain the **motivation** for making this change.
- [X] Provide a **test plan** demonstrating that the code is solid.
- [X] Match the **code formatting** of the rest of the codebase.
- [X] Target the `master` branch, NOT a "stable" branch.

`Promise.done` is non-standard, `Promise.then` is preferred as a standardized method. On Android, polyfill filling in `Promise.done` has been most probably taken out in newer versions of `react-native` and app crashes when it tries to query network state through `NetInfo`.

No tests are required for this change.
Closes https://github.com/facebook/react-native/pull/13489

Differential Revision: D4897566

Pulled By: mkonicek

fbshipit-source-id: 140720d7367cd1d9bf8924ec8a118c1bff4e461d
2017-04-16 15:30:46 -07:00
Spencer Ahrens 346fe33077 Make invalid scrolling bugs easier to track down
Reviewed By: jingc, olegbl

Differential Revision: D4887662

fbshipit-source-id: d24590fd79ad1b5f6ada79583dbe870b350ec358
2017-04-14 16:16:40 -07:00
Brian Vaughn f3e56cbbb7 Ran React.PropTypes codemod on fbsource again in case anything was missed
Reviewed By: flarnie

Differential Revision: D4890226

fbshipit-source-id: 36b87bd4395c8cfbe260d2c73f919e62b11439a7
2017-04-14 15:46:04 -07:00
Spencer Ahrens 3bf7856700 disable removeClippedSubviews by default
Summary:
It's just causing problems (e.g. when combined with transform animations like those used
in some navigators) and hopefully it's not necessary with JS-side windowing. If people need the
perf, they can turn it on themselves.

Should fix https://github.com/facebook/react-native/issues/13316 and related issues.

Reviewed By: achen1

Differential Revision: D4884147

fbshipit-source-id: 95c82448581076c0d0b2c80b1cd80cc294898174
2017-04-13 16:05:52 -07:00
Brian Vaughn 8b408576b7 Fixed bad ReactPropTypes reference in ViewPagerAndroid
Reviewed By: spicyj

Differential Revision: D4885894

fbshipit-source-id: 2e225354b76bf21dca84c2e723d9b7e27882648d
2017-04-13 15:00:24 -07:00
Victor Ilyukevich 0d58669c81 Fix typo in documentation: "…controls how rows…"
Summary: Closes https://github.com/facebook/react-native/pull/13482

Differential Revision: D4883387

Pulled By: javache

fbshipit-source-id: fab3ce3136b18079a566e93fb3d388abc27dd41c
2017-04-13 05:52:45 -07:00
Pieter De Baets 8dcef96fd8 Log to console in RCTTestRunner
Reviewed By: fkgozali

Differential Revision: D4875352

fbshipit-source-id: 68f9caf4f350d34b2fd180ff19353c698bfce452
2017-04-13 04:49:51 -07:00
Spencer Ahrens 76307f47b9 add separator highlighting/updating support to `SectionList`
Reviewed By: thechefchen

Differential Revision: D4833604

fbshipit-source-id: cc1f85d8048221d9d26d728994b61237be625e4f
2017-04-12 17:01:03 -07:00
Spencer Ahrens f25df504ed Add support for updating adjacent separators on row highlight to FlatList
Summary:
A nice bit of polish for apps is to update the separators between list items
when press actives the highlight (things get especially noticeable/ugly when
the separators are not full width and don't adjust). This can be difficult to
coordinate and update efficiently, so we bake the functionality into
`VirtualizedList`.

The approach taken here is a little different from `ListView`. We pass a new
`separators` object with `renderItem` that has easy-to-use callbacks for toggling
the 'highlighted' prop on both adjacent separators - they can be wired up
directly to the `onShow/HideUnderlay` props of `TouchableHighlight` (pit of
success and all that - we want those RN apps to be polished!), but we also
provide a more generic `separators.updateProps` method to set any custom
props. This also passes in `leadingItem` so more custom wiring can be done on
initial render (e.g. linking the highlight state with `Animated`).

This also moves the separator rendering into the `CellRenderer`. I think this might
also fix some subtle measurement bugs with the `onLayout` not capturing the
height of the separator, so that's nice too, but the main reason is to have
an easy place to store the state so we don't have to re-render the entire list
like `ListView` does. Instead we track references to the cells and call update
only on the two we care about so the feedback is instantaneous even with big,
heavy lists.

This diff also messes with a bunch of flow and updates the example to be more
like a standard list.

`SectionList` support is coming in a stacked diff.

**TestPlan**

Video demo:

https://youtu.be/uFE7qGA0mg4

Pretty sure this is backwards compatible....

Reviewed By: thechefchen

Differential Revision: D4833557

fbshipit-source-id: 685af46243ba13246bf280dae8a4223381ce8cea
2017-04-12 17:01:03 -07:00
Andy Trevorah 01d4a1c6f4 fixed typo in "linking" docs
Summary:
Fixing a typo found via https://facebook.github.io/react-native/docs/linking.html

n/a (they're docs)
Closes https://github.com/facebook/react-native/pull/13440

Differential Revision: D4875315

Pulled By: javache

fbshipit-source-id: 919cf263dba5fb3e8eda6b5181b7b88e1698ef6f
2017-04-12 16:31:35 -07:00
Brian Vaughn 6564edce5e Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github
Reviewed By: acdlite

Differential Revision: D4876709

fbshipit-source-id: 3a5e92bfc74287b7a9054546c438580bed0147af
2017-04-12 16:15:15 -07:00
Naman Goel b7d873b1a0 Flow type improvements to accept co-variant types
Differential Revision: D4848918

fbshipit-source-id: b8d4628431c57c8fda12fc7e2e38e5b2dab9b1ad
2017-04-11 12:25:39 -07:00
Alex Kotliarskyi ea7c5ab04b Add mock for BackHandler
Reviewed By: fkgozali

Differential Revision: D4861901

fbshipit-source-id: b1b74e63731328d2235bf86794aa481a8275ed8c
2017-04-11 12:25:38 -07:00
Tim Yung dd7aa3659d Lists: Fix RCTJSONStringify Breakage on Infinity
Reviewed By: jingc

Differential Revision: D4867026

fbshipit-source-id: dfe98d5012ced80fbe10bf069c58f45d00da388b
2017-04-11 00:45:35 -07:00
Adam Comella e544563bd2 BREAKING: Android: Support withCredentials flag in XHRs
Summary:
Corresponding iOS PR: #12275

Respect the withCredentials XMLHttpRequest flag for sending cookies with requests. This can reduce payload sizes where large cookies are set for domains.

This should fix #5347.

This is a breaking change because it alters the default behavior of XHR. Prior to this change, XHR would send cookies by default. After this change, by default, XHR does not send cookies which is consistent with the default behavior of XHR on web for cross-site requests. Developers can restore the previous behavior by passing `true` for XHR's `withCredentials` argument.

**Test plan (required)**

Verified in a test app that XHR works properly when specifying `withCredentials` as `true`, `false`, and `undefined`. Also, my team uses this change in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/12276

Differential Revision: D4673646

Pulled By: ericvicenti

fbshipit-source-id: 924c230c9df72071b3cf9151c3ac201905ac28a5
2017-04-10 22:46:12 -07:00
Brian Vaughn c95a991061 Removed takeSnapshot util function from ReactNative renderer
Summary:
It was added to react-native-implementation in c7387fe

Relates to [this comment](848593c0f0 (commitcomment-21585552)) and issue #13343

cc janicduplessis
Closes https://github.com/facebook/react-native/pull/13347

Reviewed By: bvaughn

Differential Revision: D4843898

Pulled By: ericvicenti

fbshipit-source-id: 2b83d7bd71b7a7e6961e4da551ddd4090af03824
2017-04-10 10:31:21 -07:00
Faraz Sherwani 8591d8ae71 Webview disable save form prop
Summary:
Adds functionality to be able to disable saving of form data and thereby disabling autocomplete in webview on Android. Can be used as a workaround for #13241

Manual testing that autocomplete is disabled when the property is set to true, and still enabled when it is unset or set to false.
Closes https://github.com/facebook/react-native/pull/13271

Differential Revision: D4858899

Pulled By: ericvicenti

fbshipit-source-id: 62738b0685e4c1958c8a32e184fa2fe4f711b336
2017-04-09 21:45:45 -07:00
Spencer Ahrens 6f8ce41a39 Fix crash from FillRateLogging
Reviewed By: thechefchen

Differential Revision: D4853991

fbshipit-source-id: b024d4052edb04e9f9da2e2504c56f8b7840cded
2017-04-07 16:00:56 -07:00
Andrew Y. Chen 909af08f24 Add a nativeID prop to allow native code to reference react managed views
Reviewed By: sahrens

Differential Revision: D4786713

fbshipit-source-id: af9cef0737c010b429d52d00181c00bd81f13f5b
2017-04-07 12:00:40 -07:00
Peter Pistorius d03f9b7442 PushNotificationIOS.requestPermissions won't resolve if no event listeners are attached
Summary:
Resolves #13012

RCTPushNotificationManager uses startObserving to register for RCTRegisterUserNotificationSettings. According to the docs, the startObserving method won't be called until somebody subscribes to NotificationManagerIOS.

This means there is a scenario when the developer can call requestPermissions without subscribing to notifications first, but since RCTPushNotificationManager relies on NSNotificationCenter subscribtion, the result will never be returned.

When requesting permissions  the promise will resolve:
`PushNotificationIOS.requestPermissions().then(console.log);` without the need for calling `PushNotificationIOS.addEventListener()` first.
Closes https://github.com/facebook/react-native/pull/13263

Differential Revision: D4851767

Pulled By: javache

fbshipit-source-id: 2be8621e072ae1086014594bc986ca5590b5eb61
2017-04-07 11:17:00 -07:00
Pieter De Baets 76b93e1253 Add block-based initializer for RCTModuleData
Reviewed By: shergin

Differential Revision: D4821772

fbshipit-source-id: 2cd35ec6726b6fe1494a92966ade5aa0b86e769b
2017-04-07 11:16:59 -07:00
Steffen Forkmann 39431deb1f fix typo - closes #13369
Summary:
We're just fixing a reported typo from the docs.

proofreading
Closes https://github.com/facebook/react-native/pull/13375

Differential Revision: D4851601

Pulled By: javache

fbshipit-source-id: b8bd4067285809dd24b6e5c9bc8fddcc8734dfd1
2017-04-07 10:45:33 -07:00
Spencer Ahrens 1fec1cc4d7 fix it
Reviewed By: ericvicenti

Differential Revision: D4851513

fbshipit-source-id: 7ae9d3a8caef1364b3e300bf58db6232e90dc1cf
2017-04-07 10:32:48 -07:00
Spencer Ahrens 1b52c2a7ab Support elements for header/footer
Summary: It can be much more convenient instead of binding and setting `extraData` or what-not.

Reviewed By: blairvanderhoof

Differential Revision: D4829165

fbshipit-source-id: bb781fedc831059e7b5065ea4357955aed79beda
2017-04-07 01:00:39 -07:00
Spencer Ahrens f72d9dd08b Add option to track when we're showing blankness during fast scrolling
Summary:
If tracking is enabled and the sampling check passes on a scroll or layout event,
we compare the scroll offset to the layout of the rendered items. If the items don't cover
the visible area of the list, we fire an `onFillRateExceeded` call with relevant stats for
logging the event through an analytics pipeline.

The measurement methodology is a little jank because everything is async, but it seems directionally
useful for getting ballpark numbers, catching regressions, and tracking improvements.

Benchmark testing shows a ~2014 MotoX starts hitting the fill rate limit at about 2500 px / sec,
which is pretty fast scrolling.

This also reworks our frame rate stuff so we can use a shared `SceneTracking` thing and track blankness
globally.

Reviewed By: bvaughn

Differential Revision: D4806867

fbshipit-source-id: 119bf177463c8c3aa51fa13d1a9d03b1a96042aa
2017-04-07 01:00:39 -07:00
Andrew Y. Chen b5327dd388 Set the enabled state on disabled button views
Reviewed By: AaaChiuuu

Differential Revision: D4722513

fbshipit-source-id: f4a4e6304594235b5da4e5be36358331e43bdbee
2017-04-06 21:32:05 -07:00
Oleg Lokhvitsky ea30aa0fa4 Fixed crash when forwarding already existing property from ReactNativeInternal to ReactNative
Reviewed By: ericvicenti

Differential Revision: D4843917

fbshipit-source-id: 6cdbac28d8a220a6ac289e8b98d9d50eca35e176
2017-04-06 13:46:00 -07:00
Spencer Ahrens 6dbcb47e4c use performanceNow instead of Date.now() in ScrollResponder
Reviewed By: shergin

Differential Revision: D4833701

fbshipit-source-id: cb127cb6c40ecb188100eeb204412401c7772c9e
2017-04-05 18:46:34 -07:00
Gabe Levi 4f243f1ecd Deploy v0.43.0
Reviewed By: zertosh

Differential Revision: D4835081

fbshipit-source-id: a9ab33648320fb19b8cc7ab212e68fada7810b90
2017-04-05 18:31:06 -07:00
Héctor Ramos d69c85f878 Update Keyboard.js
Summary:
What existing problem does the pull request solve?

According to this issue: https://github.com/facebook/react-native/issues/3468 , only `keyboardDidShow`and `keyboardDidHide` events are available on android at this moment.

I think this information should be displayed in the documentation since default `android:windowSoftInputMode` is `adjustResize`.
Closes https://github.com/facebook/react-native/pull/13155

Differential Revision: D4795828

Pulled By: hramos

fbshipit-source-id: 2c114f3040808a5cc3cdeb29b2067877df353620
2017-04-05 15:32:48 -07:00
Janic Duplessis c7387fefc8 Enable flow in react-native-implementation
Summary:
I noticed I didn't get type defs anymore for react-native. Looks like it is broken since we removed the .flow file in 3e153b2a5b. To fix it we can now enable flow in react-native-implementation since it now supports properties.

**Test plan**
Tested that I get type hints when using imports from react-native in a project.
Closes https://github.com/facebook/react-native/pull/12917

Differential Revision: D4704753

Pulled By: ericvicenti

fbshipit-source-id: cf882588d7f371931de8d7861a1a6d50f6c425dc
2017-04-05 10:17:49 -07:00
Janic Duplessis 9a51fa8e15 Improve z-index implementation on Android
Summary:
Use `getChildDrawingOrder` instead of reordering views. The old implementation didn't work properly when `removeClippedSubviews` was enabled and this one should have better performance since we don't play with the view hierarchy at all.

This fixes weird bugs with sticky headers in `SectionList` and allows removing the hack that disabled `removeClippedSubviews` when using sticky section headers.

**Test plan**
Tested using the SectionList and ListViewPaging examples that use sticky headers which uses z-index.
Closes https://github.com/facebook/react-native/pull/13105

Reviewed By: sahrens

Differential Revision: D4765869

Pulled By: achen1

fbshipit-source-id: be3c824658a3ce965b6e7324ad95c77cbd8a86ae
2017-04-05 09:17:46 -07:00
Brian Vaughn 36c599b2e0 ReactNativeFiber renderer type-fix for leaf node children
Reviewed By: sebmarkbage

Differential Revision: D4830872

fbshipit-source-id: 6e1a476c921ffff8f720fd9b81da65cb1e724eef
2017-04-04 17:03:29 -07:00
Eric Vicenti 9c5cc145e6 Fixwebsite
Summary:
This fixes the website build because docgen was unable to parse this `*`
Closes https://github.com/facebook/react-native/pull/13300

Differential Revision: D4828837

Pulled By: ericvicenti

fbshipit-source-id: 7ebc04241742f7bb5a871e7e438fb23af90a70bd
2017-04-04 13:52:31 -07:00
Beau Smith e91cd2eff7 Make clear that onSlidingComplete is called regardless whether value changes
Summary:
Documentation didn't clearly state when onSlidingComplete callback is called.

No tests necessary… simply changing docs.
Closes https://github.com/facebook/react-native/pull/13282

Differential Revision: D4823866

Pulled By: ericvicenti

fbshipit-source-id: 1c3be6ee4d52b097b7558067edf0388739d3f52e
2017-04-04 09:46:52 -07:00
Spencer Ahrens b12f6db0ef fix crash with onEndReached={null}
Reviewed By: bvaughn

Differential Revision: D4815310

fbshipit-source-id: 69d4a5a6fd247bdf877465a7cd07924a0dd6584b
2017-04-03 19:19:33 -07:00
Spencer Ahrens ecf4c48966 Add `scrollToLocation` for `SectionList`
Summary:
Basic functionality that takes `itemIndex` and `sectionIndex`

**TestPlan**

Added this to onChangeText:

	this._listRef.getNode().scrollToLocation({itemIndex: 6, sectionIndex: 3, viewOffset: 25});

and saw it scroll to the correct position right under the sticky header.

Reviewed By: bvaughn

Differential Revision: D4821714

fbshipit-source-id: 261e373f9c4af384db5a363df5b0fd9274b1bdfe
2017-04-03 18:48:48 -07:00
Spencer Ahrens 87bdcbde6a propagate getScrollResponder, getScrollableNode
Summary:
so users can call `setNativeProps` and do more compositing.

**Test Plan:**

Added this to `onPress` of `SectionListExample` and `FlatListExample`:

    this._listRef.getNode().getScrollResponder().setNativeProps({scrollEnabled: false});

and saw scroll get disabled. Note the call to `getNode` because we are using the `Animated.createComponent` wrapper.

Reviewed By: achen1, bvaughn

Differential Revision: D4821711

fbshipit-source-id: 8d1f3dd7ccc646524f154721c5c7036620d57132
2017-04-03 18:48:48 -07:00
Spencer Ahrens 128596b311 Fixup comments to indicate sticky headers are now supported
Reviewed By: achen1

Differential Revision: D4822080

fbshipit-source-id: a0f09eedca40ccc72581b7f6e55a09d9e8f3f61f
2017-04-03 18:48:47 -07:00
Spencer Ahrens e8f9c442d6 Fix separator keys for LayoutAnimation
Summary:
Should key separators with their cells.

**Test Plan**

before/after in this video: https://youtu.be/vid1w5x8-58

Reviewed By: achen1

Differential Revision: D4821708

fbshipit-source-id: 261f1bac34dfa9001297a24a44f11128f338e62b
2017-04-03 18:48:47 -07:00
Spencer Ahrens f186cfb9d6 Allow override of `scrollEventThrottle` (in case `useNativeDriver` is not an option)
Reviewed By: achen1

Differential Revision: D4819635

fbshipit-source-id: 9cc7b32e05bf2c573553b9806a17141f1783a1c6
2017-04-03 18:48:46 -07:00
Valentin Shergin bc1ea548d0 Better TextInput: Simplified focus/first-responder management on iOS
Summary:
Pair `reactWillMakeFirstResponder` and `reactDidMakeFirstResponder` was replaced with just `reactFocus` method
which is supposed to incapsulate all "focus" and "focus-later-if-needed" functionality.

Reviewed By: mmmulani

Differential Revision: D4664626

fbshipit-source-id: 8d3b7935ca26d32ba1d1826a585cce0396fcc885
2017-04-03 15:16:16 -07:00
Andrew Ingram dfaa03e1cb Fixes "guesture" typo in PanResponser docs
Summary:
Simple typo fix in docs.
Closes https://github.com/facebook/react-native/pull/13247

Differential Revision: D4819135

Pulled By: ericvicenti

fbshipit-source-id: 64bc597133a31276fdff8f1ef2ee061f2a9bb17d
2017-04-03 09:15:29 -07:00
Shruti Malugu edbb48c67a Replacing all instances of [UIApplication sharedApplication] wi…
Summary:
…th RCTSharedApplication()

Thanks for submitting a PR! Please read these instructions carefully:

- [ ] Explain the **motivation** for making this change.
          Using React Native latest version with Cocoapods 1.2.0 causes the following error inside iOS app extensions

> /react-native/React/Modules/RCTAccessibilityManager.m:67:70: ‘sharedApplication’ is unavailable: not available on iOS (App Extension) — Use view controller based solutions where appropriate instead.

Moving the use of [UIApplication sharedApplication] to RCTSharedApplication() which is safe on app extension

- [ ] Provide a **test plan** demonstrating that the code is solid.
        I am not sure how to test such that all the features which touch the modified code are tested.

- [ ] Match the **code formatting** of the rest of the codebase.
- [ ] Target the `master` branch, NOT a "stable" branch.

What existing problem does the pull request solve?
    Using React Native latest v
Closes https://github.com/facebook/react-native/pull/13227

Differential Revision: D4816338

Pulled By: javache

fbshipit-source-id: e3e3c77882990ad1817b0b633521cff52571ecd0
2017-04-01 03:34:41 -07:00
Spencer Ahrens 7ff18f290b Fix Warning/Yellow Box so it does not mess up app layout when opened.
Reviewed By: fkgozali

Differential Revision: D4808601

fbshipit-source-id: c15a7aa4514ea21798ceabca075189478596e0a2
2017-03-31 18:34:21 -07:00
Viktor Seč ec68c97d72 Add iOS Linking location example to docs
Summary:
Hi, the docs make it seem like `geo:${latitude},${longitude}` is the cross-platform way to link locations on Google/Apple Maps. This is Android-only though.

I did no changes to code.

I noticed that the Appetize.io embed tries to run the [Linking example](https://facebook.github.io/react-native/docs/linking.html) code on iOS, although the example uses Android location scheme. This results in errors. I'd like to fix this as well, but I have no idea how to tell the demo to run on Android.
Closes https://github.com/facebook/react-native/pull/13220

Differential Revision: D4804123

Pulled By: hramos

fbshipit-source-id: 2de85d56476933ec54ea423d76a0fe98ed5132d3
2017-03-31 10:46:55 -07:00
Marc Horowitz 1916b38a65 Support passing a collection of native modules to JSContext
Reviewed By: javache

Differential Revision: D4772649

fbshipit-source-id: dd9353edb0c2c013a3b7fe772231db12cdd8cdae
2017-03-31 01:00:52 -07:00
Brian Vaughn d4aa42a4ac Show more meaningful error stack in ReactNative redbox
Reviewed By: yungsters

Differential Revision: D4797372

fbshipit-source-id: 069c013bcc3d58dd38a25979f4a04aed5fc1dde6
2017-03-30 17:19:41 -07:00
Elie Teyssedou 56a4538b31 Update documentation for Modal's prop animationType
Summary:
I was using Modal component and I didn't knew what was the default for animationType prop. After reading the code, I saw that it was `none`.

I did not tell that the "default" is `slide` if animated is set to `true`, because it is not a default but an implementation of `animated` prop effect and because of the deprecation of `animated`.

Thanks.
Closes https://github.com/facebook/react-native/pull/13196

Differential Revision: D4795765

Pulled By: hramos

fbshipit-source-id: 25d62ac7eeb20fc5557918c3d75709f44f5d4972
2017-03-29 11:31:51 -07:00
Janic Duplessis c233191485 Animated - Add missing super calls to fix native animated crash
Summary:
There was some missing super.__detach calls in some Animated nodes, we rely on the base class being called to drop the node in the native implementation, not doing so will cause some nodes to leak. It also resulted in a crash when removing certain nodes because they would get updated after being detached.

**Test plan**
Reproduced the crash by unmounting a view that uses a DiffClamp node and made sure this fixes it. Also tested that other native animations still worked properly.

Fixes #11317
Closes https://github.com/facebook/react-native/pull/12910

Differential Revision: D4718188

Pulled By: javache

fbshipit-source-id: 179ec1334532152c124a9c0f447f488311925d0a
2017-03-29 04:02:22 -07:00
Janic Duplessis a85a86bd8d Fix tvOS build
Summary:
Not sure if this is the proper fix but changing PRODUCT_NAME to RCTAnimation did the trick. Also using `#import "RCTValueAnimatedNode.h"` instead of `#import <RCTAnimation/RCTValueAnimatedNode.h>` in `RCTNativeAnimatedNodesManager.h` can work too.
Closes https://github.com/facebook/react-native/pull/13190

Differential Revision: D4794401

Pulled By: javache

fbshipit-source-id: c33232a676131644afa80e34ca7a1516a2c89f7e
2017-03-29 02:35:59 -07:00
Spencer Ahrens 22a4205bdd onEndReached should clear when data changes
Summary: it's possible to update data and not have the content length change, which could prevent onEndReached from ever firing again, so fix that.

Reviewed By: bvaughn, yungsters

Differential Revision: D4783818

fbshipit-source-id: ec4640f4b8cf820165b045eaafee6fb41c0b0499
2017-03-28 20:07:09 -07:00
Brian Vaughn 1129c6096d Replaced View.propTypes with a static getter that warned about deprecation
Reviewed By: spicyj

Differential Revision: D4766860

fbshipit-source-id: c0ef46df58b6167178e801d9dbe481101c0dc773
2017-03-28 11:32:09 -07:00
Eric Vicenti 777e80a2b7 Remove CustomComponents folder and license
Reviewed By: yungsters

Differential Revision: D4787296

fbshipit-source-id: fddf3c520cb1092ed61b81db247a9572528eb767
2017-03-28 11:16:49 -07:00
Brian Vaughn 01215c013d Re-added null inst check to avoid EventPropagators bug
Reviewed By: fkgozali

Differential Revision: D4787522

fbshipit-source-id: 80eb4da5a6df46a8a7235358c70b2a04e43dc574
2017-03-28 11:01:54 -07:00
Janic Duplessis f46fd36a44 NativeAnimated - Fix missing update at the end of the batch
Summary:
This call got lost in the refactor of #11819 and caused some view updating issues.
Closes https://github.com/facebook/react-native/pull/13183

Differential Revision: D4787565

Pulled By: javache

fbshipit-source-id: 8f7d456824c67abee6ac1d5f906e4c831ede889b
2017-03-28 11:01:54 -07:00
Janic Duplessis 1d37dd063c Native Animated - Add tests on iOS
Summary:
Adds unit tests to the Native Animated implementation on iOS. This pretty much mirrors the tests we currently have on Android.

It also fixes 2 bugs I've found when adding the tests and pass the current time in `stepAnimation` instead of using `CACurrentMediaTime` to make testing easier.

- `stopListeningToAnimatedNodeValue` did not actually work at all, it should set the listener to nil.
- The finished value in the animation end callback was always true, this simplifies the `RCTAnimationDriver` interface to get rid of `removeAnimation` and fixes the end callback value.

**Test plan**
- Run the tests
- Make sure the UIExplorer example still works
Closes https://github.com/facebook/react-native/pull/13068

Differential Revision: D4786701

Pulled By: javache

fbshipit-source-id: a4f07e6eec1f363ca47b6f27984041793c915bfc
2017-03-28 09:16:58 -07:00
Janic Duplessis fb54a1eb3e Native Animated - Fix timing animation delay on iOS
Summary:
Delay was broken with native animations on iOS. After checking what android does to handle delay, I noticed it does nothing at all since the delay is already handled when generating the animation frames. This removes all code that tried to handle delay on iOS since it is not needed and breaks it. Also updated an example to have delay in UI explorer.

Fixes #12388

**Test plan**
Tested that delay works in UIExplorer on iOS and Android.
Closes https://github.com/facebook/react-native/pull/12443

Differential Revision: D4582514

Pulled By: javache

fbshipit-source-id: dc53295e716c8476c71ccd578380962f056de2be
2017-03-28 09:16:58 -07:00
Pieter De Baets bb48c0c608 Manually inline parseErrorStack
Reviewed By: davidaurelio

Differential Revision: D4779541

fbshipit-source-id: bb395a0abd3cf1f9c940429f375cd57ecb992789
2017-03-28 08:38:13 -07:00
Pieter De Baets 7de59b102d Support calls through MessageQueue when interecting with JSValue directly
Reviewed By: yungsters

Differential Revision: D4756241

fbshipit-source-id: 5c7309a18ac476a620451bf471471596c9f82cf8
2017-03-28 07:18:21 -07:00
Janic Duplessis c9fae2fb93 Native Animated - Restore default values when removing props on iOS
Summary:
This fixes a bug that causes properties to keep stale values because they were not restored to their default after being removed when their value was controlled by native animated.

To fix this we restore default values in `disconnectFromView` by updating views with null values for all props that we modified previously. However this causes another issue where we lose any props that were set by the normal process because NativeAnimated operations are always executed after UIManager operatations. To fix this I added a way to hook into UIManager view updating process to be able to execute NativeAnimated operations either before or after updating native views.

In the case of disconnecting we want to do it before updating views so that it does: Value changed by native animated -> value restored to default -> (optional) value updated by normal prop.

This PR also depends on #10658.

**Test plan**
Tested that this fixed a particular bug in an app that uses ex-navigation + native animations where a navbar w
Closes https://github.com/facebook/react-native/pull/11819

Differential Revision: D4752566

Pulled By: javache

fbshipit-source-id: 68ee28200ffeba859ae1b98ac753bd7dcb8910f0
2017-03-28 05:33:02 -07:00
Spencer Ahrens acc1edd188 expand example with `PureComponent` usage, explicit `extraData` prop, `initialNumToRender`
Summary: Should help with some common pitfalls, e.g. https://github.com/facebook/react-native/issues/12512#issuecomment-289521758.

Reviewed By: yungsters

Differential Revision: D4781833

fbshipit-source-id: 3dec2f0c444645ad710e9ed81390636da4581f0f
2017-03-27 20:00:10 -07:00
Brian Vaughn 6f9447e7b2 React sync (16 beta 6 plus addons)
Reviewed By: sebmarkbage

Differential Revision: D4775005

fbshipit-source-id: c50d099dc3d01c10e122c56f11bd990a2b1e81d1
2017-03-27 17:01:14 -07:00
Eric Vicenti 92d985fb49 Deprecate Navigator
Reviewed By: fkgozali

Differential Revision: D4770514

fbshipit-source-id: ea3ea7fc5515ff42394bacb4a63a9a6411185e2a
2017-03-27 13:32:29 -07:00
Janic Duplessis 87b0378eb8 Native Animated - Restore, reorganize and add new tests
Summary:
Native Animated tests were removed a while back because they were failing, this restores the existing tests and reorganize / cleanup them. It also adds new ones so we have at least one test for each public API. These tests mostly assert that the native animated module is called with the proper args.
Closes https://github.com/facebook/react-native/pull/12775

Differential Revision: D4684968

Pulled By: ericvicenti

fbshipit-source-id: 4783d5edd08101cab7c0ce2eec4f3ccd0fbc1d27
2017-03-27 11:46:05 -07:00
Eric Vicenti 7aa2c9ab17 NavigatorIOS - Remove NavigationContext
Reviewed By: fkgozali

Differential Revision: D4774022

fbshipit-source-id: 0184bcbcf6a458eac6377cc6e1cffc0924f0d2d2
2017-03-27 10:46:30 -07:00
Eric Vicenti af34c3452f Fix license header for TVEventHandler
Reviewed By: yungsters

Differential Revision: D4775067

fbshipit-source-id: 3504b0429c14d6a7d79ac4c8464113f4a19ae230
2017-03-27 10:32:14 -07:00
Brian Vaughn 848593c0f0 Moved takeSnapshot method from UIManager to ReactNative
Reviewed By: spicyj

Differential Revision: D4767428

fbshipit-source-id: 77c80c0135641ab46f9dce2763f27499a96373a0
2017-03-25 00:46:54 -07:00
Spencer Ahrens 27c3e32abf FrameRateLogger JS module
Summary:
This adds a flowified JS module for the FrameRateLogger native module and plugs
it into `ScrollResponder` and `AppRegistry`.

If there is no `FrameRateLogger` native module, then the function calls will be no-ops.

One major limitation is that we can't track animated/programatic scrolls because we don't
have reliable end events. Would be generally useful to add those in a followup though.

Reviewed By: fkgozali

Differential Revision: D4765694

fbshipit-source-id: f3bec771df6ac918200c1afd1a7d8b6da540a4e2
2017-03-24 18:30:59 -07:00
Eric Vicenti 09fe99972d Fix license headers on SwipableRow
Reviewed By: hramos

Differential Revision: D4770164

fbshipit-source-id: fc1cbbdd2161d4fd307cb14821318466fa6fca57
2017-03-24 14:47:28 -07:00
Eric Vicenti ff4468ad1b Re-License Lists with standard React Native License
Reviewed By: sahrens

Differential Revision: D4771084

fbshipit-source-id: 9878a813b7dacb6ec1215fee469b946df0752de9
2017-03-24 14:31:19 -07:00
Pieter De Baets 3f46e591ff Fix crash when overriding native modules on RCTJSCExecutor
Reviewed By: alexeylang

Differential Revision: D4769955

fbshipit-source-id: 20f4f4c469eafbe2c7a81ad9f5b9a8386195a8ac
2017-03-24 09:31:04 -07:00
Brian Vaughn de8ce45258 Ran codemod to replace View.propTypes with ViewPropTypes
Reviewed By: yungsters

Differential Revision: D4764838

fbshipit-source-id: 0b47a0fdd6793dab9333bb73bb93053fccc27dae
2017-03-24 00:30:48 -07:00
Brian Vaughn 9a88c72163 Exposed new ViewPropTypes object on ReactNative renderer (stack and fiber)
Reviewed By: yungsters

Differential Revision: D4765002

fbshipit-source-id: 54be903bf6529df7ab2cff265c1f87b145da8d94
2017-03-23 17:45:30 -07:00
Eric Vicenti febf3d00ed Remove Deprecated NavigationExperimental
Summary:
Now that there are a number of good navigation solutions provided by the community, we are ready to remove NavigationExperimental from the RN core. The latest navigation doc explains the available options pretty well: http://facebook.github.io/react-native/docs/navigation.html . We should also add a mention to Airbnb's new native-navigation.

For anybody who continues to rely on it, it is recommended to migrate to React Navigation, which will be maintained over the long-term. For those who cannot migrate yet, it is possible to copy this code into your app.
Closes https://github.com/facebook/react-native/pull/13066

Differential Revision: D4757539

Pulled By: ericvicenti

fbshipit-source-id: 949d9b33f188584fb095155fa67d3ce24beba29f
2017-03-23 17:29:56 -07:00
Pieter De Baets 7c9173bc9e Enable -Wimplicit-retain-self en sync warning config for all projects
Summary:
This is enforced for all of our internal iOS code and a common cause of import failures.

cc janicduplessis
Closes https://github.com/facebook/react-native/pull/13124

Differential Revision: D4765016

fbshipit-source-id: 7c8248c98bca0fa6bad24d5a52b666243375e0db
2017-03-23 15:01:34 -07:00
Gustavo Perdomo 3df654e28e Integrare UNUserNotification
Summary:
Implementing removeAllDeliveredNotifications and removeDeliveredNotifications for remove notifications from notification center, and getDeliveredNotifications

Thanks for submitting a PR! Please read these instructions carefully:

- [x] Explain the **motivation** for making this change.
- [x] Provide a **test plan** demonstrating that the code is solid.
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch, NOT a "stable" branch.

Currently, calling PushNotificationIOS.cancelAllLocalNotifications not remove the notification from the Notification Center

In iOS 10, a new UNUserNotification class was introduced, this class has a method which get and remove the notifications from notification center

This PR try to solve that.

In my case, i'm working with an messaging app, every message is a new notification, when the user tap a notification, the app is opened and the rest of notifications should be gon
Closes https://github.com/facebook/react-native/pull/13036

Differential Revision: D4761828

Pulled By: javache

fbshipit-source-id: 216e44a64f1bf88b5ae3045d1fa6eca8a1278a71
2017-03-23 12:02:25 -07:00
Pieter De Baets 9d377e98a0 Fix warnings in React.xcodeproj
Summary:
Various fixes of xcode projects and cleaning up some warnings
Closes https://github.com/facebook/react-native/pull/13109

Differential Revision: D4762652

Pulled By: lacker

fbshipit-source-id: b452976a58962439de4adecc8e703264af40cb38
2017-03-23 11:36:17 -07:00
Brian Vaughn 333dd59533 ReactNativeFiber findNodeHandle() bugfix
Reviewed By: sahrens

Differential Revision: D4762397

fbshipit-source-id: d047f5c77067dbf8b0331695bb661e04ce00913c
2017-03-23 11:03:43 -07:00
Brian Vaughn 53905a537a ReactNative moved View.propTypes to ViewPropTypes
Reviewed By: yungsters

Differential Revision: D4761354

fbshipit-source-id: b49922d78ee5d8628f945e5dee476ffe5d889b07
2017-03-23 09:15:42 -07:00
Pieter De Baets a2cfea1934 Fix usages of ReactComponentWithPureRenderMixin
Summary: Closes https://github.com/facebook/react-native/pull/13111

Differential Revision: D4761971

Pulled By: davidaurelio

fbshipit-source-id: 668dcc58e8e1b075ee760233abc6904beede9218
2017-03-23 06:33:24 -07:00
Tim 720e19525e Picker (android): Convert children to an array before accessing with a position
Summary:
When using the following component, `this.props.children` is not a flat array.

``` js
class Example extends Component {
    // ...

    render() {
        const values = ['1', '2'];

        return (
            <Picker
                value={this.state.value}
                onValueChange={this.onValueChange.bind(this)}
            >
                <Picker.Item
                    label="n/a"
                    value={null}
                />

                {values.map(value => {
                    return (
                        <Picker.Item
                            label={value}
                            value={value}
                        />
                    );
                })}
            </Picker>
        );
    }
}
```

The resulting `this.props.children` is:

``` js
[
    (child),
    [
        (child),
        (child),
    ],
];
```

Therefor you can't use `this.props.children[2]` to get the last item.

The Android version of the [Picker](https://facebook.github.io/react-native/do
Closes https://github.com/facebook/react-native/pull/8153

Differential Revision: D4753480

Pulled By: javache

fbshipit-source-id: deb0264746b39303e66c69c191af0c962db39085
2017-03-23 06:16:51 -07:00
Brian Vaughn 703936d9e3 Sync React master (and 16 alpha 4)
Reviewed By: sebmarkbage

Differential Revision: D4747529

fbshipit-source-id: 5efea6422a2502f27c1b23506cbae2187c7f7b0d
2017-03-22 21:30:50 -07:00
Janic Duplessis 14c31d93da Remove React addons from react-native-implementation
Summary:
These modules don't exist in React anymore so this causes new apps to redscreen because the packager cannot resolve those modules.

**Test plan**
Tested that this and removing NavigationExperimental (it also uses removed React exports) causes UIExplorer to work again.
Closes https://github.com/facebook/react-native/pull/13095

Differential Revision: D4757762

Pulled By: ericvicenti

fbshipit-source-id: bb246d4c6b15f5d3c71e31f133a468aea220f308
2017-03-22 17:46:01 -07:00
Andrew Clark d9910a5d61 Use checkPropTypes instead of directly calling PropTypes
Reviewed By: sebmarkbage

Differential Revision: D4748563

fbshipit-source-id: 137c8bd637549c455bff3be61143e8e438c6a886
2017-03-22 16:04:12 -07:00
Brian Vaughn ef3db66bb1 Added deprecation warning for View.* static accessibility traits accessors
Reviewed By: spicyj

Differential Revision: D4749932

fbshipit-source-id: 5f07200e953f589f939196a161a1bc796c553868
2017-03-22 10:00:54 -07:00
Alexey Lang e22898bcff Refactor measuring app require time
Reviewed By: javache

Differential Revision: D4746020

fbshipit-source-id: cfc9de286feeac49b4b569560dc29c7a1c25eee1
2017-03-22 08:00:27 -07:00
Pieter De Baets 950637672a Add flow typing to PerformanceLogger
Reviewed By: AaaChiuuu

Differential Revision: D4749896

fbshipit-source-id: 8a3f12e5d7b209c48c95f8564d8e3bcbd19f90c8
2017-03-22 05:38:05 -07:00
Pieter De Baets 005fbe6aa4 Fix PerformanceLogger clearing unfinished events
Reviewed By: alexeylang

Differential Revision: D4749516

fbshipit-source-id: 348f1cf51c01b39a410be8b39598e8e98cd52d55
2017-03-22 05:38:04 -07:00
Pieter De Baets 0ea1ea5fb7 Remove unused websocket-executor-name and websocket-executor-port options
Reviewed By: davidaurelio

Differential Revision: D4745529

fbshipit-source-id: 2c69aca33c999ccf2af8dbf8d9af2c1d123b59cd
2017-03-22 05:38:04 -07:00
sunnylqm f39ef36190 Update FlatList doc
Summary:
1. Mention scrollToIndex support.
2. Fix a format error.
3. Use relative links like 59257d6976/Libraries/Components/Navigation/NavigatorIOS.ios.js (L136) for links in "next version" to work properly.

~~4. BREAKING: `columnWrapperStyle` should be `rowWrapperStyle`?~~
Closes https://github.com/facebook/react-native/pull/12714

Differential Revision: D4730476

Pulled By: sahrens

fbshipit-source-id: 643aab659064e6f5275ec89fd7f967dd9de866c4
2017-03-22 00:00:56 -07:00
Spencer Ahrens 93c438d470 Fix nodeHandle crash
Summary:
It's supposed to take a component or a handle, per the arg name, so switch on the type (and handle `null`).

`FlatListExample` no longer crashes.

Reviewed By: bvaughn, sebmarkbage

Differential Revision: D4752619

fbshipit-source-id: 720421f648f7c2049b5cc44f006484eb47d22d86
2017-03-21 22:47:03 -07:00
Spencer Ahrens 46d6766a53 useful error when switching numColumns on the fly
Reviewed By: blairvanderhoof, bvaughn

Differential Revision: D4742842

fbshipit-source-id: a11a088194ead02cc11eb6ccd9ce6d6f75ead3a3
2017-03-21 22:30:30 -07:00
Spencer Ahrens 1531f5f284 change section-specific SeparatorComponent -> ItemSeparatorComponent for consistency
Summary: Not sure how I missed this in 3ce31c24da

Reviewed By: yungsters

Differential Revision: D4731083

fbshipit-source-id: 860ed9d2f99312cd02b84ba467ba66afc5cdd5c5
2017-03-21 22:30:30 -07:00
Spencer Ahrens 5c856150ff Kill shouldItemUpdate
Summary:
It was just adding unnecessary complexity. Users should just use standard React perf best practices, like `PureComponent` and `shouldComponentUpdate`.

This should be backwards compatible - existing `shouldItemUpdate` usage will just be ignored and should consider migrating to this pattern:

```
class MyItem extends React.PureComponent {
  _onPress = () => {
  	this.props.onPressItem(this.props.id);
  };
  render() {
    return (
      <SomeOtherWidget title={this.props.title} onPress={this._onPress} />
    )
  }
}
...
_renderItem = ({item}) => (
  <MyItem onPressItem={this._onPressItem} title={item.title} id={item.id} />
);
```

Which will automatically prevent re-renders unless the relavent data changes.

Reviewed By: yungsters

Differential Revision: D4730599

fbshipit-source-id: 0f61efe96eb4d95bb3b7c4ec889e3e0e34436e56
2017-03-21 22:30:30 -07:00
Spencer Ahrens 72670bf8d2 support sticky headers
Summary:
This adds support for both automagical sticky section headers in
`SectionList` as well as the more free-form `stickyHeaderIndices` on
`FlatList` or `VirtualizedList`.

The basic concept is to take the initial `stickySectionHeaders` and remap them
to the indices corresponding to the mounted subset in the render window. The
main trick here is that the currently stuck header might itself be outside of
the render window, so we need to search the gap to see if that's the case and
render it (with spacers above and below it instead of one big spacer).

In the `SectionList` we simply pre-compute the sticky headers at the same time
as when we scan the sections to determine the flattened length and pass those
to `VirtualizedList`.

This also requires some updates to `ScrollView` to work in the churny
environment of `VirtualizedList`. We propogate the keys on the children to the
animated wrappers so that as items are removed and the indices of the
remaining items change, react can keep proper track of them. We also fix the
scroll back case where new headers are rendered from the top down and aren't
updated with the `setNextLayoutY` callback because the `onLayout` call for the
next header happened before it was mounted. This is done by just tracking all
the layout values in a map and providing them to the sticky components at
render time. This might also improve perf a little by property configuring the
animations syncronously instead of waiting for the `onLayout` callback. We
also need to protect against stale onLayout callbacks and other fun stuff.

== Test Plan ==

https://www.facebook.com/groups/react.native.community/permalink/940332509435661/

Scroll a lot with and without debug mode on. Make sure spinner
still spins and there are no crashes (lots of crashes during development due
to the animated configuration being non-monotonic if anything stale values get
through). Also made sure that tapping a row to change it's height would
properly update the animation configurations so the collision point would
still be correct.

Reviewed By: yungsters

Differential Revision: D4695065

fbshipit-source-id: 855c4e31c8f8b450d32150dbdb2e07f1a9f9f98e
2017-03-21 22:30:30 -07:00
Spencer Ahrens edd5624fde invariants around scrollToIndex without getItemLayout
Summary: People might be tempted to try and scrollTo an index that hasn't been rendered yet, which is broken, so instead of jank let's throw.

Reviewed By: yungsters

Differential Revision: D4727402

fbshipit-source-id: b6f9fd5b70b6f076c30141d00b2b9e2a51b14e87
2017-03-21 22:30:30 -07:00
Spencer Ahrens 462352e609 add jest snapshot tests
Reviewed By: yungsters

Differential Revision: D4726519

fbshipit-source-id: 1ae98743cdb89acb2708d84073527015dbeee906
2017-03-21 22:30:30 -07:00
Marc Horowitz ba149d7277 Tease apart React and RCTBatchedBridge targets
Reviewed By: javache

Differential Revision: D4679655

fbshipit-source-id: 8123488c2d50dd7cc2329b5131e99998fe1f1e2f
2017-03-21 18:31:23 -07:00
Jeremi Stadler c41b29d6de Fixes missleading comment on getInitialURL
Summary:
The returned value from Linking.getInitialURL is a promise that returns an url.

Can be seen here: f126540519/Libraries/Linking/Linking.js (L175)
Closes https://github.com/facebook/react-native/pull/12851

Differential Revision: D4716084

Pulled By: hramos

fbshipit-source-id: 309881cfb423a5c9a3f9010ae7ca226b63c91599
2017-03-21 16:34:42 -07:00
Héctor Ramos a0304327a9 Remove Navigator recommendation
Summary:
We recommend using `react-navigation` over `Navigator`. Adds a link to the new `native-navigation` component as well.

Did not test website generation, this is a comments only edit that should work fine.
Closes https://github.com/facebook/react-native/pull/12963

Differential Revision: D4749072

Pulled By: hramos

fbshipit-source-id: 4506630306c44b24b95c4f5d5a42c1caa9e2cd4e
2017-03-21 15:15:48 -07:00
Valentin Shergin 1433185a09 Improved implementation of placeholer feature in RCTUITextView
Reviewed By: fkgozali

Differential Revision: D4746177

fbshipit-source-id: a8c27ec052b046d4732b14ed081dcaebb44bdaa7
2017-03-21 13:02:22 -07:00
David Aurelio 2b4762f184 Only use `EventValidator` in development mode
Summary: Only pulls in `EventValidator` for development mode, as warnings about invalid events are pointless in production builds.

Reviewed By: javache

Differential Revision: D4745852

fbshipit-source-id: dbab1026df35d54a82e1e620fac08304c58fbeae
2017-03-21 10:09:38 -07:00
David Aurelio a34956f2fb Remove `copyProperties`
Summary: remove `copyProperties` module, and replace the functionality with `Object.assign`

Reviewed By: javache

Differential Revision: D4745771

fbshipit-source-id: 2440620757e7539dbd7fd39f5920ac0b5b4183c5
2017-03-21 08:01:58 -07:00
David Aurelio 80e1dbf692 require `fbjs/lib/invariant`, not `invariant`
Summary: `invariant` is only available in open source because we install it as a transitive dependency into node_modules

Reviewed By: jeanlauliac

Differential Revision: D4745582

fbshipit-source-id: 27c49b576254c8d1d667dea7097d16cdd1205daf
2017-03-21 05:37:03 -07:00
Brian Vaughn 3954400565 Added MobileConfig for ReactNative use-fiber
Reviewed By: yungsters

Differential Revision: D4740267

fbshipit-source-id: d2cf76a22ce0f6337e1055b9f4b869c8bd82fa7d
2017-03-20 16:31:55 -07:00
Brian Vaughn 9344f3a95b Support string return type from RN createReactNativeFiberComponentClass()
Reviewed By: sebmarkbage

Differential Revision: D4607283

fbshipit-source-id: 466d2373dd570f77ebcced306d2f20a3f72d79c6
2017-03-20 13:07:06 -07:00
Aaron Chiu ebb55c6bcc log difference in QPL vs PerformanceLogger
Reviewed By: alexeylang

Differential Revision: D4736500

fbshipit-source-id: e5f8590ae7482dbfbbe64403b0162fb496572ac6
2017-03-20 13:07:06 -07:00
Valentin Shergin b53d76efb7 Better TextInput: RCTUITextView was decoupled in separate file and now handles placeholder feature
Reviewed By: mmmulani

Differential Revision: D4663151

fbshipit-source-id: ce57ca4bebf4676df2ae5e586a1b175ec2aac760
2017-03-20 00:02:58 -07:00
Valentin Shergin 1b013cd30c Better TextInput: Fixing multiline <TextInput> insets and prepare for auto-expanding feature
Summary:
Several things:
 * The mess with insets was fixed. Previously we tried to compensate the insets difference with `UITextField` by adjusting `textContainerInset` property, moreover we delegated negative part of this compensation to the view inset. That was terrible because it breaks `contentSize` computation, complicates whole insets consept, complicates everything; it just was not right. Now we are fixing the top and left inset differences in different places. We disable left and right 5pt margin by setting `_textView.textContainer.lineFragmentPadding = 0` and we introduce top 5px inset as a DEFAULT value for top inset for common multiline <TextInput> (this value can be easilly overwritten in Javascript).
 * Internal layout and contentSize computations were unified and simplified.
 * Now we report `intrinsicContentSize` value to Yoga, one step before auto-expandable TextInput.

Depends on D4640207.

Reviewed By: mmmulani

Differential Revision: D4645921

fbshipit-source-id: da5988ebac50be967caecd71e780c014f6eb257a
2017-03-20 00:02:55 -07:00
Valentin Shergin 3acafd1f3d Better TextInput: Removed redundant UIScrollView from RCTTextView
Reviewed By: mmmulani

Differential Revision: D4640207

fbshipit-source-id: 01fc65b0212ad6baef500625679dab5e99da9db5
2017-03-20 00:02:54 -07:00
Valentin Shergin 23c2a6cf1a Removed harmful optimization in ReactNativeEventEmitter
Reviewed By: spicyj

Differential Revision: D4729779

fbshipit-source-id: 2dd5ec10d42df7f24804796c4100eca107edeedb
2017-03-19 21:46:48 -07:00
Arman Dezfuli-Arjomandi 22da6f2f3f Fix typo in FlatList docs
Summary:
Thanks for submitting a PR! Please read these instructions carefully:

- [x] Explain the **motivation** for making this change.
- [x] Provide a **test plan** demonstrating that the code is solid.
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch, NOT a "stable" branch.

There was a typo in the FlatList docs for numColumns affecting the formatting of its description.

N/A

Sign the [CLA][2], if you haven't already.

Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

Make sure all **tests pass** on both [Travis][3] and [Circle CI][4]. PRs that break tests are unlikely to be merged.

For more info, see the ["Pull Requests"][5] section of our "Contributing" guidelines.

[1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
[2]: https://code.facebook.com/cla
Closes https://github.com/facebook/react-native/pull/13002

Differential Revision: D4735343

fbshipit-source-id: f781c50c892d64e69f61aec980614e948a48f48b
2017-03-18 13:02:29 -07:00
Spencer Ahrens 9c3e6ae9f0 Fix Animated.event attach/detach on component re-render
Summary:
Need to make sure `detach` happens on the old `scrollableNode` before it's unmounted and that `attach` happens on the new `scrollableNode` after it's mounted. This should also be more performant because the detach step no longer requires iterating through all the props, most of which are not animated, and we filter out unneeded updates if props or ref haven't changed.

= Test Plan =

Hook up native onscroll events in `FlatListExample` and toggle "debug" - before, the events would stop working because they would try to attach to the old unmounted node, but with this diff it keeps working as expected.

Reviewed By: fkgozali

Differential Revision: D4687186

fbshipit-source-id: 313a7964d4614190308490a51fc4f56abb6690f8
2017-03-17 22:15:40 -07:00
Ashwin Bharambe f48b54bf62 Expose RCTImageLocalAssetURL as a utility
Reviewed By: javache

Differential Revision: D4696627

fbshipit-source-id: 56d3e59983f524dfd5021835734b9b34203e20f2
2017-03-17 17:02:06 -07:00
Ashwin Bharambe 95c1926193 Introduce `DeviceInfo` as a new native module
Summary:
The `UIManager` already has a lot of responsibilities and is deeply
tied with React Native's view architecture. This diff separates out a
`DeviceInfo` native module to provide information about screen dimensions and
font scale, etc.

Reviewed By: fkgozali

Differential Revision: D4713834

fbshipit-source-id: f2ee93acf876a4221c29a8c731f5abeffbb97974
2017-03-17 17:01:57 -07:00
Brian Vaughn 6620b1ff7d Added ReactNative feature-flag switch between Stack and Fiber builds
Reviewed By: sebmarkbage

Differential Revision: D4606164

fbshipit-source-id: 5f25dbc52298d359e11e52341ff3570c797a6ea9
2017-03-16 19:30:29 -07:00
Sebastian Markbage 17cb70efdd Apply numeric text event bubbling fix for Android
Reviewed By: bvaughn

Differential Revision: D4726029

fbshipit-source-id: 94c8025bb59cc0970b6cc8ce7f3caf6e867bf72b
2017-03-16 18:16:02 -07:00
Spencer Ahrens b1a63f0088 Fix minimumViewTime
Reviewed By: blairvanderhoof

Differential Revision: D4723575

fbshipit-source-id: a120eef4079a808bd3dead08df93989e1db3d96a
2017-03-16 16:45:54 -07:00
Mehdi Mulani 55f48eb9f6 Move RCTLinkingManager to the main thread
Reviewed By: shergin

Differential Revision: D4709352

fbshipit-source-id: 3fc86504b12fe64dd94dd7330073d1a4a4f272e2
2017-03-16 16:02:38 -07:00
Spencer Ahrens 7e4c93d65a Fix doubled ItemSeparators
Summary: Forgot to update these after rename...

Reviewed By: yungsters

Differential Revision: D4723788

fbshipit-source-id: 8cf7e8de57a23d9ee0a424aa9c0d62ab1cfbbb12
2017-03-16 16:02:36 -07:00
Andy Street 3637bce479 Warn when timers longer than 1 min are set pending AlarmManager support
Summary:
These are bad since the app might not be foregrounded anymore and it also keeps the timing module awake. We could fix the latter but the former would require someone adding AlarmManager support.

Open to better/more helpful ideas for the warning message but there's not a ton we can tell them to do right now.

Reviewed By: achen1

Differential Revision: D4716273

fbshipit-source-id: c5d3a3ce8af53253b240477f2bde38094a138a02
2017-03-16 15:19:02 -07:00
mlanter 9d3292069d Add support for animating nested styles
Summary:
This adds the ability to nest animated styles and is a follow up to #11030 .

**Test plan (required)**
Verify a component with a shadowOffset animation animates.

Example:
```
<Animated.View
  style={{
    shadowOffset: {
      width: 0,
      height: this._pressAnim.interpolate({
        inputRange: [0, 1],
        outputRange: [20, 5],
      }),
    },
  }},
/>

```

![example](https://cloud.githubusercontent.com/assets/19673711/23878825/e29f6ae4-0806-11e7-8650-9cff1f591204.gif)
Closes https://github.com/facebook/react-native/pull/12909

Differential Revision: D4723933

fbshipit-source-id: 751d7ceb4f9bb22283fb14a5e597730ffd1d9ff6
2017-03-16 14:45:53 -07:00
Bin Yue c53404a688 Fix TextInput 'defaultValue' propTypes to 'string'
Summary:
Because `TextInput` only render the `defaultValue` of `string`, when using other types of values, it will render empty('') without any Warnings.
Closes https://github.com/facebook/react-native/pull/11478

Differential Revision: D4340132

Pulled By: lacker

fbshipit-source-id: aedb96d49277836000c0adc53007c97db6363253
2017-03-15 18:08:22 -07:00
Mike Adams 7f4054df76 Update FlatList.js
Summary:
Only a small amendment, but took me a little bit to figure out why this wasn't working.
Closes https://github.com/facebook/react-native/pull/12706

Differential Revision: D4656700

fbshipit-source-id: d6038581aa70e96a2be775a7a9786e8c7e64f762
2017-03-15 17:00:46 -07:00
Daniel Woelfel 5f8e46b8b4 prevent undefined is not an Object exception
Reviewed By: sebmarkbage

Differential Revision: D4707119

fbshipit-source-id: 403d7c26a1910d0ed1b980f305aa2b6326f371a2
2017-03-14 13:16:11 -07:00
Edwin 8a7eb170dd Adds Animated.loop to Animated API
Summary:
* Any animation can be looped on the javascript thread
* Only basic animations supported natively at this stage, loops run
using the native driver cannot contain animations of type sequence,
parallel, stagger, or loop

Motivation: We need a spinner in our app that is displayed and animated while the javascript thread is tied up with other tasks. This means it needs to be offloaded from the javascript thread, so that it will continue to run while those tasks are churning away.

I originally submitted PR #9513, which has served our needs, but brentvatne pointed out a better way to do it. Had hoped his suggestion would be implemented by janicduplessis or another fb employee, but after 5 months I thought I'd give it another push.

I've put together an implementation that basically matches the suggested API. Let me know what you think, and whether others can pick it up from here and get it in to core.

Personal Motivation: I am leaving my current organisation on Feb 10th, so am trying to clean thing
Closes https://github.com/facebook/react-native/pull/11973

Differential Revision: D4704381

fbshipit-source-id: 42a2cdf5d53a7c0d08f86a58485f7f38739e6cd9
2017-03-14 00:00:08 -07:00
Valentin Shergin fa30f41403 Better TextInput: RCTTextView and RCTTextField was marked as Yoga leaf nodes
Reviewed By: mmmulani

Differential Revision: D4639060

fbshipit-source-id: d4580303a61a7f86cf8bb6ec016fd9834340ffe0
2017-03-13 13:46:26 -07:00
amilcar-andrade 2976aa12bc Fixes spelling mistake inside TouchableNativeFeedback.android.js
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/12901

Differential Revision: D4699296

Pulled By: hramos

fbshipit-source-id: 514ae27c47c8ae22e1aadb99a787daa6fdc3b6a4
2017-03-13 12:31:41 -07:00
Spencer Ahrens 3ce31c24da Rename *Component props to match SectionList
Reviewed By: yungsters

Differential Revision: D4697335

fbshipit-source-id: 742b7a1729ba7a08fe3d9707bcf6c51026779739
2017-03-13 09:45:45 -07:00
Spencer Ahrens 82ff298c00 Update ListView sticky header docs
Summary:
Sticky headers work on android now, but are only enabled by default on ios, so reflect that in the docs.

cc janicduplessis
Closes https://github.com/facebook/react-native/pull/12860

Differential Revision: D4691071

fbshipit-source-id: 0e28f948dc587561b6f20c3615cdf65dfebd9b73
2017-03-10 13:32:45 -08:00
Spencer Ahrens f28f5d34d0 Sticky headers are no longer ios-only
Summary:
Should have removed this in 77b8c09727

cc janicduplessis
Closes https://github.com/facebook/react-native/pull/12859

Differential Revision: D4691047

fbshipit-source-id: 5633c99d42bf1ed788783669571852285303cdb5
2017-03-10 13:32:45 -08:00
Spencer Ahrens 5177a55314 native animated scroll event support
Reviewed By: yungsters

Differential Revision: D4648383

fbshipit-source-id: fdb8e2deaa06b2d2f9002cee2c0b827dbd7a5570
2017-03-09 22:15:53 -08:00
Fred Liu 28ed5eddf2 Revert D4494386: [react-native][PR] BREAKING - Remove LayoutAnimation experimental flag on Android
Differential Revision: D4494386

fbshipit-source-id: 1ba6fc60467d1c3347c90e52a3251e6591a99e25
2017-03-09 20:16:37 -08:00
cailenmusselman dd5ac841d2 YellowBox" Only provide elevation style prop when running on Android
Summary:
For unknown reasons, setting elevation: Number.MAX_VALUE causes remote debugging to hang on iOS (some sort of overflow maybe). Setting it to Number.MAX_SAFE_INTEGER fixes the iOS issue, but since elevation is an android-only style property we might as well remove it altogether for iOS.

See: https://github.com/facebook/react-native/issues/12223
Closes https://github.com/facebook/react-native/pull/12744

Differential Revision: D4684524

Pulled By: mkonicek

fbshipit-source-id: 7fb4f6da1c5c0cb437beff0e75122523e7233b72
2017-03-09 15:30:29 -08:00
Janic Duplessis 921b9ac53d Native Animated - Support multiple events attached to the same prop
Summary:
Re-applying the diff that was reverted in D4659669 / b87f4abf78 because of some crashes with fixes from D4659708 merged in.

 ---

Fixes a bug that happens when trying to use ScrollView with sticky headers and native `Animated.event` with `onScroll`. Made a few changes to the ListViewPaging UIExplorer example to repro https://gist.github.com/janicduplessis/17e2fcd99c6ea49ced2954d881011b09.

What happens is we need to be able to add multiple events to the same prop + viewTag pair. To do that I simple changed the data structure to `Map<prop+viewTag, List<AnimatedEventDriver>>` and try to optimize for the case where there is only one item in the list since it will be the case 99% of the time.

**Test plan**
Tested by reproducing the bug with the above gist and made sure it was fixed after applying this diff.
Closes https://github.com/facebook/react-native/pull/12697

Reviewed By: fkgozali

Differential Revision: D4661105

Pulled By: sahrens

fbshipit-source-id: c719dc85f45c1a142ef5b9ebfe0a82ae8ec66497
2017-03-09 15:30:28 -08:00
Mike Lambert bfb2766c63 Allow Promise to display error strings and not just error objects.
Summary: Closes https://github.com/facebook/react-native/pull/9989

Reviewed By: bestander

Differential Revision: D4147256

Pulled By: hramos

fbshipit-source-id: 62d49b592391bad434062e3c0d9c8287842664a8
2017-03-09 14:30:57 -08:00
Jakob Kerkhove a592e5bfa0 Typo documentation ScrollView
Summary:
Typo documentation ScrollView: 'as as alternative' => 'as an alternative'
Closes https://github.com/facebook/react-native/pull/12826

Differential Revision: D4681930

Pulled By: mkonicek

fbshipit-source-id: a10574c659c949359da0be9e6e82f597e9a3eb73
2017-03-09 09:32:02 -08:00
Douglas Lowder f5585b3d75 ScrollView should not use RefreshControl on tvOS
Summary:
**Motivation**: On tvOS, Flatview and other components that use ScrollView with a RefreshControl will break without this change.

**Test plan**: Manual testing on tvOS simulator.
Closes https://github.com/facebook/react-native/pull/12751

Differential Revision: D4669503

fbshipit-source-id: 320036571788dc0102ec2611492d0fc97bceb53b
2017-03-09 04:45:28 -08:00
Mohammed 0150bc76eb Updating the documentation for getSize()
Summary:
Clearly state that the `getSize()` does not work for static image resources because it is assumed the developer knows their static image resource size (the reason I got from a comment on a github issue by a react native contributor).

This missing documentation cost me about 30 minutes to figure out why it didn't work for my static image resource and so I decided to update the documentation 💃
Closes https://github.com/facebook/react-native/pull/11645

Differential Revision: D4533463

Pulled By: lacker

fbshipit-source-id: 70e175ea30a5540c8a9f2a0c040585c711d82ac3
2017-03-08 06:45:22 -08:00
Janic Duplessis abc483a653 BREAKING - Remove LayoutAnimation experimental flag on Android
Summary:
I don't remember exactly where we talked about this but LayoutAnimation on Android is pretty stable now so there's no reason to keep it behind an experimental flag anymore. The only part that is not really stable is delete animations, so what I did is remove the default delete animation that we provide in presets.

**Test plan**
Tested that layout animations work properly without any config.
Closes https://github.com/facebook/react-native/pull/12141

Differential Revision: D4494386

Pulled By: mkonicek

fbshipit-source-id: 5dd025584e35f9bff25dc299cc9ca5c5bf5f17a3
2017-03-08 06:45:22 -08:00
Prabakar Marimuthu 36eb69ecd0 Added option to set mixed content mode in android webview
Summary:
PR for option to set mixed content mode in Webview(Android) for issue #8460
Closes https://github.com/facebook/react-native/pull/12314

Differential Revision: D4663084

Pulled By: lacker

fbshipit-source-id: 0e40ea463739166311ddcb7887ff6d0289369637
2017-03-08 06:45:22 -08:00
Adam Comella 454ab8fc23 BREAKING: iOS: Support withCredentials flag in XHRs
Summary:
Corresponding Android PR: #12276

Respect the withCredentials XMLHttpRequest flag for sending cookies with requests. This can reduce payload sizes where large cookies are set for domains.

This should fix #5347.

This is a breaking change because it alters the default behavior of XHR. Prior to this change, XHR would send cookies by default. After this change, by default, XHR does not send cookies which is consistent with the default behavior of XHR on web for cross-site requests. Developers can restore the previous behavior by passing `true` for XHR's `withCredentials` argument.

**Test plan (required)**

Verified in a test app that XHR works properly when specifying `withCredentials` as `true`, `false`, and `undefined`. Also, my team uses this change in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/12275

Differential Revision: D4673644

Pulled By: mkonicek

fbshipit-source-id: 2fd8f536d02fb39d872eb849584c5c4f7e7698c5
2017-03-08 06:15:15 -08:00
Adam Comella 36f09dc252 Add onabort to XHR classes
Summary:
04d870b added support for onabort in XHRs. The other on* events are declared on XMLHttpRequest and XMLHttpRequestEventTarget. This adds onabort there as well.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/12277

Differential Revision: D4673648

Pulled By: mkonicek

fbshipit-source-id: 0c5255da77537103c5ad91d9b2826d064140708d
2017-03-08 05:59:41 -08:00
Martin Konicek 48f30eca7e Move iOS Maps out of the GitHub repo to internal fb codebase
Summary:
MapView has been deprecated in open source for a while: http://facebook.github.io/react-native/docs/mapview.html
We still want to use it internally. Moving it away from the GitHub folder.

Reviewed By: mmmulani

Differential Revision: D4646199

fbshipit-source-id: f469971e448dbca12afe141b43fa8a2518c7d467
2017-03-08 05:01:36 -08:00
Martin Konicek adf650debc Use different function syntax that the JS parser used to build the website can understand
Summary:
For some reason the parser doesn't support that syntax. It fails with:

```
Cannot parse file ../Libraries/Animated/src/AnimatedImplementation.js Error: parseSource returned falsy
    at parseAPIInferred (/home/ubuntu/react-native/website/server/extractDocs.js:343:13)
```

Reviewed By: sahrens

Differential Revision: D4669961

fbshipit-source-id: 3536c94b8f385f5810c47544c4a72c8c785bf0e5
2017-03-08 04:47:05 -08:00
Eric Vicenti a8474c25fd Fix license headers
Reviewed By: hramos

Differential Revision: D4670890

fbshipit-source-id: e8429aa88a1d4f3cc80034dd087739410c0761f2
2017-03-08 00:52:17 -08:00
Kevin Gozali 1a8d216458 added RCTLog.logToConsole() to force log regardless of debugger connection
Summary: This adds an alternative logging method that can be called from native side. `logIfNoLoggingHook()` will pass the message to console only if there's Chrome debugger attached. This new method sends the message to console regardless to notify the developers better.

Reviewed By: yungsters

Differential Revision: D4669663

fbshipit-source-id: 3940816dadd08d450f066b7223f6d26a38a70921
2017-03-07 19:45:49 -08:00
Spencer Ahrens 5257c35d05 Add new `forkEvent`/`unforkEvent` API
Reviewed By: vjeux

Differential Revision: D4648427

fbshipit-source-id: 9bbbd81f49a9363ac271b3906d73f937f0d1f500
2017-03-06 21:51:40 -08:00
Douglas Lowder b7e9374c64 Move BackAndroid -> BackHandler, add Apple TV support for back nav
Summary:
Enable back navigation on Apple TV (with the remote's menu button) in code making use of BackAndroid.  The module is renamed to BackHandler.  BackAndroid is still exported to ReactNative for now, until external projects switch to using the new name for the module.  The navigation in https://github.com/react-community/react-navigation makes use of this module.

**Test plan**: Manual testing with an example app (https://github.com/dlowder-salesforce/react-nav-example).
Closes https://github.com/facebook/react-native/pull/12571

Differential Revision: D4665152

Pulled By: ericvicenti

fbshipit-source-id: 925400ce216379267e014457be6f5eedbe4453ec
2017-03-06 21:51:40 -08:00
Spencer Ahrens 9325496d46 Simplify scroll interaction stuff
Reviewed By: angelahess

Differential Revision: D4662787

fbshipit-source-id: 6e28f8cacd08601254e70f30ab98ee27bd08cc5a
2017-03-06 21:51:40 -08:00
Spencer Ahrens 28b43aa05c Fix crash with empty section headers
Summary: It's ok for them to be empty, so we should check!

Reviewed By: yungsters

Differential Revision: D4664411

fbshipit-source-id: c66e98458708eee59757fa665b3a05972f1c1b70
2017-03-06 21:31:05 -08:00
Spencer Ahrens 7005f54ab5 Fix unmount crash when using sticky headers
Reviewed By: bvaughn

Differential Revision: D4659436

fbshipit-source-id: c04394681a4f07599f16bae195313e6617419404
2017-03-06 21:16:00 -08:00
Spencer Ahrens 293bb36c0e warn about PureComponent in docs
Reviewed By: hramos

Differential Revision: D4663872

fbshipit-source-id: cb2bd2a2d588a9419da7517304d0612e259151e3
2017-03-06 19:31:08 -08:00
Valentin Shergin 4040e89ac5 `<TextView>.onContentSizeChange` now fires on ANY content changing circumstances
Reviewed By: blairvanderhoof

Differential Revision: D4625916

fbshipit-source-id: 80191a07edaf404a70a7571ada2d849619407bda
2017-03-06 16:35:08 -08:00
Valentin Shergin 4e437c1232 Export Alert's type ButtonsArray for external use
Reviewed By: mmmulani

Differential Revision: D4623764

fbshipit-source-id: 9c4edc98e15603bdae180ec4b6c27b677bba1d53
2017-03-06 12:44:47 -08:00
Jiajie Zhu b87f4abf78 revert D4656347 to fix crashes
Reviewed By: jingc

Differential Revision: D4659669

fbshipit-source-id: 2c95c212a19cc8b67ce4ec62963c8374aecb3ef6
2017-03-06 11:15:45 -08:00
Emily Janzer 5e20b7bcfb Add TabBarIOS.Item on Android
Summary: TabBarIOS has a dummy module on Android, but it doesn't export TabBarIOSItem so if you try to use TabBarIOS.Item you'll get a redbox.

Reviewed By: frantic

Differential Revision: D4653962

fbshipit-source-id: 36ca2527d8eac2d28d35c3ac69ced5bf50b2e682
2017-03-06 10:10:11 -08:00
Vedad Sose f126540519 Fix linking manager library name in documentation
Summary:
I had an issue while using

```#import "RCTLinkingManager.h"```

![image](https://cloud.githubusercontent.com/assets/1089932/22933908/523cf910-f2cd-11e6-9c20-b3c298d5b7cc.png)

But when replaced with

```#import <React/RCTLinkingManager.h>```

the build succeeds.

Looks fine on the website:

![image](https://cloud.githubusercontent.com/assets/1089932/22934563/b1ff337a-f2cf-11e6-9109-b133aef1d69c.png)
Closes https://github.com/facebook/react-native/pull/12383

Differential Revision: D4658153

Pulled By: ericvicenti

fbshipit-source-id: e48368c08cb27bf68ea2f1294129669896350f34
2017-03-06 00:45:25 -08:00
Janic Duplessis 5353d39172 Remove unused native iOS sticky headers implementation
Summary:
Remove the native iOS sticky headers implementation that has been replaced by the js Animated one. Also remove a line in JS that made sure we passed null to native so it did not use the native implementation.

**Test plan**
Made sure there were no more mentions of sticky / header in native ScrollView related code.
Tested that sticky headers still work :o
Closes https://github.com/facebook/react-native/pull/12696

Differential Revision: D4657391

Pulled By: ericvicenti

fbshipit-source-id: 16324a45ca4ce5cd143293c61394a0fa7ad0c4a1
2017-03-05 14:21:40 -08:00
Janic Duplessis c708234f66 Native Animated - Support multiple events attached to the same prop
Summary:
Fixes a bug that happens when trying to use ScrollView with sticky headers and native `Animated.event` with `onScroll`. Made a few changes to the ListViewPaging UIExplorer example to repro https://gist.github.com/janicduplessis/17e2fcd99c6ea49ced2954d881011b09.

What happens is we need to be able to add multiple events to the same prop + viewTag pair. To do that I simple changed the data structure to `Map<prop+viewTag, List<AnimatedEventDriver>>` and try to optimize for the case where there is only one item in the list since it will be the case 99% of the time.

**Test plan**
Tested by reproducing the bug with the above gist and made sure it was fixed after applying this diff.
Closes https://github.com/facebook/react-native/pull/12697

Differential Revision: D4656347

Pulled By: sahrens

fbshipit-source-id: b5c36ba796f478e56028c7a95bc0f86bc54cb2ce
2017-03-05 10:16:57 -08:00
Jeff Morrison 59257d6976 fbobjc
Reviewed By: gabelevi

Differential Revision: D4652687

fbshipit-source-id: 6069c8bc24f0b88da3537ada877cdb7d1d4eccfd
2017-03-04 19:30:34 -08:00
David Adams e3ef69548c VirtualizedList - trigger this.props.onContentSizeChange
Summary:
Have tested this and works fine
```
<SectionList
    onLayout={this.onLayout}
    ref={thisRef => this.listView = thisRef}
    ListFooterComponent={this.renderFooter}
    renderItem={this._renderRow}
    onScroll={this._onScroll}
    onContentSizeChange={this.contentSizeChanged}
    renderSectionHeader={this._renderSectionHeader}
    sections={this.props.data}
/>
Closes https://github.com/facebook/react-native/pull/12708

Differential Revision: D4656338

Pulled By: sahrens

fbshipit-source-id: a2b585aa80247ff0dc2261b740003a6e77cb7a97
2017-03-04 19:15:19 -08:00
Spencer Ahrens 500dd2cff3 Fix bug with sticky headers that listen to onLayout
Summary:
Wrapping them in ScrollViewStickyHeader broken the onLayout and would always give y = 0
because it is now relative to the wrapper.

This uses some not-so-great react magic, but fixes the bugs with no aparent side-effects.

Note we also need to kill the StaticRenderer wrapper that ListView introduces. I think this was
probably a premature optimization anyway since there are usually not many headers and they are
usually pretty cheap to render. If people care, they can use `shouldComponentUpdate` with the
rendered components.

Reviewed By: yungsters

Differential Revision: D4654622

fbshipit-source-id: 1ea557ef64327d1f4df53b22fedd678da1549288
2017-03-03 20:15:38 -08:00
Spencer Ahrens 94a333a2ea Fix crash with js-based sticky headers
Summary:
We're seeing ` inputRange must be monotonically increasing -1,0,0,-33,-32 ` which happens when we
have zero height headers, wherever those come from...maybe rendering null?

The math was also off and didn't handle variable height headers correctly, and it was confusing
because it was `setNextHeaderY` with the header y _minus it's height_, which only works
if the prev height was also the same height.

Reviewed By: furdei

Differential Revision: D4649404

fbshipit-source-id: c2c2d438fa0d0b979c2cbdfa5752eaf86c14768b
2017-03-03 20:01:13 -08:00
Spencer Ahrens f6aad8b995 Default sticky headers enabled on ios only.
Summary:
They aren't normal for android, so don't make that the default.

some more context: https://github.com/facebook/react-native/pull/11315#issuecomment-283816468

Reviewed By: furdei

Differential Revision: D4648714

fbshipit-source-id: 3232a6914e3db82c2b300409663ce63412d892a6
2017-03-03 15:29:48 -08:00
Spencer Ahrens 2022b1eee6 Improve docs
Reviewed By: hramos

Differential Revision: D4649351

fbshipit-source-id: 06cbd735bdb51b6d9d4997a348cbc191193485aa
2017-03-03 13:15:28 -08:00
Spencer Ahrens 32d753164d Fix OSS Website generation
Summary: flow existentials aren't supported yet.

Reviewed By: yungsters

Differential Revision: D4649184

fbshipit-source-id: c1294edd4bf15559d7a277816361af9bcca9ad48
2017-03-03 00:15:04 -08:00
Luke Miles 13b4c2d77b <WebView>: Add propType for injectJavaScript
Summary:
Small fix. Adds a proptype for the injectJavaScript function, added in da9a712a9e.
Closes https://github.com/facebook/react-native/pull/12665

Differential Revision: D4645803

Pulled By: hramos

fbshipit-source-id: 863e5bf82b853914ac08f9f5b2c141d35882afc7
2017-03-02 15:31:19 -08:00
Janic Duplessis 77b8c09727 Implement sticky headers in JS using Native Animated
Summary:
This re-implements sticky headers in JS to make it work on Android.

The only change that was needed was to expose a way to attach a an animated value to an event manually since we can't use the Animated wrapper and `Animated.event` to do it for us because this is implemented directly in the `ScrollView` component. Simply exposed `attachNativeEvent` that takes a ref, event name and event object mapping. This is what is used by `Animated.event`.

TODO:
- Need to check why momentum scrolling isn't triggering scroll events properly on Android.
- Remove native iOS implementation
- cleanup / fix flow

**Test plan**
Test the example list in UIExplorer, test the ListViewPaging example.
Closes https://github.com/facebook/react-native/pull/11315

Differential Revision: D4450278

Pulled By: sahrens

fbshipit-source-id: fec8da2cffce9807d74f8e518ebdefeb6a708667
2017-03-02 15:15:31 -08:00
Eric Vicenti a0f49fcbd5 Add deprecation warning for NavigationExperimental
Summary: Starting in RN 0.43, lets start recommending people to move off of NavExperimental, now that a better navigation option is available, and hybrid options on the horizon.

Reviewed By: hramos

Differential Revision: D4634268

fbshipit-source-id: 2f37cc62f9729ae123d85f609a88f84516a5ae92
2017-03-02 11:00:46 -08:00
Ludo Fardel 0b348095b6 blurRadius for Image
Summary:
This adds blurRadius support for <Image>, similar to iOS.
The heavy-lifting was done by lambdapioneer in the stack of diffs ending with
D3924013, we're just patching this in.
Two notes: we might need to apply two postprocessors going forward, will tackle
that in a separate diff, so we can ship this asap.
However, we need a new version of fresco to be released in order
to ship this.

Reviewed By: lexs

Differential Revision: D3936438

fbshipit-source-id: 353bf1f1120ebd5f4f8266c5a20188b41478a741
2017-03-02 07:47:21 -08:00
Matt Mahoney fea8745845 Add missing Immutable-List parameter
Reviewed By: kassens

Differential Revision: D4636523

fbshipit-source-id: 99bbf32005073ef534c8b7d42109d9a1a1c2f945
2017-03-01 23:01:01 -08:00
alejandro garcia dc334b0e55 Improved flow on Picker.Item
Summary:
Flow improvement: Added ColorPropType on color property on Picker component
Closes https://github.com/facebook/react-native/pull/12528

Differential Revision: D4619897

Pulled By: ericvicenti

fbshipit-source-id: 6356d6f4ae6d2db3d93a56882ec51d140f9ac2ab
2017-03-01 22:19:30 -08:00
mlanter f66fba83cf Set initial opacity based on style
Summary:
Set the initial opacity based on the style opacity instead of defaulting to 1.  Without this change, if the opacity on the view is set to 0.5 (for example), the component will render with 1 opacity and then after a press and release it will set to 0.5.  This fixes it to set to the correct value on mount.

**Test plan (required)**
Example code:
```
      <TouchableOpacity
        activeOpacity={1}
        style={STYLES.Button}>
        {...}
      </TouchableOpacity>
```
```
const STYLES = StyleSheet.create({
  Button: {
    opacity: 0.5,
  },
});
```

Before (notice starts out dark and then after click and release becomes light):
![before](https://cloud.githubusercontent.com/assets/19673711/23444255/c120cbb0-fde8-11e6-8c03-ef4f0f25736b.gif)

After (starts out light and is the same light color after a click and release):
![after](https://cloud.githubusercontent.com/assets/19673711/23444254/c106a6e0-fde8-11e6-8181-def45b7bb84f.gif)
Closes https://github.com/facebook/react-native/pull/12628

Differential Revision: D4641509

fbshipit-source-id: 3b6cf653fe837df704007f585c655d4450d14497
2017-03-01 21:46:40 -08:00
Spencer Ahrens d2ed064519 Add to docs
Reviewed By: hramos

Differential Revision: D4638645

fbshipit-source-id: 6a37a5fd4e0d8c7769f6c241142b949dba665c34
2017-03-01 21:15:03 -08:00
Spencer Ahrens e70cdf0cc1 add to RN OSS package.
Summary: Also fix some bugs with fbjs requires.

Reviewed By: mkonicek

Differential Revision: D4635805

fbshipit-source-id: b0663b727632fe5784f1caa1ff20b160a82a3931
2017-03-01 17:55:30 -08:00
sunnylqm 48a84dffd5 android now supports barStyle
Summary: Closes https://github.com/facebook/react-native/pull/12488

Differential Revision: D4590699

fbshipit-source-id: 003da4b622e8732ab66c6f2c931670a2eae47eae
2017-03-01 13:32:16 -08:00
Emil Sjolander 4d69f4b2d1 Add display:none support to react native
Summary:
This diff adds display:none support to React Native. This enables hiding components which still calling their render method and keeping them within the state of your application. This enables preserving state in a component even though the component is not visible. Previously this was often implemented by rendering a component off screen as a work around. See below playground for usage.

```
class Playground extends React.Component {
  render() {
    return (
      <View style={{width: '100%', height: '100%', flexDirection: 'row', backgroundColor: 'white'}}>
        <View style={{width: 100, height: 100, display: 'none', backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, backgroundColor: 'blue'}}/>
      </View>
    );
  }
}
```

Reviewed By: astreet

Differential Revision: D4611771

fbshipit-source-id: 0dbe0494d989df42994ab9ad5125d47f3233cc5a
2017-03-01 09:16:05 -08:00
Emil Sjolander 31f848a5fa Expose alignContent to react native
Summary:
This diff adds alignContent (https://developer.mozilla.org/en-US/docs/Web/CSS/align-content) support to React Native. This enables aligning the lines of multi-line content. See below playground for example usage.

```
class Playground extends React.Component {
  render() {
    return (
      <View style={{width: '100%', height: '100%', flexDirection: 'row', backgroundColor: 'white', flexWrap: 'wrap', alignContent: 'space-between'}}>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
      </View>
    );
  }
}
```

Reviewed By: astreet

Differential Revision: D4611803

fbshipit-source-id: ae7f6b4b7e9f4bc78d2502da948214294aad4dd2
2017-03-01 09:16:05 -08:00
Spencer Ahrens 7b35eb3fdb Move new components out of `Experimental` directory
Summary: I think these are sufficiently baked. Also beef up comments.

Reviewed By: yungsters

Differential Revision: D4632604

fbshipit-source-id: 64ae6b240a05d62e418099f7403e1781f9b4717c
2017-03-01 09:16:05 -08:00
Sebastian Markbage 5eb3ab3522 Switch componentWillMount / componentWillUnmount order
Summary:
This switches our React feature flag so that componentWillMount happens before
componentWillUnmount when a child switches. It used to be inconsistent and this
makes it consistent and inline with what React Fiber does.

Breaking change. May cause issues.

Reviewed By: spicyj, bvaughn

Differential Revision: D4626543

fbshipit-source-id: f7eaf1ebd479ca9fada012f903a2f972a7901b40
2017-02-28 12:22:07 -08:00
Spencer Ahrens 2a1ab36257 Breaking API change - abandon `ItemComponent` in favor of `renderItem`
Summary:
After a fair bit of use, we have concluded that the `ItemComponent` mechanism is not worth the
hassle. Flow has trouble type checking it thoroughly, requiring an 'item' prop is annoying, and it
is very common to need to capture `this` anyway, e.g. for an `onPress` handler. A common pattern was
something like:

  _renderItem = ({item}) => <MyItem foo={item.foo} onPress={() => this._onPress(item)} />};
  ...
  ItemComponent={this._renderItem}

which wouldn't flow check the props and doesn't benefit from reusing components.

If we find some specific patterns that would benefit from the `ItemComponent` pattern, we can create
a new component that provides that API and wraps `FlatList` under the hood.

I'm going to do `SectionList` in a stacked diff.

Reviewed By: bvaughn

Differential Revision: D4625338

fbshipit-source-id: a4901f1c9d77e0115b0b8032b8c210f624e97ea3
2017-02-28 02:17:23 -08:00
Spencer Ahrens f7d1060418 Missed some viewablePercentThreshold references
Reviewed By: yungsters

Differential Revision: D4603767

fbshipit-source-id: b7674324e961ae43ca1ee74c309f4d98d954fbbc
2017-02-28 02:17:23 -08:00
Spencer Ahrens a10dbdaaf6 Rename flow type Viewable -> ViewToken
Summary: `Viewable` is a weird name - I think `ViewToken` is more clear? Also easier to grep for.

Reviewed By: yungsters, bvaughn

Differential Revision: D4600762

fbshipit-source-id: dbfa5eec1b91166c4889dcb6b87d7832090be9e9
2017-02-28 02:17:23 -08:00
Spencer Ahrens dc30203734 minViewTime and waitForScroll viewability config support
Summary:
It's pretty common to want to wait until the user scrolls a view to consider any items
viewable, so `waitForScroll` enables that behavior.

It's also pretty common to want to ignore items that are quickly scrolled out of view, so we add
`minViewTime` to handle that case.

Reviewed By: bvaughn

Differential Revision: D4595659

fbshipit-source-id: 07bc8e89db63cb68d75bdd9bedde3183c38a3034
2017-02-28 02:17:23 -08:00
Valentin Shergin b00c1fa3b6 `accessibilityViewIsModal` property was exposed for any view (iOS only)
Reviewed By: mmmulani

Differential Revision: D4582786

fbshipit-source-id: 0902b8cc762042e772798ea7eaa350bc9d737cfb
2017-02-27 23:46:14 -08:00
Héctor Ramos 643925b41d Fix formatting in DatePickerAndroid.open docs
Summary:
Lists need to be separated by a blank line from the preceding paragraph in order to render properly.
Closes https://github.com/facebook/react-native/pull/12521

Differential Revision: D4619863

Pulled By: ericvicenti

fbshipit-source-id: 4d5019af5ad66d8f4360339f007cf7f39427a945
2017-02-27 18:34:19 -08:00
Adam Comella 04790f1a78 Finish AccessibilityInfo implementation
Summary:
This PR is based on files ericvicenti gave me. Specifically, he gave me:
  - AccessibilityInfo.android.js
  - AccessibilityInfo.ios.js
  - AccessibilityInfoModule.java

Before this change, only a native iOS implementation of AccessibilityInfo existed. This change includes:
  - A native Android implementation of AccessibilityInfo.
  - JavaScript wrappers for the AccessibilityInfo module for both iOS and Android.
  - UIExplorer changes to illustrate how to use AccessibilityInfo on iOS and Android.
  - Documentation for the AccessibilityInfo APIs.

**Test plan (required)**

Tested the UIExplorer AccessibilityInfo example on iOS and Android with the screen reader both enabled and disabled.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/12273

Reviewed By: mkonicek

Differential Revision: D4527224

Pulled By: ericvicenti

fbshipit-source-id: d04638465ccbdbb35ecfc9504daaeb8e33aab57a
2017-02-27 18:34:19 -08:00
Andrew Clark 41f1bcc5ac Sync React Native with React 16.0.0-alpha.3 (take 2)
Reviewed By: spicyj

Differential Revision: D4623242

fbshipit-source-id: 7ddb057cb47e005dda73070f45d108af40d93c8f
2017-02-27 17:30:30 -08:00
Andrew Clark 0a712f5335 Revert D4615201: Sync React Native with React 16.0.0-alpha.3
Differential Revision: D4615201

fbshipit-source-id: e86961f37209c73838b5a4a564bc81eb48a911c2
2017-02-27 14:04:58 -08:00
Andrew Clark 24a7665df5 Sync React Native with React 16.0.0-alpha.3
Reviewed By: sebmarkbage

Differential Revision: D4615201

fbshipit-source-id: fc62b44aa866e096faa1cb048db361bb8c6ab11f
2017-02-27 14:04:58 -08:00
Wietse Venema 800dc77172 Fixes type definition of StackFrame
Summary:
**Motivation**
This PR fixes the flow type definition of StackFrame in parseErrorStack.js. The methodName was missing and the column could be `null`. We integrate with it in our codebase and we wanted to use `methodName`, but flow complained.

Refer to this file for possible values: [github.com/errwischt/stacktrace-parser/blob/master/lib/stacktrace-parser.js](https://github.com/errwischt/stacktrace-parser/blob/master/lib/stacktrace-parser.js)

This also allowed me to remove a flow error suppression.

**Test plan (required)**
I ran flow on the project, no errors
Closes https://github.com/facebook/react-native/pull/12499

Differential Revision: D4619885

Pulled By: ericvicenti

fbshipit-source-id: 0bf5a2304cb0dc9f2c6df026a5cee71c8a419c01
2017-02-27 14:04:57 -08:00
Benjamin Dobell 27928f3993 Optional Alert onDismiss callback to support Android default behavior
Summary:
On Android it's generally expected that alerts are dismissible by tapping outside the alert box. This is the default behavior for React Native, but until now there has been no means to listen for the dismiss event.

`Alert.alert` already takes an `options` object, so this pull request simply adds an additional option `onDismiss`, a callback function that will be called when an Alert is dismissed (rather than being closed as a result of a button press).

**Test plan**

Simply pass an `options` object to `Alert.alert` with the `onDismiss` property set to a function.

e.g. Run the following on Android, dismiss the alert by tapping outside the alert view, and monitor console output.

```
Alert.alert(
  'Alert Title',
  'My Alert Msg',
  [
    {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
    {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
    {text: 'OK', onPress: () => console.log('OK Pressed')},
  ],
  { onDismiss: () => console.
Closes https://github.com/facebook/react-native/pull/12594

Differential Revision: D4619862

Pulled By: ericvicenti

fbshipit-source-id: fdd351a7b8e673dab331f0e22dc5ea2e84f24375
2017-02-27 14:04:57 -08:00
James Isaac 64c8f22343 Correct/consistent docs for Touchable components
Summary:
I ran into confusion (#12581) because the docs for TouchableOpacity stated that it doesn't change the view hierarchy, but in fact it does, and the docs are just out of date.

- [20 Feb 2015](efae175a8e/Libraries/Components/Touchable/TouchableOpacity.js (L21)) Docs correctly reflected that the component was cloned so didn't affect hierarchy
- [25 Jul 2015](725053acfe) Component was changed to being wrapped but docs weren't updated.

Went to correct this in the docs and noticed they were a bit inconsistent with each other, so have made them more unified.  Each one now clearly warns about:

- If it adds a view to the hierarchy, which will affect layout.
- If it can only accept a single child.
Closes https://github.com/facebook/react-native/pull/12583

Differential Revision: D4619837

Pulled By: ericvicenti

fbshipit-source-id: 4d1becd9f290cefcb4548a5ea2878be2d2c315fa
2017-02-27 14:04:57 -08:00
Espen Hovlandsdal 9217ff3203 Fix typo in ViewabilityHelper (`itemVisiblePercentThreshold` mistyped)
Summary:
The new `ViewabilityConfig` API has a typo:
`itemVisiblePercentThreashold` should be `itemVisiblePercentThreshold`.

Thought it would be good to fix this before people start depending on a property containing a typo :-)

Updated tests to match.
Closes https://github.com/facebook/react-native/pull/12593

Differential Revision: D4619798

Pulled By: ericvicenti

fbshipit-source-id: 0aa8b6cf9ae7e5638607195759e4bd51140667fe
2017-02-27 14:04:57 -08:00
Bhuwan Khattar cf1bc8d644 s/react-native.js/react-native-implementation.js/
Summary: Renaming since a file with the same name as a package confuses packager

Reviewed By: cpojer

Differential Revision: D4613215

fbshipit-source-id: 5cfae71d0bb1eef2675689b37a9b42596d25678d
2017-02-27 14:04:57 -08:00
Bhuwan Khattar a23a3c319c Add @providesModule annotations
Summary: Adding providesModule annotations to files that don't have a `providesModule` annotation but are in directories that packager crawls.

Reviewed By: cpojer

Differential Revision: D4612455

fbshipit-source-id: b23f0d6bbe2d26f480e93b56b67c6c8b1075e9f7
2017-02-27 14:04:56 -08:00
Bhuwan Khattar 84a681cea9 Ignore mocks in packager
Reviewed By: cpojer

Differential Revision: D4611759

fbshipit-source-id: 49cf3dbf4a068585b1bb6bca84268bc2631d037f
2017-02-24 13:01:34 -08:00
Ryan Florence 843ad50296 remove peculiar web language
Summary:
Nothing about the web prevents people from providing good visual feedback on touch events. I'm not trying to be a punk, just coming across this language (several times now) gives me weird feelings since I come from "the web".
Closes https://github.com/facebook/react-native/pull/12484

Differential Revision: D4608430

Pulled By: hramos

fbshipit-source-id: 9ab72bffb300aa7bd76b6e07470dfe9763e50556
2017-02-24 11:17:48 -08:00
Cristian Carlesso 570c564e77 Update Jest to 19.0.2
Reviewed By: cpojer

Differential Revision: D4608167

fbshipit-source-id: c30febe287b4a7ad0237039cfdd5b6bd6fb66d1d
2017-02-24 08:30:50 -08:00
Ben Roth 6a14f0b449 Add RCTDevSettings module
Summary:
This decouples non-UI logic from RCTDevMenu into a new module RCTDevSettings.

**Motivation**: This allows developers to change dev settings without depending on the built-in dev menu, e.g. if they want to introduce their own UI, or have other devtools logic that doesn't depend on an action sheet.

It also introduces the RCTDevSettingsDataSource protocol for storing dev tools preferences. This could allow a developer to implement alternative behaviors, e.g. loading the settings from some other config, changing settings based on the user, deciding not to persist some settings, or something else.

The included data source implementation, RCTDevSettingsUserDefaultsDataSource, uses NSUserDefaults and is backwards compatible with the older implementation, so **no workflows or dependent code will break, and old saved settings will persist.**

The RCTDevMenu interface has not changed and is therefore also backwards-compatible, though
some methods are now deprecated.

In order to ensure that RCTDevSettings
Closes https://github.com/facebook/react-native/pull/11613

Reviewed By: mmmulani

Differential Revision: D4571773

Pulled By: javache

fbshipit-source-id: 25555d0a6eaa81f694343e079ed02439e5845fbc
2017-02-24 07:00:16 -08:00
Henrik Raitasola bb1f85183b Add TextInput's prop caretHidden implementation for Android and add the prop to docs
Summary:
This PR will:
- add missing documentation for `caretHidden` prop to the docs
- add `caretHidden` prop implementation for Android

I noticed this by accident when looking at `RCTTextFieldManager.m` and there is `RCT_EXPORT_VIEW_PROPERTY(caretHidden, BOOL)` which hides caret on iOS. Then I realised that the docs were missing for this prop and implementation on Android side :)

Render `TextInput` with prop `caretHidden`. After this caret is not visible anymore.
`<TextInput style={styles.input} caretHidden />`

If you omit the prop then caret is visible again
`<TextInput style={styles.input} />`
Closes https://github.com/facebook/react-native/pull/11863

Differential Revision: D4448402

fbshipit-source-id: 456e1df3e2cbb8af32540d2c7a8f4e7da219f5c3
2017-02-23 17:17:39 -08:00
Victor Choueiri 4b26ebd063 Documented CameraRoll.getPhotos() param and return values
Summary:
**Motivation**:

The `CameraRoll.getPhotos()` documentation is lacking, I've simply exposed the shapes of the params object and returned object, as defined and documented in `getPhotosParamChecker` and `getPhotosReturnChecker`.

**Test plan**:

Built the website and checked the documentation.
Closes https://github.com/facebook/react-native/pull/12524

Differential Revision: D4608419

Pulled By: hramos

fbshipit-source-id: 887d32b32312a492e57bf65fca503891de0bd661
2017-02-23 16:45:39 -08:00
Fred Liu 395122354f Update SwipeableListView props and more
Summary: Update the props to allow not passing in an onScroll callback

Reviewed By: zjj010104

Differential Revision: D4604474

fbshipit-source-id: 9371776d1451f7bd0247fbafaf4bf7198291d1b1
2017-02-23 15:17:02 -08:00
desmondyao bac24dde16 Fix comments about Yoga in LayoutPropType.
Summary:
Just a small fix: change css-layout in LayoutPropTypes to Yoga.
Closes https://github.com/facebook/react-native/pull/12509

Differential Revision: D4606716

fbshipit-source-id: c4f6c05c50d241c988604137fd12086d8a1ffb94
2017-02-23 13:01:04 -08:00
Lukas Piatkowski ccc525c5ca Refactor iOS packager webSocket handling to resemble Android's packagerconnection
Reviewed By: javache

Differential Revision: D4572607

fbshipit-source-id: b588d6216f7b84aef5a63454d2d8978783412c7b
2017-02-23 10:03:54 -08:00
Pieter De Baets dba133a291 Merge AndroidConstants and IOSConstants into PlatformConstants
Reviewed By: AaaChiuuu

Differential Revision: D4597790

fbshipit-source-id: 0a54598d6e9cadb75efff4ac17c13899d6785f9b
2017-02-22 15:01:11 -08:00
Pieter De Baets 68135d90a4 Move BatchedBridge module configuration to InitializeCore
Reviewed By: davidaurelio

Differential Revision: D4599060

fbshipit-source-id: bd0f1f6910f4fd9b68d6a9678fd5e97cdf6be553
2017-02-22 15:01:11 -08:00
Martin Konicek a6adc501e8 Add a hint to a very common AppRegistry error
Summary:
**Motivation (why should we merge this?)**

I see the following error very often when working on multiple apps and switching between them. In fact, switching between apps is the only reason why I ever saw the error. However, the error message is very unhelpful:

![screenshot 2017-02-22 16 15 29](https://cloud.githubusercontent.com/assets/346214/23221214/5f6bc7ba-f91c-11e6-9482-9183c27c5e9d.png)

**Test plan (required)**

![screenshot 2017-02-22 19 44 54](https://cloud.githubusercontent.com/assets/346214/23229247/830f7142-f937-11e6-9657-bad83563f3b0.png)
Closes https://github.com/facebook/react-native/pull/12517

Differential Revision: D4600082

Pulled By: mkonicek

fbshipit-source-id: 011c71dbac9e294348fd06c8e6d651228fac3288
2017-02-22 14:16:06 -08:00
Archit Pal Singh Sachdeva 813f873320 Add disabled to accessibilityTraits in case button is disabled
Reviewed By: javache

Differential Revision: D4593622

fbshipit-source-id: 211f90f6af531a577af4e5487b43a3870f725bff
2017-02-22 13:16:02 -08:00
Sebastian Markbage fd4ad6ca82 Ignore event listeners on unmounted components
Summary:
When a touch responder gets unmounted, it can still get events dispatched to it.

We used to ignore those errors but in the new model we read the props instead of the event listener bank. The props still exist after unmount.

Instead, I check that the rootNodeID is still set since this gets reset during unmount.

Reviewed By: spicyj, bvaughn

Differential Revision: D4597127

fbshipit-source-id: b405e4ef1bcb14970be76d9ab7203cebf1f4d6c9
2017-02-22 12:30:09 -08:00
Aaron Chiu 02daffbe9d print out Performance markers to console
Differential Revision: D4585709

fbshipit-source-id: fe1f1f6b146854aa426e6186baf73ac2cf1784c8
2017-02-21 22:15:42 -08:00
Yi Sun a0da13322b Revert D4592611: [rc|onliner] null gating for component tree states
Differential Revision: D4592611

fbshipit-source-id: 5f3836e9a3631d211c3c6ff1b036e59197418eb8
2017-02-21 17:30:11 -08:00
Spencer Ahrens f2687bf4b6 configurable Viewability
Reviewed By: yungsters

Differential Revision: D4577395

fbshipit-source-id: 9b9099f5bd5f8fe20b5c24eab7e43f298ba665d9
2017-02-21 17:14:59 -08:00
Kevin Gozali fa34035def work around inspector redbox due to Fiber
Summary: This temporarily fixes redbox when using Inspector before Fiber is fully ready.

Reviewed By: sebmarkbage

Differential Revision: D4593324

fbshipit-source-id: 287df97f5ecf30c15890f7f7bca4646421bb41c8
2017-02-21 15:45:45 -08:00
Yi Sun 724d89d7eb null gating for component tree states
Reviewed By: sebmarkbage

Differential Revision: D4592611

fbshipit-source-id: ab1995e60d411c57fc59978d6d6392031334079e
2017-02-21 15:30:23 -08:00
Aaron Chiu f6bd8a38ec correctly order ASyncStorage
Reviewed By: sahrens

Differential Revision: D4585569

fbshipit-source-id: e0bebddea8a5810386e193eb6435f24ba3a5cbb0
2017-02-21 15:18:40 -08:00
Guy Rosenmann 72ddfb014a fix inline NativeModule typo
Reviewed By: javache

Differential Revision: D4590904

fbshipit-source-id: 110f8d4d3efa72ba26b80277c321cb1d7a40540c
2017-02-21 10:04:42 -08:00
Dan Abramov a5ea974948 Fix the website build
Summary:
118e88393e broke autodoc generation because autodoc isn't smart enough to understand some patterns.

I'm working around it by using the same trick as this file was using previously: reassigning the class variable.

Similarly, using a property initializer produces bad output so I had to remove it:

<img width="146" alt="screen shot 2017-02-20 at 19 00 36" src="https://cloud.githubusercontent.com/assets/810438/23138561/09ebb476-f7a0-11e6-8fad-92c5a01503c3.png">

cc ericnakagawa mkonicek for review
Closes https://github.com/facebook/react-native/pull/12479

Differential Revision: D4591285

Pulled By: gaearon

fbshipit-source-id: 5884620a08874298b1b2c810e8fb769eba4e1199
2017-02-21 09:11:01 -08:00
Valentin Shergin e361ce8673 `RCTShadowViews`'s `cssNode` property was renamed to `yogaNode`
Reviewed By: javache

Differential Revision: D4590104

fbshipit-source-id: 7767aaa62bcbdce2746c3a26543052dd46be63e0
2017-02-21 08:45:05 -08:00
Mathieu Baudet 4a893ee071 remove unused includes in fbobjc/Libraries
Reviewed By: swolchok

Differential Revision: D4507573

fbshipit-source-id: 7fc6df52bc37c39698c7897be567758469417218
2017-02-19 18:33:49 -08:00
Martin Konicek 8c0e6ecfc0 Android: Support HTTP headers for source prop on <Image> components
Summary:
A copy of https://github.com/facebook/react-native/pull/7791 because of our very imperfect tools that mirror the changes from pull requests in the fb monorepo. The internal Phabricator revision for #7791 is in an 'abandoned' state (by foghina probably because of changing teams) and Phabricator doesn't allow me to claim that revision and merge it. Therefore I'm creating a new one.

(It's not foghina's fault, no one probably knew about this "abandoned Phabricator revision" edge case, don't remember we hit it before.)

Will try to keep attribution (git blame) to rigdern when merging.
Closes https://github.com/facebook/react-native/pull/12448

Differential Revision: D4584743

Pulled By: mkonicek

fbshipit-source-id: 66e5b88134fca1980adc4cd8a2ff17c42e10022c
2017-02-18 04:45:11 -08:00
Aaron Chiu 1fa95ed390 inline a bunch of NativeModule requires
Reviewed By: shergin

Differential Revision: D4578180

fbshipit-source-id: 3764ffd32eb7e4698e928740bc72bbad02876894
2017-02-17 16:49:38 -08:00
Hector Ramos 6ad41a81bc Clean up Animated docs
Summary:
After taking a look at the existing animation docs, I found that most of the documentation on using `Animated` was spread out throughout the Animations guide and the `Animated` API reference, without any particular structure in place.

This PR aims to clean up the API reference, focusing on documenting all the provided methods exhaustively, and deferring to the Animations guide for long form examples and supporting content.

The `Easing` module is referred to at various points in the API reference, so I decided to clean up this doc as well. easings.net provides some handy visualizations that should make it easier for the reader to understand what sort of easing curve each method provides.

The site was built locally, and I verified all three documents render correctly.

![screencapture-localhost-8079-react-native-docs-animations-html-1487212173651](https://cloud.githubusercontent.com/assets/165856/23004694/d3db1670-f3ac-11e6-9d4e-0dd6079b7c5c.png)

Closes https://github.com/facebook/react-native/pull/12410

Differential Revision: D4581314

Pulled By: hramos

fbshipit-source-id: 27c0bce2afac8f084311b9d6113a2641133b42e5
2017-02-17 14:48:17 -08:00
Aaron Chiu e81258a15b add Systrace to all PerformanceLogger.js markers
Reviewed By: alexeylang

Differential Revision: D4567843

fbshipit-source-id: 00cac36d2b73f827723546a04edd6b89267c26bb
2017-02-17 12:01:06 -08:00
Dan Abramov 118e88393e Guard against missing native module
Reviewed By: martinbigio

Differential Revision: D4579114

fbshipit-source-id: a2e9f634748e1c56eb9867bfb9e3e66e9cdc5e93
2017-02-17 10:07:01 -08:00
Spencer Ahrens 6283878e17 API update and bug fixes
Reviewed By: bvaughn, yungsters

Differential Revision: D4563798

fbshipit-source-id: 0591cef7c854b525d77e526af783284d9696cb48
2017-02-16 19:04:04 -08:00
Spencer Ahrens 5042bae259 Clean up separator stuff
Reviewed By: bvaughn

Differential Revision: D4561262

fbshipit-source-id: 990f338c197851252bea4902fa86249d6e1c975b
2017-02-16 19:04:04 -08:00
Spencer Ahrens 63d3ea17a7 Improve flow typing
Summary:
- Properly inherit flow types from base components, including `defaultProps`
- template-ify the `Item` type as it flows from the `data` prop into `ItemComponent`

Note that for `SectionList` is is harder to do the `Item` typing because each section in the
`sections` array can have a different `Item` type, plus all the optional overrides...not sure how to
tackle that.

Reviewed By: yungsters

Differential Revision: D4557523

fbshipit-source-id: a0c5279fcdaabe6aab5fe11743a99c3715a44032
2017-02-16 19:04:04 -08:00
Charles Chen 274e7ba592 Make flow types update to date with proptypes with ImageSource
Summary:
As the task covered, we would like to update the ImageSource flow type.

Edit the flow types for ImageSource to map to the propTypes ImageSourcePropType.js

Reviewed By: mmmulani

Differential Revision: D4573836

fbshipit-source-id: ef3f5365e00b4926c75188f345811f5cfa4bfd3c
2017-02-16 15:18:43 -08:00
Alexey Lang 7c97008fa8 Support QuickPerformanceLogger.js in the old bridge
Reviewed By: javache

Differential Revision: D4566647

fbshipit-source-id: 1a6448b89b14f4ce9f2192e9f7b4e28b8dcb52b7
2017-02-16 11:33:48 -08:00
Janic Duplessis ae57b25134 Change cursor color when using selectionColor on Android
Summary:
This matches the behavior on iOS, there was no way before to change the cursor color per input, it was only possible to change it globally via the theme. Ideally cursor color and selection color would be 2 different props but I think this is better than what we have (and matches iOS).

Sadly there is no api to change it pragmatically (only possible via xml) so this uses reflection and can easily break so it is wrapped in a try catch to avoid crashes. I think it is better to just silently fail in this case. Definetly not super happy about the solution but I think it's worth adding since it is possible to do it natively using xml so it would suck not to be able to do it in RN.

**Test plan**
Tested that the cursor has the same color as before the change when not setting the prop and that it gets the selectionColor color when set.
Closes https://github.com/facebook/react-native/pull/12280

Differential Revision: D4571858

Pulled By: astreet

fbshipit-source-id: 7dca2db33a0a4eecb6115b45155549b1265ffbed
2017-02-16 04:45:35 -08:00
Janic Duplessis 33817b83d6 Allow listener for native Animated.event
Summary:
We used to not send events to JS when there was a native Animated.event but we do now so we can easily enable the listener property.

**Test plan**
Tested that the listener gets called when using native Animated.event.
Closes https://github.com/facebook/react-native/pull/12323

Differential Revision: D4556407

fbshipit-source-id: 0b17f331a352d03a47f1611c667433fd5a58696c
2017-02-16 00:32:43 -08:00
Kevin Gozali 222856ea3a expose types off AppRegistry and do custom handling
Reviewed By: shergin

Differential Revision: D4557948

fbshipit-source-id: 439e486d1ef9e29c81cabf608943f7c62098a14b
2017-02-15 02:17:17 -08:00
Sebastian Markbage b1da7a5f5d Sync React
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
2017-02-14 20:00:34 -08:00
Naman Goel 908ec178fc Don't allow 0 in the Bid Optimization Amount
Reviewed By: zjj010104

Differential Revision: D4540231

fbshipit-source-id: 87347ec95483e4414da0ac58399aa343d342e7d5
2017-02-14 18:30:02 -08:00
Spencer Ahrens 7cfbb79617 Propagate onScroll
Reviewed By: yungsters

Differential Revision: D4557672

fbshipit-source-id: a265231dbc992a84449e5ae051530f63f7b8efd4
2017-02-14 18:30:02 -08:00
Kevin Gozali a86559ffb5 expose AppRegistry.getRegistry() for app specific handling
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
2017-02-14 15:33:15 -08:00
Dan Abramov 934cd82941 Move DevTools integration into its own repo
Summary:
The way React DevTools integration was set up in RN was not entirely supported by the React team, and we had to disable it in c3b25c9059 so that we can move forward with enabling Fiber support in React Native.

Here, I am moving the DevTools client setup from RN repo to [React DevTools repo](https://github.com/facebook/react-devtools/blob/master/packages/react-devtools-core/README.md#requirereact-devtools-coreconnecttodevtoolsoptions) so that we can keep it in sync with the rest of React DevTools. This is also a part of a larger effort to consolidate DevTools code (https://github.com/facebook/react-devtools/issues/489). It allows us to remove the double injection of the hook, an lets us replace the `eval` hack with a regular dependency. The implementation [lives here now](https://github.com/facebook/react-devtools/blob/master/packages/react-devtools-core/src/backend.js).

This change re-enables Nuclide Inspector with React Native Stack reconciler and prepares it for compatibi
Closes https://github.com/facebook/react-native/pull/12316

Reviewed By: zertosh

Differential Revision: D4545322

Pulled By: gaearon

fbshipit-source-id: ab949916c1a92c6b41cd41e7e1edf9697a71de2e
2017-02-14 14:03:46 -08:00
Spencer Ahrens a141e63ee4 Add SectionSeparatorComponent support
Summary: Makes it easy to render separators between sections, as opposed to between items.

Reviewed By: yungsters

Differential Revision: D4555707

fbshipit-source-id: 34572ab4b2c5b47db640543149fe2551c34ccf7b
2017-02-14 11:47:50 -08:00
Adam Comella 186f308aec BREAKING: Android: Correct value of Dimensions.get('screen').fontScale
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
2017-02-14 08:45:38 -08:00
Spencer Ahrens 91bda43e56 Fix `getItemLayout` flow type to include `index`
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
2017-02-13 18:15:43 -08:00
Spencer Ahrens 73e0b01b06 SectionList
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
2017-02-13 16:32:17 -08:00
Valentin Shergin c928f1127f Revert D4538026: Stop allocating an RCTView for everying RCTRawText
Differential Revision: D4538026

fbshipit-source-id: 8728e674cf120a46706e1d05c968439d0e825d46
2017-02-13 15:00:18 -08:00
Andrew Monshizadeh 8b63fd7bb2 Formatting fixes
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
2017-02-13 13:32:22 -08:00
Spencer Ahrens 0a86c1cb15 debug overlay
Reviewed By: yungsters

Differential Revision: D4534822

fbshipit-source-id: ceef5bc5c0dc8cdc0d3927e198273b4411045bde
2017-02-13 13:03:30 -08:00
Spencer Ahrens 12b228c5d9 Improve scroll to top performance
Reviewed By: yungsters, bvaughn

Differential Revision: D4533070

fbshipit-source-id: 9458801aa679b830642f43be93f43bc08ef841cd
2017-02-13 13:03:30 -08:00
Pieter De Baets 7d51580479 Use weakSelf in RCTNetworking callbacks
Reviewed By: shergin

Differential Revision: D4551000

fbshipit-source-id: fcfce41adb8fd76343b973339ffe1cac0bf8a756
2017-02-13 12:29:58 -08:00
Valentin Shergin 7686274e13 Removed RTL workaround in RCTShadowText
Reviewed By: fkgozali

Differential Revision: D4511274

fbshipit-source-id: f658afb4e1c943cc9ecab2dd2a91f251edd3fa36
2017-02-13 12:00:57 -08:00
Sokovikov 24d34fe203 Fix inspector crash
Summary:
**Motivation**

Use inspector

**Test plan (required)**

UIExplorer

<img width="305" src="https://cloud.githubusercontent.com/assets/1488195/22839533/46be7cd6-efe3-11e6-9fdc-4f483b471388.gif" />
Closes https://github.com/facebook/react-native/pull/12335

Differential Revision: D4545191

fbshipit-source-id: 27ad519032c6c48199875a62d8e768af5336ce23
2017-02-13 01:30:32 -08:00
Angela Hess 9e2d3c5d0d Add row style for multi-column lists
Reviewed By: sahrens

Differential Revision: D4545238

fbshipit-source-id: e85cd598b6776e104bdcaf1e74dd46218785f536
2017-02-11 14:22:29 -08:00
Spencer Ahrens 906e579dd7 numColumns default
Reviewed By: blairvanderhoof

Differential Revision: D4545192

fbshipit-source-id: 75a1e9eb27f0d3cab0c78b44d842847b64849dba
2017-02-10 18:15:23 -08:00
Matthew Oaxaca 34edf92cbf Network/FormData typeof object allowing null
Summary:
Submitting PR in response to https://github.com/facebook/react-native/issues/12251

**Test plan (required)**

$formData = new FormData()
$formData.append('value', null)

Included Unit Tests
Closes https://github.com/facebook/react-native/pull/12253

Differential Revision: D4545291

Pulled By: lacker

fbshipit-source-id: 2780f24e1fe1e0d5be3bb12b64aa6cd9a20554bf
2017-02-10 13:30:48 -08:00
Kevin Gozali c7c3e4c5d8 modernize AppRegistry.js and introduce app-specific 'sections'
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
2017-02-10 12:56:08 -08:00
Spencer Ahrens 4388783a21 Add multi column support
Reviewed By: angelahess

Differential Revision: D4540706

fbshipit-source-id: d8f84d13484d50692405c4a461c8d6c0e49f2cc9
2017-02-10 10:06:31 -08:00
Pieter De Baets 49ef06f9bd Stop allocating an RCTView for everying RCTRawText
Reviewed By: shergin

Differential Revision: D4538026

fbshipit-source-id: 17278d60b99632bfb19c4a20979860716be45d2b
2017-02-10 09:03:16 -08:00
Libin Lu 6a5225fb22 return if UIManager failed to measure node
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
2017-02-09 21:00:17 -08:00
Connor McEwen 5a0012efd3 Export Animated.Interpolation
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
2017-02-09 14:46:11 -08:00