Commit Graph

3234 Commits

Author SHA1 Message Date
Valentin Shergin 2e66ac8999 <ImageBackground> got `imageRef` and `imageStyle` props
Summary: It can be useful when you want to setup `tintColor` for the image or get a reference to call `setNativeProps` then.

Reviewed By: ericvicenti

Differential Revision: D5158908

fbshipit-source-id: 873c1cae9bd0af711a42016dcc548231e3cf89e7
2017-06-01 14:16:14 -07:00
Dan Abramov 86fad4b2f3 Remove dependency on internal data structure
Summary:
See context for this change in https://github.com/facebook/react-devtools/pull/770.
We'll later stop exposing `instance` (because it is a Fiber and is private to React).
Closes https://github.com/facebook/react-native/pull/14290

Reviewed By: trueadm

Differential Revision: D5164997

Pulled By: gaearon

fbshipit-source-id: cda479dd8a18773f01319f6b005e832e8e61387a
2017-06-01 13:06:24 -07:00
Jhen cf51aee9a0 Support `options` param for `requestIdleCallback`
Summary:
The `requestIdleCallback` sometimes doesn't work in `Debug JS Remotely` mode if I use real device, the callback will never called. I guess it may be debugger worker and device caused by the time gap, or some cause websocket blocking, so it's just sometimes happening.

I think we can support [options](https://developer.mozilla.org/zh-TW/docs/Web/API/Window/requestIdleCallback#Parameters) for that.

Added an example `Run requestIdleCallback with timeout option` for Timers of UIExplorer, it use `{ timeout: 100 }` option with burn CPU 100ms, we can see `didTimeout` is true.
Closes https://github.com/facebook/react-native/pull/13116

Differential Revision: D4894348

Pulled By: hramos

fbshipit-source-id: 29c4c2fe5634b30a8bf8d3495305cd8f635ed922
2017-06-01 11:00:40 -07:00
Spencer Ahrens 2a3de8f192 Cleanup PerformanceLogger a bit
Summary: `prettier`, lint, etc.

Reviewed By: javache

Differential Revision: D5156709

fbshipit-source-id: a9e63602c10e6e413446660b32ff972f5591c6d1
2017-06-01 10:03:27 -07:00
Alex Dvornikov a93b7a2da0 Added stubs for some native modules
Reviewed By: javache

Differential Revision: D5111649

fbshipit-source-id: eef2f84556611dec01978d845b89fa145ec5d4db
2017-06-01 08:31:19 -07:00
Pieter De Baets f7ebf0c64e Cleanup perf logging in FacebookAppRouteHandler
Reviewed By: sahrens

Differential Revision: D5154561

fbshipit-source-id: 5a3a495bbb910153833bc910864b6d5c7dca6432
2017-06-01 04:15:57 -07:00
Spencer Ahrens 1f3140c496 Improve view props and style stuff.
Reviewed By: fkgozali

Differential Revision: D5155884

fbshipit-source-id: defdcb7853cdb1c82466ee1dc451fc1b5d80782f
2017-06-01 01:15:42 -07:00
Cherag Verma 05e02b2dc5 Update SectionList.js
Summary:
minor spelling error fix

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

- [ Found this small spelling error while reading thought of reporting it  ] Explain the **motivation** for making this change.
- [ Test not required ] 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/14273

Differential Revision: D5160964

Pulled By: hramos

fbshipit-source-id: 3142cc511476e8b494576b8e31faf43eb97b40c5
2017-05-31 23:49:35 -07:00
Valentin Shergin 279f5f1c56 Using <Image> with nested content now causes warning (yellowbox)
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 #2: Yellow Box.

<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: D5139264

fbshipit-source-id: 99442107e10a321618fd34802c57a8c205ce66fb
2017-05-30 20:04:55 -07:00
Reem Helou cd49a5b289 Add missing documentation to animated spring config
Reviewed By: ericvicenti

Differential Revision: D5136367

fbshipit-source-id: 69e7afb80406196fd5c3352d5f80e23cf7463491
2017-05-30 14:36:06 -07:00
Dominic Gannaway 59e41b4485 Refactor of Fiber integration with React Fiber + Stack
Summary:
This PR aims to update the Inspector tool in React Native to use the new inspection APIs that have been added to the ReactNative renderer:

https://github.com/facebook/react/pull/9691

This PR also cleans up the code in `Inspector.js` so there's no usage of React's internals.
Closes https://github.com/facebook/react-native/pull/14160

Reviewed By: bvaughn

Differential Revision: D5129280

Pulled By: trueadm

fbshipit-source-id: b1b077c04f46b0f52cdea0e19b4154441558f77a
2017-05-30 10:02:32 -07:00
Adam Comella cfe003238a iOS: Introduce API for making screen reader announcements
Summary:
This change introduces some APIs that are useful for making announcements through the screen reader on iOS:
  - `announceForAccessibility`: The screen reader announces the string that is passed in.
  - `announcementFinished`: An event that fires when the screen reader has finished making an announcement.

You can already solve similar problems with RN Android using the `accessibilityLiveRegion` prop. Live regions are a different feature but they can be used to solve the same problem. This commit does not attempt to add live region support in RN iOS because Apple did not build live region support into iOS.

Verified that `announceForAccessibility` causes VoiceOver to announce the string when VoiceOver is enabled. Verified that `announcementFinished` fires with the appropriate data in the event object. Additionally, my team has been using this change in our app.

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

Differential Revision: D5137004

Pulled By: javache

fbshipit-source-id: b3c10f3dfc716430a16fcc98e1bb6fe52cabd6a5
2017-05-30 04:46:08 -07:00
Valentin Shergin e13b9c6e49 RCTTextField was spliited into two classes
Summary:
Motivation:
 * We maintain two different implementation of <TextInput> (multilined and singlelined), this change makes the implementations much similar which will help us to support and improve both of them in the (near) future;
 * We have to have separated RCTView-based container view for (TextField) to support sofisticated bordering and so on;
 * It opens to us possibility to unify UITextView and UITextField subclasses and remove code duplication across RCTTextView and RCTTextField;
 * Making things decoupled in general will allow us to fix existing bugs with events.

Reviewed By: mmmulani

Differential Revision: D5083010

fbshipit-source-id: 2f2d42c2244d2b39256c51480c1f16f4e3947c01
2017-05-29 16:01:11 -07:00
Valentin Shergin 48650226e8 Multiline <TextInput> was fixed to match layout logic of singlelined one
Summary: Now padding, border and intinsic sizes are computed same way as for singlelined text input.

Reviewed By: mmmulani

Differential Revision: D5075880

fbshipit-source-id: 1bc2fd479c13a003c717b1fc3d9c69f4639d4444
2017-05-29 16:01:09 -07:00
Valentin Shergin 4e40521620 Forcing to `alignSelf: stretch` was removed from <TextInput>
Summary:
Because it introduces inconsistency in RN layout model, confuses people and hurts dev experience.
The original problem was introduced in D1611014 as an attempt to address the intrinsic size issue.
So, now <TextInput> has intrinsic size (D5069971) and we don't need this hack anymore.

GH issues:
https://github.com/facebook/react-native/issues/11892
https://github.com/facebook/react-native/issues/9646

Reviewed By: javache

Differential Revision: D5072833

fbshipit-source-id: d9a60ab09b728e6de89bfa53eda07069377f1369
2017-05-29 16:01:08 -07:00
Valentin Shergin 44af4d19d3 Fixed <TextInput>'s padding and border size computation and layout
Summary: Previosly `borderWidth` did not affect actual content inset (which was a problem).

Reviewed By: mmmulani

Differential Revision: D5072483

fbshipit-source-id: d43cba7414a9335b9f9fd4d1565d7aee403cce0e
2017-05-29 16:01:04 -07:00
Valentin Shergin 1018cc8ceb Small code style related change in -[RCTTextField updatePlaceholder]
Summary: Because we believe in Objective-C.

Reviewed By: javache

Differential Revision: D5070920

fbshipit-source-id: 17e2335c829f2e5857981c5028e3bcecbe5dc13f
2017-05-29 16:01:03 -07:00
Valentin Shergin ea9d6746df Singleline <TextInput> now has intrinsic size
Summary:
Singleline <TextInput> now has intrinsic size which is equal to size of placeholder.
And if <TextInput> does not have placeholder it still has intrinsic height.
So, we don't need to set the size up manually every single time anymore!

(Multiline <TextInput> already has this feature.)

Reviewed By: mmmulani

Differential Revision: D5069971

fbshipit-source-id: f65c1062a812259b66d287929314dc571dc1f3ee
2017-05-29 16:00:58 -07:00
Saleel Salam 7807247905 Add 'thirdPartyCookiesEnabled' prop on WebView to enable third party …
Summary:
…cookies on Android Lollipop or later versions.

Third party cookies in WebView are [disabled by default](https://developer.android.com/reference/android/webkit/CookieManager.html#setAcceptFileSchemeCookies(boolean)) on Android Lollipop or later versions. This prevented users from logging in by using _Login by Facebook_ method (in redirect mode) in Android Webview.

This PR exposes a prop `thirdPartyCookiesEnabled` which will enable third party cookies in Android Webview. This setting is ignored on versions below Android Lollipop and on iOS as third party cookies are enabled in them by default.

Appropriate documentation was added in code and they were reflected in the website.
Closes https://github.com/facebook/react-native/pull/14013

Differential Revision: D5145059

Pulled By: shergin

fbshipit-source-id: 67bcb3a497a9c6f6db1d12e8d16197d2facd157e
2017-05-28 21:30:20 -07:00
Valentin Shergin bac84ce207 BREAKING: Better TextInput: `contentSize` property was removed from `<TextInput>.onChange` event (Second attempt)
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: D4989881

fbshipit-source-id: 674bb98c89ada1fca7b3b20b304736b2a3b8304e
2017-05-28 20:16:04 -07:00
Alex Ledak 9fae268e5b Play sound in local notification only if soundName is specified
Summary:
Currently it's not possible to create a silent local notification (which is useful for badge updates) with PushNotificationIOS. This commit solves the problem - when **soundName** param is not specified in **PushNotificationIOS.scheduleLocalNotification** method, a silent notification will be created.

Local notification without sound:
```
let fireDate = new Date();
fireDate = fireDate.setSeconds(fireDate.getSeconds() + 15); //fire in 15 seconds
PushNotificationIOS.scheduleLocalNotification({
  fireDate: fireDate,
  alertBody: "I'm silent!"
});
```

Local notification with sound:
```
let fireDate = new Date();
fireDate = fireDate.setSeconds(fireDate.getSeconds() + 15); //fire in 15 seconds
PushNotificationIOS.scheduleLocalNotification({
  fireDate: fireDate,
  alertBody: "I'm with sound!",
  soundName: "Any sound"
});
```
Closes https://github.com/facebook/react-native/pull/13734

Differential Revision: D5144848

Pulled By: shergin

fbshipit-source-id: dc990b2673305a01cfd868fcdedcf27c461d0a34
2017-05-28 15:37:10 -07:00
Valentin Shergin 3df537a25c Using `drawViewHierarchyInRect` instead of `renderInContext` for snapshot tests
Summary:
We found that `-[CALayer renderInContext:]` produces bad results in some cases (which is actually documented thing!),
so we decided to replace it with `-[UIView drawViewHierarchyInRect:]` which is more reliable (I hope).
As part of this change I completly removed support of `CALayer` from local fork of `RNTesterIntegrationTests`.

See https://github.com/facebook/react-native/pull/14011#issuecomment-303844580 for more details.

janicduplessis

Reviewed By: javache

Differential Revision: D5129492

fbshipit-source-id: 6a9227037c85bb8f862d55267f5301e177985ad9
2017-05-26 15:16:07 -07:00
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