Commit Graph

3351 Commits

Author SHA1 Message Date
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
Dan Abramov 7a3ab96d94 Fix race condition during initialization
Summary:
I discovered this while trying to pinpoint why Nuclide Inspector integration with RN is so flaky. It turns out that, for some reason, if I create a `WebSocket` instance early enough (which I need to when setting up DevTools integration), and the connection is fast enough (which it is on localhost), the `websocketOpen` message may arrive earlier than an `onopen` event handler is registered, causing the `onopen` handler to never fire.

```
mkdir ~/my-server
cd ~/my-server
npm i ws
nano index.js
```

Paste this code:

```js
const ws = require('ws');
const wss = new ws.Server({
  port: 8099
});
```

Run the server:

```js
node index.js
```

Now, inside React Native, paste right after [these lines](57010d63b6/Libraries/Core/InitializeCore.js (L193-L194)):

```js
  const ws = new window.WebSocket('ws://localhost:8099');
  ws.onopen = function() {
    alert('open!');
  };
```

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

Differential Revision: D4536554

Pulled By: gaearon

fbshipit-source-id: 3021fa26b3bf275cba3704a7f3a30c77db69a1f8
2017-02-09 13:32:31 -08:00
Frazer Kirkman a9ccc8133e Text docs - Update to improve readability for ellipsizeMode
Summary:
added context for easier understanding as 'ellipsizeMode' appears before 'numberOfLines' in https://facebook.github.io/react-native/docs/text.html

Explain the **motivation** for making this change. What existing problem does the pull request solve?

Upon first reading the Text docs, the ellipsizeMode function is confusing.  This update aims to remove the confusion.
Closes https://github.com/facebook/react-native/pull/11881

Differential Revision: D4533700

Pulled By: lacker

fbshipit-source-id: 948df16235a0ba02c14e630518bbd7261bc2b802
2017-02-09 13:15:31 -08:00
Sebastian Markbage 57990b7970 findNodeHandle -> ReactNative.findNodeHandle
Summary:
findNodeHandle is considered an internal module. The one to use is ReactNative.findNodeHandle. We need to rely on this because we will have two different renderers and we need the renderers to inject themselves with findNodeHandle before it is used.

I use ReactNative.findNodeHandle from inside the module because I think this leads to a cycle somewhere or might not play well with inline require otherwise.

There is also one in UIManager but that is definitely a cycle so I'm going to try to avoid that one.

Reviewed By: spicyj, bvaughn

Differential Revision: D4533911

fbshipit-source-id: f771641ea5c5366ccbaff68c42202fa6f8c18cb3
2017-02-08 19:17:08 -08:00
Kevin Gozali 3ca719072f RN: Fix YellowBox Layout Bug
Summary:
Looks like a recent change in Yoga causes the height of an absolutely positioned fullscreen view to break.

This works around the issue by using the newly introduced percentage `height` instead.

Reviewed By: jingc

Differential Revision: D4530240

fbshipit-source-id: 86d758576c6984686f30d7504e11f9ec3ce469bd
2017-02-08 19:17:08 -08:00
Sachin Rekhi 2fa7c93c1c removed flex: 1 from SwipeableRow styles to make compatible with 0.39 changes
Summary:
React Native 0.39 introduced a breaking change through a new C-based implementation of css-layout. Developers were encouraged to remove unnecessary flex: 1 styles where no longer required to address any resulting layout issues.

The SwipeableListView has not yet been updated to reflect this change. Specifically, SwipeableRow still sets flex: 1 even though it shouldn't.

This was resulting in a rendering issue for folks when they upgraded to React Native 0.39 and used SwipeableListView that caused significant initial flickering when rendering a SwipeableListView. The solution was simply to remove flex: 1 from the SwipeableRow implementation.

This small change removes flex: 1 to resolve this issue.

Suggested reviewer (initial SwipeableListView contributor): fred2028

See this issue for more details: https://github.com/facebook/react-native/issues/11441
Closes https://github.com/facebook/react-native/pull/11521

Differential Revision: D4532562

Pulled By: lacker

fbshipit-source-id: 5c2907186d00481a731bd81794947a019465a031
2017-02-08 16:00:12 -08:00
Sebastian Markbage c3b25c9059 Patch up for future React Sync
Reviewed By: spicyj, bvaughn

Differential Revision: D4523259

fbshipit-source-id: 317a26ce3e9e48553a7f7c856dd6b48038b4b2ea
2017-02-08 14:50:43 -08:00
Valentin Shergin 1ab104a759 `direction` layout property was marked as iOS only
Reviewed By: fkgozali

Differential Revision: D4523017

fbshipit-source-id: 4972596719fec54616fedf9e8a0a271e745193ae
2017-02-08 14:31:09 -08:00
Valentin Shergin d8748233ca Removing `transformMatrix` and `decomposedMatrix` properties
Summary: We deprecated `transformMatrix` and `decomposedMatrix` in D3239960 10 months ago. This revision finally removes remains of this functionality from native code.

Reviewed By: mmmulani

Differential Revision: D4515760

fbshipit-source-id: b4d5b7e834ac4a775f4992b28270b4ff961889a6
2017-02-07 14:02:20 -08:00
Alexey Kureev f30ab35e92 Add default option for Platform.select
Summary:
satya164 asked me to take over fixes for [this PR](https://github.com/facebook/react-native/pull/11608), so here we go!
Closes https://github.com/facebook/react-native/pull/12218

Differential Revision: D4515285

Pulled By: davidaurelio

fbshipit-source-id: 8987c518401fc67093dfe93bbbb63b934c20f6f9
2017-02-07 04:30:16 -08:00
Valentin Shergin ec673d0771 Added support of `direction` style property
Summary: Now layout direction (LTR or LTR) can be specified not only for whole app but also for view subtree via `direction` style property.

Reviewed By: mmmulani

Differential Revision: D4510206

fbshipit-source-id: 4e56c5886b6e42f2343165eb76be897e681c5ba4
2017-02-06 21:00:16 -08:00
Tim Yung d73f7d3d5e RN: Revert ListView Separator Change
Reviewed By: sahrens

Differential Revision: D4519588

fbshipit-source-id: b339b2a547de0e6d1a687be3d0d0abe8b82f7107
2017-02-06 18:46:10 -08:00
Spencer Ahrens 5d4d62f474 Some perf tools for debugging js stalls
Summary:
The stall watchdog is handy to detect stalls, but it doesn't really tell us what was
happening. This diff makes it easy to track React perf and bridge traffic during any stall, and
prints it out if the stall exceeds the threshold.

Reviewed By: yungsters

Differential Revision: D4479439

fbshipit-source-id: 87f94913ec341a648d7744249597dc30b29759ab
2017-02-06 17:46:34 -08:00
Adam Comella 69e98cfc75 Android: Add onScroll event to TextInput
Summary:
Corresponding iOS PR: https://github.com/facebook/react-native/pull/11002

This adds an onScroll event to TextInput which is useful when a multiline TextInput has so much content that it is scrollable.

**Test plan (required)**

Verified the event works properly in a test app. Also, my team uses this event in our app.

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

Differential Revision: D4220941

Pulled By: mkonicek

fbshipit-source-id: 7e420579946f2ae840c9e1fcdc8afab68007da17
2017-02-06 07:28:28 -08:00
Spencer Ahrens a3457486e3 Better ListView - FlatList
Summary:
We really need a better list view - so here it is!

Main changes from existing `ListView`:

* Items are "virtualized" to limit memory - that is, items outside of the render window are unmounted and their memory is reclaimed. This means that instance state is not preserved when items scroll out of the render window.
* No `DataSource` - just a simple `data` prop of shape `Array<any>`. By default, they are expected to be of the shape `{key: string}` but a custom `rowExtractor` function can be provided for different shapes, e.g. graphql data where you want to map `id` to `key`. Note the underlying `VirtualizedList` is much more flexible.
* Fancy `scrollTo` functionality: `scrollToEnd`, `scrollToIndex`, and `scrollToItem` in addition to the normal `scrollToOffset`.
* Built-in pull to refresh support - set set the `onRefresh` and `refreshing` props.
* Rendering additional rows is usually done with low priority, after any interactions/animations complete, unless we're about to run out of rendered content. This should help apps feel more responsive.
* Component props replace render functions, e.g. `ItemComponent: ReactClass<{item: Item, index: number}>` replaces `renderRow: (...) => React.Element<*>`
* Supports dynamic items automatically by using `onLayout`, or `getItemLayout` can be provided for a perf boost and smoother `scrollToIndex` and scroll bar behavior.
* Visibility callback replaced with more powerful viewability callback and works in vertical and horizontal mode on at least Android and iOS, but probably other platforms as well. Extra power comes from the `viewablePercentThreshold` that lets the client decide when an item should be considered viewable.

Demo:

https://www.facebook.com/groups/576288835853049/permalink/753923058089625/

Reviewed By: yungsters

Differential Revision: D4412469

fbshipit-source-id: e2d891490bf76fe14df49294ecddf78a58adcf23
2017-02-04 10:28:47 -08:00
Bhuwan Khattar 57daad98f0 Rename files to match @providesModule annotations
Reviewed By: davidaurelio

Differential Revision: D4507911

fbshipit-source-id: b8c9b77d7d9a2d8b2ae80d85d116f456766acba0
2017-02-03 15:58:58 -08:00
Hedger Wang f2ab27e321 Fix <SwipeableRow /> layout.
Summary:
The back view in <SwipeableRow /> should not be rendered unless the front view has been
rendered and its layout has been measured.

Reviewed By: fred2028

Differential Revision: D4509584

fbshipit-source-id: 72ad0c8e7dec258ae3a1ba88c0adeb9ad0bfdf6d
2017-02-03 13:58:32 -08:00
Jon Cursi f4bbf1bc62 Update ScrollView docs - Fixes #12139
Summary:
Added a note to the `refreshControl` prop on ScrollView to call out that the prop only works for vertical ScrollViews.

Fixes #12139
Closes https://github.com/facebook/react-native/pull/12150

Differential Revision: D4508796

Pulled By: mkonicek

fbshipit-source-id: 8e71692f29ee175e32177c3a26a4ed2e8d14f139
2017-02-03 12:28:33 -08:00
Jani Eväkallio e93d496f6d Add Animated.ValueXY.extractOffset
Summary:
The `extractOffset` method is previously implemented on `Animated.Value`, along with `setOffset` and `flattenOffset`. Both of the latter methods are proxied on `Animated.ValueXY`, but `extractOffset` is not. This commit adds the missing method.

When creating draggable elements in XY space, in order to compensate for previous gestures' offsets, we currently need to do something like the following at the beginning or end of each gesture:
```
xy.setOffset(xy.__getValue());
xy.setValue({x: 0, y: 0});
```

After this commit, the API is equivalent to using a plain `Animated.Value`:
```
xy.extractOffset();
```
Closes https://github.com/facebook/react-native/pull/12193

Differential Revision: D4508717

Pulled By: mkonicek

fbshipit-source-id: 0976cf1ab68538e59023ffaa2539eb62779ad874
2017-02-03 12:14:09 -08:00
Mehdi Mulani 5c84caaa86 Handle push notifications on iOS
Reviewed By: fkgozali

Differential Revision: D4450067

fbshipit-source-id: 6b83dbe75bf7e61c5fc19b27ed2ea48b31b84e2b
2017-02-03 11:58:30 -08:00
Tim Yung 778cf289a8 RN: Export Accessibility Prop Types
Summary: Exports Flow types for the props related to accessibility.

Reviewed By: fkgozali

Differential Revision: D4498562

fbshipit-source-id: 2fb6e78d4ceaf9f26b6ea88d515b7b28f570de52
2017-02-02 23:28:31 -08:00
Tim Yung b053fd5bdd RN: Fix Type of `accessibilityLabel` in <Image>
Summary: Fixes the prop type of `accessibilityLabel` in `<Image>` so that it matches that of `<View>`.

Reviewed By: fkgozali

Differential Revision: D4499103

fbshipit-source-id: 66bf3dce60bd79857849e0c46c989e7866d83d81
2017-02-02 22:13:26 -08:00
Tim Yung b2179ebedf RN: Fix `renderSeparator` in ListView
Summary:
Couple fixes to `ListView`'s `renderSeparator`:

- Add a `key` by default.
- //Actually// avoid rendering the last separator.

Reviewed By: sahrens

Differential Revision: D4502732

fbshipit-source-id: 7502984cfb8652a22d8b85859e62ccf6e61c9b0e
2017-02-02 19:58:27 -08:00
Valentin Shergin 91910d87de Better RTL support especially for ScrollView's
Reviewed By: fkgozali

Differential Revision: D4478913

fbshipit-source-id: 525c17fa109ad3c35161b10940776f1426ba2535
2017-02-02 09:58:30 -08:00
Janic Duplessis 0ed31eb3d6 BREAKING - Improve JS transform validation, add tests
Summary:
This improves JS validations of the transform object and makes it a bit stricter (hence the breaking change). When moving transform objects parsing to native (#10658) the validations got out of sync a bit, this makes sure JS validations are the same or stricter than the native ones to make sure we get consistent errors across platforms.

See #12110 for an example of an error that now gets caught by JS validations.

Also added snapshot tests for the errors to make sure `processTransform` throws when passing invalid values. It only tests the validation since the object parsing is now done natively for iOS and Android.

**Test plan**
Test that there are no errors in UIExplorer
Run new unit tests
Closes https://github.com/facebook/react-native/pull/12115

Differential Revision: D4488933

Pulled By: mkonicek

fbshipit-source-id: a714e6175b2892284a44c870506165099efec1ed
2017-02-02 06:28:31 -08:00
Christoph Pojer a2c84d14ce Remove `react-packager` indirection.
Summary:
This moves the `src` directory one level up and removes the `react-packager` folder. Personally, I always disliked this indirection. I'm reorganizing some things in RNP, so this seems to make sense.

Not sure if I forgot to update any paths. Can anyone advice if there are more places that need change?

Reviewed By: jeanlauliac

Differential Revision: D4487867

fbshipit-source-id: d63f9c79d6238300df9632d2e6a4e6a4196d5ccb
2017-02-02 05:44:15 -08:00
Chirag d21199595e remove max children limitation on SwipeableQuickActions
Summary:
**motivation**
Right now `SwipeableQuickActions` only allows two actions. Let this limit be in the userland.

cc fred2028
Closes https://github.com/facebook/react-native/pull/8528

Differential Revision: D4211729

Pulled By: ericvicenti

fbshipit-source-id: 903592190b9855ffe9da44864cdc276bc1e18a7c
2017-02-02 05:28:34 -08:00
Dan Scanlon 7812b82b18 Add `style` and `imageStyle` props to Navigation.Header.BackButton
Summary:
This PR adds`style` and `imageStyle` props to `Navigation.Header.BackButton` which allows for usage like:

```javascript
<NavigationExperimental.Header.BackButton
  imageStyle={{ tintColor: 'white' }}
  onPress={props.onNavigateBack}
/>
```
Closes https://github.com/facebook/react-native/pull/11554

Differential Revision: D4494460

Pulled By: mkonicek

fbshipit-source-id: 387a69d0b76bb8e7ef47caf1f6141f97fad0ea4b
2017-02-02 04:58:38 -08:00
Jonathan Koo 2edd455c65 Properly clear openRowID when a row is swiped to closed position.
Summary:
If a SwipeableRow does not have background color defined, QuickAction is rendered below the row. In such case, you can leverage openRowID defined in dataSource. For instance, one can render quickAction only for the open row. The openRowID, however, does not clear when the row is closed. It only clears when the ListView is scrolled. This is s small PR to fix address it.
Closes https://github.com/facebook/react-native/pull/11380

Differential Revision: D4500952

Pulled By: mkonicek

fbshipit-source-id: a965dfb45b77cc1669de405b627d13e2cee59420
2017-02-02 04:58:38 -08:00
Michal Srb 5938e16248 Document arguments to onSelectionChange
Summary:
To update the documentation. Works on iOS, so I assume this is the same on Android.
Closes https://github.com/facebook/react-native/pull/11575

Differential Revision: D4494464

Pulled By: mkonicek

fbshipit-source-id: c7480d39ed0849401efaa080948c14fa0cb7a08d
2017-02-02 04:58:38 -08:00
Adam Comella 12c4868628 Android: Add overScrollMode prop to ScrollView
Summary:
This prop exposes the functionality provided by Android ScrollView's setOverScrollMode method.

One interesting thing to note is that, if you were to read the Android docs, you would think that the value "always" is the default over scroll mode. However, the docs are incorrect and "always-if-content-scrolls" is actually the default value (http://stackoverflow.com/a/27116306).

**Test plan (required)**

Verified this change in a test app. Also, our team uses this change in our app.

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

Differential Revision: D4500957

Pulled By: mkonicek

fbshipit-source-id: 873eba38183defba133c228e0c1038efa83297d3
2017-02-02 04:29:52 -08:00
Martin Konicek 6ec5654e7a BREAKING: Move RecyclerViewBackedScrollView out of open source
Summary: `RecyclerViewBackedScrollView` was added a long time ago to work around the scroll-back-when-data-is-added bug, but that has now been fixed directly in the `ScrollView` (`ReactScrollView.java`) in open source and internally.

Reviewed By: astreet

Differential Revision: D4482105

fbshipit-source-id: 208f21f00045d5c5a83b74ad69b3db6fa63391d7
2017-02-02 03:44:12 -08:00
Satyajit Sahoo 295a0150d4 Support customizing thumb, track and progress colors for slider on Android
Summary:
**Motivation**

Ability to customize slider colors is desirable to match the brand. Currently iOS allows using images for slider parts, but android doesn't have any customization options. This PR adds support for customizing `thumbTintColor`, `trackTintColor` and `progressTintColor`.

**Test plan (required)**

Run UIExplorer example with the changes and verify everything works fine.

![image](https://cloud.githubusercontent.com/assets/1174278/22020752/f32a6eec-dcdf-11e6-928d-481bb28bd0a3.png)

cc brentvatne
Closes https://github.com/facebook/react-native/pull/11946

Differential Revision: D4427474

fbshipit-source-id: ec3a38db600bac6108691a4cfa15e2409143b9f3
2017-02-01 00:43:29 -08:00
Satyajit Sahoo 31099aa233 Support tintColor and thumbTintColor for Switch on Android
Summary:
**Motivation**

`Switch` on Android doesn't allow changing the colors unlike iOS. Changing the colors is desirable in a lot of cases to match the brand colors.

The PR adds support for the `tintColor`, `onTintColor` and `thumbTintColor` props on Android, which more or less behave the same as iOS. The only difference is `tintColor` styles the border color on iOS, whereas it styles the background color on Android.

**Test plan (required)**

Run UIExplorer with the changes, and ensure that the switch example works properly. Here are screenshots from iOS and Android to compare.

![image](https://cloud.githubusercontent.com/assets/1174278/22018002/b05d6482-dcd2-11e6-9c00-f55a71d6ce29.png)

![image](https://cloud.githubusercontent.com/assets/1174278/22018012/b923e974-dcd2-11e6-8d4e-86994f5a66e6.png)

cc brentvatne
Closes https://github.com/facebook/react-native/pull/11940

Differential Revision: D4427491

fbshipit-source-id: 16c569d2e2261daaea93fffa83198f8f6b59a6c8
2017-01-31 13:43:43 -08:00
rh389 7a4166c31d Deal with 0.38 'FlowFixMe's
Summary:
Largely typing fixes to deal with the glut of new `FlowFixMe` suppressions introduced with flow 0.38 in a4bfac907e

Tested with flow itself. CC gabelevi
Closes https://github.com/facebook/react-native/pull/11985

Differential Revision: D4452045

Pulled By: ericvicenti

fbshipit-source-id: acc46c4c406ae706a679e396be1d40ae2f4ce5a1
2017-01-31 13:13:32 -08:00
Paul Mestemaker 8378f0f9f7 Ensure documentation has consistent relative links
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

I had tried fixing a broken link in a previous commit (#11453). My commit was merged, but it did not resolve the underlying problem. I have looked into how links should be formed for the docs and have fixed the original problem as well as updated all other links to be consistent.

Previous link formats:

- /docs/sample.html <-- broken link
- sample.html <-- broken link
- https://facebook.github.io/react-native/docs/sample.html <-- works
- /react-native/docs/sample.html <-- works
- docs/sample.html <-- works (permalink format)

This PR updates all links to the permalink format.

**Test plan (required)**
I ran the website locally and manually tested half of the links in each category. They all worked.
```
$ cd website
$ npm install && npm start
```
Closes https://github.com/facebook/react-native/pull/12064

Differential Revision: D4489153

Pulled By: mkonicek

fbshipit-source-id: bf0231d941ba147317595c3b3466dc579a887169
2017-01-31 12:13:31 -08:00
Bill 4344e064e7 Update Geolocation.js
Summary:
Clearer wording, on first read it is possible to get the impression that it will return immediately for both cached and on update request.
Closes https://github.com/facebook/react-native/pull/12072

Differential Revision: D4482784

Pulled By: mkonicek

fbshipit-source-id: 9eb9acf946b97b7b2b51f07e6a6572098afe7610
2017-01-31 11:58:30 -08:00
yyoshiki41 914848759a Fix missing RCTBridgeModule.h
Summary:
`<React/RCTBridgeModule.h>`

**motivation**

iOS native headers moved in RN v0.40.0.
link: https://github.com/facebook/react-native/releases/tag/v0.40.0

So, fixed import path in `Libraries/Sample/Sample.h`.

**Test plan (required)**

- [x] Make sure tests pass on both Travis and Circle CI.

Related p-r
https://github.com/facebook/react-native/pull/11576
Closes https://github.com/facebook/react-native/pull/12127

Differential Revision: D4488979

Pulled By: mkonicek

fbshipit-source-id: 75bffb542827d20d53062c54f06aaee0a76398bf
2017-01-31 11:13:50 -08:00
Valentin Shergin a341e9d916 Fixed calling TextInput.onChange() on applying autocorrection (iOS), Second part
Reviewed By: mmmulani

Differential Revision: D4459603

fbshipit-source-id: f1ee25a9068213a54f2c088760297ba9c2838623
2017-01-30 15:43:28 -08:00
Hawken Rives a3f86ae984 Update docs for Text allowFontScaling
Summary:
> Explain the **motivation** for making this change. What existing problem does the pull request solve?

The documentation was slightly out of date. Following https://github.com/facebook/react-native/pull/10898, which removed the `platform ios` tag, this updates the inner documentation to remove the reference to iOS.
Closes https://github.com/facebook/react-native/pull/11993

Differential Revision: D4443723

Pulled By: hramos

fbshipit-source-id: b859c9b0fe1f5e564b919663f8c75401a52ffc9f
2017-01-30 12:58:30 -08:00
Martin Konicek ad8cbb6dea Support ScrollView.scrollToEnd on Android natively
Summary:
This is a followup for https://github.com/facebook/react-native/pull/12088 and implements the scrolling to end on Android natively rather than sending a large scroll offset from JS.

This turned out to be an OK amount of code, and some reduction in the amount of JavaScript. The only part I'm not particularly happy about is:

```
// ScrollView always has one child - the scrollable area
int bottom = scrollView.getChildAt(0).getHeight() + scrollView.getPaddingBottom();
```

According to multiple sources (e.g. [this SO answer](http://stackoverflow.com/questions/3609297/android-total-height-of-scrollview)) it is the way to get the total size of the scrollable area, similar to`scrollView.contentSize` on iOS but more ugly and relying on the fact the ScrollView always has a single child (hopefully this won't change in future versions of Android).

An alternative is:

```
View lastChild = scrollLayout.getChildAt(scrollLayout.getChildCount() - 1);
int bottom = lastChild.getBottom() + scrollLayout.getPadd
Closes https://github.com/facebook/react-native/pull/12101

Differential Revision: D4481523

Pulled By: mkonicek

fbshipit-source-id: 8c7967a0b9e06890c1e1ea70ad573c6eceb03daf
2017-01-30 10:28:32 -08:00
Janic Duplessis 850c71c2f3 Remove usages of RecyclerViewBackedScrollView in UIExplorer and NetworkOverlay
Summary:
RecyclerViewBackedScrollView was deprecated, this removes usages in Examples as well as in NetworkOverlay.

**Test plan**
Tested that RecyclerViewBackedScrollView deprecation warning doesn't show up anymore.
Closes https://github.com/facebook/react-native/pull/11999

Differential Revision: D4443707

Pulled By: hramos

fbshipit-source-id: 087afc9f183b3f2087965a2fe84301f422e48e9c
2017-01-28 10:43:35 -08:00
Martin Konicek 9dee696ed8 Add scrollToEnd to ScrollView and ListView
Summary:
**Motivation**

A basic task of making a React Native ScrollView or ListView scroll to the bottom is currently very hard to accomplish:
- https://github.com/facebook/react-native/issues/8003
- https://github.com/facebook/react-native/issues/913
- http://stackoverflow.com/questions/29829375/how-to-scroll-to-bottom-in-react-native-listview

**NOTE:** If you're building something like a chat app where you want a ListView to keep scrolling to the bottom at all times, it's easiest to use the [react-native-invertible-scrollview](https://github.com/exponent/react-native-invertible-scroll-view) component rather calling `scrollToEnd` manually when layout changes. The invertible-scrollview uses a clever trick to invert the direction of the ScrollView.

This pull request adds a `scrollToEnd` method which scrolls to the bottom if the ScrollView is vertical, to the right if the ScrollView is horizontal.

The implementation is based on this SO answer:
http://stackoverflow.com/questions/952412/uiscrollview-scrol
Closes https://github.com/facebook/react-native/pull/12088

Differential Revision: D4474974

Pulled By: mkonicek

fbshipit-source-id: 6ecf8b3435f47dd3a31e2fd5be6859062711c233
2017-01-27 10:13:29 -08:00
Sean Kinsey 2cfb3f1f8f Enable setting custom styles on scenes stack
Summary: There's scenarios where you might want to retain transparency behind the header, but have a solid background for the scene stack and its transitions.

Reviewed By: ericvicenti, dwwoelfel

Differential Revision: D4471681

fbshipit-source-id: 529e999b96b02a00e8d625169989dda49fb3ddaa
2017-01-26 20:43:33 -08:00
Ryan Gomba 7e869b9d0a Drive any numerical prop via NativeAnimated
Summary:
In theory, we should be able to animate any non-layout property, including custom ones. While there is still work to be done on the native side to fully enable this, we should start by dropping the prop whitelist.
Closes https://github.com/facebook/react-native/pull/10658

Differential Revision: D4379031

Pulled By: ericvicenti

fbshipit-source-id: fe9c30ea101e93a8b260d7d09a909fafbb82fee6
2017-01-26 18:28:53 -08:00
Hedger Wang a83af44a59 Fix Navigator scene that is falsely collapsed.
Reviewed By: ericvicenti

Differential Revision: D4472405

fbshipit-source-id: 90022598f0fd8edfddc4460fee2338a7b67538c2
2017-01-26 17:43:28 -08:00
Alex Kotliarskyi 99b81da629 Remove obsolete mocks
Reviewed By: cpojer

Differential Revision: D4466121

fbshipit-source-id: a318deb6485cb3e2e8e7bd52278bce9f9d16fefd
2017-01-26 11:28:33 -08:00
Pieter De Baets 0fc62eebc3 Revert D4450924: Expose StatusBar height on iOS
Differential Revision: D4450924

fbshipit-source-id: a883a7417e85f0a923d5fcc4d5efff75b99c2272
2017-01-25 17:59:30 -08:00
Valentin Shergin 64041669ee The warning 'cannot calculate shadow efficiently' is not a warning anymore
Reviewed By: fkgozali, yungsters

Differential Revision: D4445304

fbshipit-source-id: 3a37150ae2beaf44b505dc36b575b7d44619e071
2017-01-25 12:28:50 -08:00
David Aurelio 517abba6bb Require `fbjs/lib/invariant` instead of `invariant`
Summary: `'invariant'` can only be resolved by chance if node modules have been installed with npm3 or yarn, as it is a transitive dependency of `babel-traverse`. This changes the import to the direct dependency `fbjs/lib/invariant`.

Reviewed By: jeanlauliac, astreet

Differential Revision: D4462471

fbshipit-source-id: 5c841845012ed22a7c6264d46326a47807948513
2017-01-25 10:43:55 -08:00
Valentin Shergin 9a9ecea873 Fixed calling TextInput.onChange() on applying autocorrection (iOS)
Reviewed By: javache

Differential Revision: D4444428

fbshipit-source-id: 1b107e79307dedad43bed4ba6f456b4988904764
2017-01-24 16:58:27 -08:00
Koen Punt 72bafefc31 fix type on => one
Summary:
Just fixed a typo
Closes https://github.com/facebook/react-native/pull/12001

Differential Revision: D4443718

Pulled By: hramos

fbshipit-source-id: 69d194da871491d7243c7cc0d07dff4dfb1db590
2017-01-23 15:13:32 -08:00
Mathieu Acthernoene eebfd33b70 Expose StatusBar height on iOS
Summary:
Following the PR https://github.com/facebook/react-native/pull/6195, this adds a `HEIGHT` constant on `StatusBar` for iOS.

Combined with `statusBarFrameDidChange` and `statusBarFrameWillChange` StatusBar native events, it solves various problems with In-Call cellar bar / Location bar / others 40pt status bars, and offers a correct `keyboardVerticalOffset` value for the KeyboardAvoidingView component.
Closes https://github.com/facebook/react-native/pull/12041

Differential Revision: D4450924

Pulled By: hramos

fbshipit-source-id: 664798260f4226140f3fa3f9222a415a305d0d78
2017-01-23 12:58:34 -08:00
Héctor Ramos 86684a0a29 docs(AppState.js): update example to ES6
Summary:
If this is the way to go, I'll update the rest of the document :)

> Explain the **motivation** for making this change. What existing problem does the pull request solve?

- Update basic usage to latest ES6-7 syntax
- Provide a working simple example of using AppState
Closes https://github.com/facebook/react-native/pull/11879

Differential Revision: D4443891

Pulled By: hramos

fbshipit-source-id: 87433e994ee56050e24a3853f24a94b54f5586d4
2017-01-23 11:58:33 -08:00
Pieter De Baets 7412340175 Fix passThroughTouches
Reviewed By: mmmulani

Differential Revision: D4438390

fbshipit-source-id: 4e1ec4eaf80ffb48ac7b65ed092402c51d9227d3
2017-01-23 11:28:51 -08:00
Brian Vaughn 212d31e322 Updated Systrace and RCTRenderingPerf to sync w/ React changes
Summary:
A temporary React Native compatibility fix was added to React in commit [bba0d99](bba0d992d8) and subsequently removed in commit [e612826](e612826650). I noticed this while testing the React Native fiber renderer and attempting to use `Systrace`.

This commit updates React Native to no longer rely on the deprecated method and module.

PS I'm not sure if I should also update `ReactDebugTool` with this commit or wait for a subsequent sync script to update it. I haven't committed to this repo before. Please advise. 😄
Closes https://github.com/facebook/react-native/pull/11970

Differential Revision: D4446219

Pulled By: bvaughn

fbshipit-source-id: f286b8a4d00cdcbfbb49f52b9f1db5231d453f4c
2017-01-22 09:58:32 -08:00
Philipp von Weitershausen 16bb6e87ba XHR: support typed arrays for request payloads
Summary:
Support `xhr.send(data)` for typed arrays.

**Test plan:** run UIExplorer example on iOS and Android.
Closes https://github.com/facebook/react-native/pull/11904

Differential Revision: D4425551

fbshipit-source-id: 065ab5873407a406ca4a831068ab138606c3361b
2017-01-20 18:43:27 -08:00
Alex Kotliarskyi 5a09b2861a Guard against empy _inputRef in TextInput
Reviewed By: cpojer

Differential Revision: D4420532

fbshipit-source-id: 6912c11b5a6f5d8efaa07dc7a09a9bc1cda0658a
2017-01-20 16:43:42 -08:00
Aaron Chiu 5e9db574ee access view managers as Native Modules
Reviewed By: achen1

Differential Revision: D4338782

fbshipit-source-id: 1573e45ee3af5a44d033a166424e556b2c091fb6
2017-01-20 15:58:27 -08:00
Leon 0426732a08 Fix Scrollblocking on Android
Summary:
Without allowing Native Responder on Android, ListView get's Deadlocked while trying to scroll. This happens as soon as a PanResponder fires.

This Commit prevents this Issue and the iOS Optimization for Locking / Unlocking Listview Scrolls does a good job on Android too. So there's no need to prevent the Native Responder.

**Test plan (required)**

Compile on Android in Production Mode and try to scroll before and after this change.
Closes https://github.com/facebook/react-native/pull/8556

Differential Revision: D4438057

Pulled By: hramos

fbshipit-source-id: 05f3b7e6b4e49f5c941c7e1ce72c8bf6d66a9a28
2017-01-19 14:43:37 -08:00
yueshuaijie 94f71a3884 Add one more parameter(keyboardType) to AlertIOS.promot().
Summary:
Add one more parameter which can specify the keyboard type of first text input(if exists) to AlertIOS.prompt().

Example usage:
`AlertIOS.prompt('Type a phone number', null, null, 'plain-text', undefined, 'phone-pad')`
Closes https://github.com/facebook/react-native/pull/8781

Differential Revision: D4437900

Pulled By: hramos

fbshipit-source-id: 8141cc0d7c70d13603cd5a1d5ea3f1ab1ce437a6
2017-01-19 14:43:37 -08:00
Kevin Gozali 06956e83cd expose IS_TESTING for Platform module
Summary: Introduced IS_TESTING flag on Platform module for android as well. This is useful for testing environment.

Reviewed By: mmmulani

Differential Revision: D4429662

fbshipit-source-id: 33711d7fb5666f0bac8aee444b71261f7f12770f
2017-01-19 14:28:30 -08:00
Max Graey b850af7a39 fix skew transformation
Summary:
Motivation:
fix #11884 issue

I will try in short to explain what was wrong.
Let's look to transformation's matrix for **skewY** for example.
| cos(a) | sin(a) |    0   |   0   |
|:------:|:------:|:------:|:-----:|
|    0   |    1   |    0   |   0   |
|    0   |    0   |   1    |    0  |
|   tx   |   ty   |   tz   |   1   ||

Yes, this visually produce skewing transform but it slightly incorrect. This way affects horizontal scale as well. See [this](https://github.com/facebook/react-native/issues/11884)

|    1   | tan(a) |    0   |   0   |
|:------:|:------:|:------:|:-----:|
|    0   |    1   |    0   |   0   |
|    0   |    0   |   1    |   0   |
|   tx   |   ty   |   tz   |   1   ||

According to [www.w3.org/css-transforms](https://www.w3.org/TR/css-transforms-1/#SkewDefined)

Only one differance React Native use **row major matrix style**, so we change ```m[0][1]``` instead ```m[1][0]```.

sahrens vjeux
Closes https://github.com/facebook/react-native/pull/11992

Differential Revision: D4436470

Pulled By: vjeux

fbshipit-source-id: 1b433f04650bae7e06b5a93f521e49f11c70cce3
2017-01-19 11:28:36 -08:00
Gabe Levi e2ce98b7c6 Fix the suppress comment regex for react_native
Reviewed By: davidaurelio

Differential Revision: D4435640

fbshipit-source-id: c680aee6931979859f04c0dca47037ba6f6cba73
2017-01-19 10:28:28 -08:00
Gabe Levi 6ffdd1678e Fix all the flow errors
Reviewed By: bestander

Differential Revision: D4435405

fbshipit-source-id: 888c94e7984d3ca926a4b08b1e3dafe9a2474491
2017-01-19 04:43:38 -08:00
Satyajit Sahoo 72be2d35cc Add selectionColor prop for Text on Android
Summary:
**Motivation**

Customizing the selection color allows to use brand colors in the app. The PR implements a `selectionColor` prop for `Text` component similar to `TextInput`.

**Test plan (required)**

Run UIExplorer example with the changes and verify everything works fine.

![image](https://cloud.githubusercontent.com/assets/1174278/22023258/70197d84-dceb-11e6-8662-2879d78d14d4.png)

cc brentvatne
Closes https://github.com/facebook/react-native/pull/11947

Differential Revision: D4430265

fbshipit-source-id: 462f16548d93ab03aadb27d6f12acf90842627ab
2017-01-18 12:58:44 -08:00
Mehdi Mulani 81c33b542d Switch out DISABLE_YELLOW_BOX for IS_TESTING
Summary: Switch to using IS_TESTING on the Platform module. While IS_TESTING has to be explicitly set in the test harness, this makes it more usable and stops people from relying on brittle variables in the (larger) environment.

Reviewed By: fkgozali

Differential Revision: D4423661

fbshipit-source-id: 27a80867778b9374bcba67b69f9c93d32c0a74b0
2017-01-18 12:28:42 -08:00
Gabe Levi a4bfac907e Deploy v0.38.0
Reviewed By: jeffmo

Differential Revision: D4428858

fbshipit-source-id: 10dc69349a2b563e1fa444a8b0612e3b2d4ccd1c
2017-01-18 11:13:30 -08:00
Andy Street 963e6e9d36 Improve error messages when nesting View in Text
Summary: Since we don't support this, we should throw early. Also tries to improve the error message when adding a node that doesn't have a YogaNode to a node that can't measure itself.

Reviewed By: andreicoman11

Differential Revision: D4421542

fbshipit-source-id: e0be8cdd763091145e5e6af2db91515f4d236b37
2017-01-18 09:28:26 -08:00
Sokovikov 8159b2cd2a return stacktrace button in yellow box
Summary:
**motivation**

return button which shows stacktrace in yellow box.

**Test plan (required)**

<img src="https://cloud.githubusercontent.com/assets/1488195/21954896/fd3b0078-da77-11e6-8eeb-e6fe16ad9939.png" width="300"/>
Closes https://github.com/facebook/react-native/pull/11908

Differential Revision: D4424824

Pulled By: mmmulani

fbshipit-source-id: db4b33423fd839216286adb40a65417949c0073a
2017-01-17 17:43:28 -08:00
Peter Salanki 52d8851fc8 Cache policy control for image source
Summary:
In the context of an app an image exists in three resolutions on the server: `thumb` (30px) `feed` (300px) `full` (900px). When looking at an individual item a user can come either from the feed, via a permalink or from other parts of the app. This allows a situation where the `feed` image might or might not already be loaded somewhere in the app. In the detail view I want to render `thumb` with a blur (to quickly display something), then the `feed` image if it exists to have something decent to display until `full` loads. However it is quite a waste to load the `feed` image if it isn't already in cache, and will slow down the time until `full` is loaded. It is possible to track the navigation from feed->detail and that the `feed` image has actually completed loading by the feed component however as component hierarchies grow this turns into quite a lot of prop passing and bad separation of concerns.

NSURLRequests accepts a [Cache Policy](https://developer.apple.com/reference/fo
Closes https://github.com/facebook/react-native/pull/10844

Differential Revision: D4425959

Pulled By: lacker

fbshipit-source-id: 679835439c761a2fc894f56eb6d744c036cf0b49
2017-01-17 17:13:31 -08:00
Max Sherman a6844bdf75 Break infinite loop that happens only in debug environments
Reviewed By: javache

Differential Revision: D4411870

fbshipit-source-id: 6b141e42206734368ed50f37c8e7df8e8fd006c0
2017-01-17 16:58:46 -08:00
Seph Soliman 6d2ae35bca Added AnimatedValueXY.removeAllListeners
Summary:
> Explain the **motivation** for making this change. What existing problem does the pull request solve?

`AnimatedValueX` has `removeAllListeners()` which is a convenient way to do cleanup when components unmount, but `AnimatedValueXY` was missing a similar method which doesn't really make sense. This change makes the two classes more similar, less confusing and more convenient.
Closes https://github.com/facebook/react-native/pull/11783

Differential Revision: D4397188

fbshipit-source-id: d10a0c9c7e0a83af015ec04f6facf965d95ea984
2017-01-14 14:43:27 -08:00
Spencer Ahrens c7e3819cf4 Propagate prop type flow through StyleContext.createContainer
Reviewed By: blairvanderhoof

Differential Revision: D4394074

fbshipit-source-id: f9c7f71ba921d345e3313a3a2be16a7f85a2e0af
2017-01-13 19:28:28 -08:00
Mehdi Mulani 49d7c00500 Disable yellow box warnings based on environment variable
Summary:
This adds a hook to let you disable yellow box warnings. It's useful for native engineers who don't want to mess with JS but also for CI/testing, where the app operates mostly as a blackbox.

Depends on D4395091

Reviewed By: achen1

Differential Revision: D4395552

fbshipit-source-id: 4c3a9676caa975c537d1a4711d60aab2f404db15
2017-01-13 12:28:31 -08:00
Kevin Lee 09801aac30 fix direction of VerticalSwipeJump gestures
Summary:
When something comes in from the right, we swipe from left to
right to move back. That means, when something comes in from the bottom,
we should swipe from top to bottom to get rid of it. This diff makes that
behavior occur - right now it's somewhat nonsensical as both jumpBack
and jumpForward are mapped to the same gesture.

thanks to #11192 for making gestures work on VerticalUpSwipeJumps

Reviewed By: ericvicenti, shergin

Differential Revision: D4412129

fbshipit-source-id: 6a3b202b0a90ca459b4ef106ba5bf48d0b1aec9e
2017-01-12 17:43:42 -08:00
Dan Hassin dbe555ba78 Include props in new ListView and ScrollView mocks
Summary:
Hi,

The (as of yet unreleased) commit 5537055bf8 added some ListView and ScrollView mocks, but they leave out the original properties passed into them, which broke some of my tests (e.g. by excluding some properties like `testID`, for example, from the render tree) and I assume might break others' as well.

This PR makes it so the ListView mock directly returns the scroll component (instead of wrapping it in a View), and has ListViewMock and ScrollViewMock pass their given properties through.
Closes https://github.com/facebook/react-native/pull/11847

Differential Revision: D4408497

Pulled By: sahrens

fbshipit-source-id: 7ec01c35d6b8efeb97761cddffdb4075d09c7d70
2017-01-12 10:58:29 -08:00
Albert Brand d2de604721 Android: fix JSC crash in dev
Summary:
On Android with dev mode on, we're seeing a regular SIGSEGV when pushing a lot of animation declarations over the bridge. We tracked this down to being not specific to animations, but the crash is caused in `deepFreezeAndThrowOnMutationInDev`.

Specifically: the provided object to freeze is modified while looping, replacing the current key access to a getter/setter. After the modification, JSC crashes during retrieval of the next key - but only when there are a lot of events passing over the bridge.

We have a hunch that this is due to a bug in JSC object enumeration but did we not look into it further yet. Any help here is welcome. The JS code seems all right at first sight and shouldn't cause a segmentation crash.

The workaround in this PR is to retrieve the keys first from the object and then looping over that array. In our app and in a reduced app test case this fixes the crash.

If needed I can provide the reduced app test case. It's really tricky to make a test for this as it requires to be run
Closes https://github.com/facebook/react-native/pull/11804

Differential Revision: D4403483

Pulled By: davidaurelio

fbshipit-source-id: a31e5cff734e96bfec56e4a39dc1c6854798e245
2017-01-11 08:58:30 -08:00
Emil Sjolander 3f49e743be Add percentage support to react native
Summary:
Adds support for percentage value in react native.

syntax: property: 100 | property | '100%'

supported properties:
padding
margin
width
height
minWidth
minHeight
maxWidth
maxHeight
flexBasis

```
class Playground extends React.Component {
  render() {
    return (
      <View style={{backgroundColor: 'white', padding: 10, paddingTop: 30, height: '100%'}}>
        <Text>
          If you want to quickly test out something,
          open the Playground.js file and start coding.
        </Text>
        <View style={{backgroundColor: 'red', height: 50, width: 50}}/>
        <View style={{backgroundColor: 'blue', height: '50%', width: '50%'}}/>
      </View>
    );
  }
}
```

Reviewed By: astreet

Differential Revision: D4376549

fbshipit-source-id: c41d68a7555396f95d063a7527ee081773ac56dc
2017-01-11 03:58:37 -08:00
Paul Mestemaker fa3c06d637 Update AlertIOS.js
Summary:
This fixes a broken link in the docs.
Closes https://github.com/facebook/react-native/pull/11453

Differential Revision: D4394773

Pulled By: lacker

fbshipit-source-id: 07b3aaa25017912063ac9e65f336c56a902d7144
2017-01-09 15:28:31 -08:00
Matt Oakes 55427566b6 Add a prop to toggle ListView sticky section headers
Summary:
Hello,

This PR adds a property to the `ListView` to enable and disable to sticky sections headers behaviour. Current this is enabled by default and there is no way to disable it. It has been previously discussed in #1974 where there was a suggestion to add the `ListView` inside `ScrollView`. This is bad for performance, but some people were using that as a workaround. satya164 suggested someone submitting a PR, which is why I'm here 😉

I have tested the property manually by adding `stickySectionHeaders={false}` to the `<ListView> Paging` example in `UIExplorer`. I have also tested that the current behaviour still stands, so this is a non-breaking change.

I have also checked that the website displays the new documentation.

I couldn't see anywhere to add automated tests to this, but if there is feel free to point it out and I'll update this PR.

I tried running `npm run lint` to check the code style, but it spat out loads and loads of errors. I presume I have something set up incorrectly. Feel
Closes https://github.com/facebook/react-native/pull/11700

Differential Revision: D4380916

fbshipit-source-id: 7782043afc9f0108c81f97952fed60b153479cac
2017-01-09 03:13:28 -08:00
Gabriel Reis 5fdd6b33fa Add testID prop to Button component
Summary:
This PR adds the `testID` prop to the `Button` component in order to allow end-to-end tests.
Closes https://github.com/facebook/react-native/pull/11526

Differential Revision: D4392137

Pulled By: ericvicenti

fbshipit-source-id: d3f864aacee319e520af226cd063edef452f6fc8
2017-01-09 02:43:35 -08:00
alekhurst 55ce19d84e Change gesture direction strings in NavigatorSceneConfigs
Summary:
I see there is a string matching inconsistency in  `Libraries/CustomComponents/Navigator/Navigator.js` and `Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js`, which caused a bug resulting in gestures not working for vertical SceneConfigs. This PR fixes the inconsistency, and the bug.

**Motivation for making this change**
When working with the navigator, I was using the `VerticalUpSwipeJump` Navigator SceneConfig. The gesture to pop to the previous scene (in this case `jumpBack`) was not working.

**How I tested?**
I changed these strings (as shown in this PR) and swiped down. After these changes, everything worked as expected.

**Example**
In `Libraries/CustomComponents/Navigator/Navigator.js`, we check for gesture direction strings `bottom-to-top` and `top-to-bottom` in multiple places, but nowhere do we ever check for `up-to-down` and `down-to-up`.

```
var isTravelVertical = gesture.direction === 'top-to-bottom' || gesture.direction === 'bottom-to-top';
var isTravelInverted =
Closes https://github.com/facebook/react-native/pull/11192

Differential Revision: D4392103

Pulled By: ericvicenti

fbshipit-source-id: fd80578031f94b1b409815481c82e481c7ff2f13
2017-01-09 01:43:33 -08:00
Peter Juras 9338fbd781 Update PermissionsAndroid docs to use new APIs
Summary:
It seems that the `requestPermission` and `checkPermission` APIs from PermissionsAndroid have been deprecated in react-native 0.40.0., but they are still used in the description and example.

This commit updates the description and the example to use the new APIs.
Closes https://github.com/facebook/react-native/pull/11722

Differential Revision: D4392031

Pulled By: ericvicenti

fbshipit-source-id: e3ceebb1ef557e05dab40bb883013be4ec80bed6
2017-01-09 00:43:31 -08:00
cailenmusselman 407973ab27 Fix z-index of YellowBox
Summary:
In Android, components using an elevation > 0 are able to hide the YellowBox. Especially bad when they happen to hide the dismiss button of the inspector.
Closes https://github.com/facebook/react-native/pull/11777

Differential Revision: D4392027

Pulled By: ericvicenti

fbshipit-source-id: 96ab98520cd54b9bb683d984f9990bf0e90b9a37
2017-01-09 00:28:37 -08:00
Emil Sjolander 976abf87f2 Add baseline alignment support
Summary:
Add baseline alignment support to react native.

{F65372439}

```
class Playground extends React.Component {
  render() {
    return (
      <View style={{padding: 30, flexDirection: 'row', alignItems: 'baseline'}}>
        <View style={{width: 30, height: 10, backgroundColor: 'red'}}/>
        <View style={{width: 30, height: 20, backgroundColor: 'green'}}/>
        <View style={{width: 30, height: 30, backgroundColor: 'blue'}}/>
      </View>
    );
  }
}
```

Reviewed By: javache

Differential Revision: D4385099

fbshipit-source-id: d7caa6e4c086c4a62e24ef1d5db9c805c470ef2a
2017-01-08 04:43:31 -08:00
Spencer Ahrens 3b5f04b002 Revert D4385443: [RCT/AppContainer] Don't capture touches
Differential Revision: D4385443

fbshipit-source-id: 87f4c0a19ddf02fb02472de91000cfc5c93bcb52
2017-01-07 16:28:29 -08:00
Luke Miles da9a712a9e Add a injectJavaScript method to the WebView component
Summary:
Currently, < WebView > allows you to pass JS to execute within the view. This works great, but there currently is not a way to execute JS after the page is loaded. We needed this for our app.

We noticed that the WebView had messaging support added (see #9762) . Initially, this seemed like more than enough functionality for our use case - just write a function that's injected on initial load that accepts a message with JS, and `eval()` it. However, this broke once we realized that Content Security Policy can block the use of eval on pages. The native methods iOS provide to inject JS allow you to inject JS without CSP interfering. So, we just wrapped the native methods on iOS (and later Android) and it worked for our use case. The method injectJavaScript was born.

Now, after I wrote this code, I realized that #8798 exists and hadn't been merged because of a lack of tests. I commend what was done in #8798 as it sorely solves a problem (injecting JS after the initial load) and has more features than what I'
Closes https://github.com/facebook/react-native/pull/11358

Differential Revision: D4390425

fbshipit-source-id: 02813127f8cf60fd84229cb26eeea7f8922d03b3
2017-01-06 20:29:02 -08:00
Sean Kinsey 3d1bdcc2e3 Don't capture touches
Summary:
RCTRootView supports a property `passThroughTouches` which when set, allows
touches to propagate to sibling views. To allow touches to reach RCTRootView,
we also need to set `pointerEvents` on the RCTViews wrapping the child views.

Reviewed By: javache

Differential Revision: D4385443

fbshipit-source-id: 6291d8614870168f1c4cdf0ef5ff6e42e4a8ef63
2017-01-06 18:58:30 -08:00
Sokovikov e8a45c96a7 fix crash on reload during animation
Summary:
closes #11719

**Test plan (required)**

Cmd+r during native animation in uiexplorer
Closes https://github.com/facebook/react-native/pull/11720

Differential Revision: D4386449

fbshipit-source-id: a7b5ea2c77de260e8b95b5983438f9cef4d1d752
2017-01-05 21:59:19 -08:00
Drew Volz 5ba0bb287d Typo in imageResizeMode getSize
Summary:
Change "sucessfully" to "successfully"
Closes https://github.com/facebook/react-native/pull/11715

Differential Revision: D4380482

Pulled By: JoelMarcey

fbshipit-source-id: 2448d60b750cca0983d308945ad6ed9b46c73a97
2017-01-04 02:43:30 -08:00
Spencer Ahrens 21ba956560 Fix inspector overflow
Summary:
Puts hierarchy and other inspector data in a fixed height scrollview so it never takes up
too much space and you can always scroll to see everything you want.

Reviewed By: fkgozali

Differential Revision: D4374819

fbshipit-source-id: 89356670c984c693db345ad66a97d4cb54a98aee
2017-01-03 13:43:35 -08:00
Lukas Woehrl 16359ec8ee Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.

You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.

I did some benchmarks:

```
Without Percentage Feature - Release x86:

Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms

Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms

With Percentage Feature - Release x86:

Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258

Reviewed By: dshahidehpour

Differential Revision: D4361945

Pulled By: emilsjolander

fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:28:30 -08:00
Michal Srb 5df227f42c Fix onKeyPress documentation of TextInput
Summary:
Only tested on iOS.
Closes https://github.com/facebook/react-native/pull/11621

Differential Revision: D4374415

Pulled By: mkonicek

fbshipit-source-id: b686d0480b8db181dae46a94e9d1b88eab488074
2016-12-29 16:58:33 -08:00
Mehdi Mulani 199d64083c Stop throwing yellew boxes when we warn from native
Summary: This caused a bunch of stuff to break, reverting and will fix the problems before committing next time.

Reviewed By: fkgozali

Differential Revision: D4363398

fbshipit-source-id: 55146c9da998f6a3883307c36422a9d440ea7f52
2016-12-27 10:43:33 -08:00
Michal Srb 1b694f43ba Update docs on TextInput:style to point to relevant issue
Summary:
Bandaid for #7070. Until this is fixed, the docs should at least be honest the state they're in, so people don't have to go search and wonder.
Closes https://github.com/facebook/react-native/pull/11626

Differential Revision: D4366925

Pulled By: mkonicek

fbshipit-source-id: 082a8a9916ad0f8fbb2955cffbf61142fa2a98a1
2016-12-26 03:58:30 -08:00
Héctor Ramos 94d4db720d Add iOS permission information to CameraRoll.js
Summary:
As of iOS10 permission is required to access user photos and their galleries, I felt this really needed to be addressed. I hope to create a section dedicated to iOS permissions soon.
Closes https://github.com/facebook/react-native/pull/11259

Differential Revision: D4364354

Pulled By: hramos

fbshipit-source-id: 97bdeb09deba01995eebd038e00ccc84b08281c9
2016-12-22 17:13:31 -08:00
Horcrux 5f8d7ac618 fix Touchables inspector
Summary:
Fix TouchableWithoutFeedback throw error when touchables inspector is shown in react@15.4.0:
`Attempted to assign to readonly property`
![image](https://cloud.githubusercontent.com/assets/7693239/20824463/14f7bfc8-b898-11e6-9bc3-50434492ee40.png)

Convert children into an array by using React.Children.toArray.
Closes https://github.com/facebook/react-native/pull/11262

Differential Revision: D4329147

fbshipit-source-id: 38c9f78b5a81964efccacc7a08b66dda7acb7dc5
2016-12-22 16:28:34 -08:00
Dan Hassin c8a7f9e2d1 Support custom card style interpolators
Summary:
Transition animations are not very customizable right now with NavigationExperimental, unless I am missing something big. This PR allows NavigationCardStack to receive the `horizontalCardStyleInterpolator` and `verticalCardStyleInterpolator` props to override the default interpolators.

See the gif, transition animation changes from the default one (with scale) to a custom one (without scale) when passing in a custom interpolator. (The custom interpolator is an exact copy of the one in `NavigationCardStackStyleInterpolator.forHorizontal`, minus the scale transform.)

![cmz0gagoec](https://cloud.githubusercontent.com/assets/1389312/20552499/af33667c-b119-11e6-97e7-bea9986a58e0.gif)

Let me know if there's a robust way to test, but I couldn't find anything.

**To address**
The new `canUseNativeDriver` function on NavigationCardStackStyleInterpolator, which returns `true`, is dependent on the interpolator, so custom interpolators may need to falsify this. Didn't include it on the first pass since I wasn
Closes https://github.com/facebook/react-native/pull/11082

Differential Revision: D4362540

Pulled By: ericvicenti

fbshipit-source-id: 2ebd0047c147ac3d6c43ce880661c99de8fd0880
2016-12-22 11:13:27 -08:00
Spencer Ahrens 5537055bf8 Add some `Fake`s for easier interaction snapshot testing
Summary:
`Fake` components are simplified so snapshots are stable and reliable, and references are exported
so that interactions like `onRefresh` and `onScroll` can be called manually. Currently there is just
one global export for each class, but we may change this in the future if we need to manage multiple
`Fake`s of the same type in one render tree.

Right now these must be installed explicitly, but I might move them into `__mocks__` folders if it
seems reasonable to make them defaults.

Reviewed By: cpojer

Differential Revision: D4318207

fbshipit-source-id: 62802353a98b09ca1c80804ef7201ea63091f94a
2016-12-20 15:58:30 -08:00
Libin Lu 550469bb82 Expose pressRetentionOffset for Text
Summary:
expose this property to make Text having same property like TouchableHighlight
Closes https://github.com/facebook/react-native/pull/11473

Differential Revision: D4348825

fbshipit-source-id: 941bcc681139d4460f52fed5174be1d2381462c7
2016-12-19 15:58:39 -08:00
Mehdi Mulani ac11eedfb0 Show yellowbox when we fail to load a local image
Reviewed By: achen1

Differential Revision: D4342295

fbshipit-source-id: 9411ffe9a376e1ed51fcadee718326d1d9443fff
2016-12-19 14:07:08 -08:00
Pieter De Baets c92ad5f6ae Apple TV support 4: support for input (tvOS focus engine)
Reviewed By: shergin

Differential Revision: D4333546

fbshipit-source-id: 8655070e81dbb62a80ab1f00a43ef6c2d9654618
2016-12-19 06:28:40 -08:00
Alan Norbauer 4aabf4b6b3 Replace jest.resetModuleRegistry() with jest.resetModules()
Reviewed By: cpojer

Differential Revision: D4344961

fbshipit-source-id: 45453ec7ee3211743946ab9156f51430322b5832
2016-12-18 17:13:38 -08:00
Kevin Lacker 9f3ef48f65 Added info about a cancelable option for Alerts on Android.
Summary:
In the 8e2906ae89 commit there was implemented a cancelable option for Alerts. It wasn't clear from the docs about this option and the additional Alert method's parameter.
Closes https://github.com/facebook/react-native/pull/11292

Differential Revision: D4342707

Pulled By: lacker

fbshipit-source-id: dc243b868106e705040e77bc90d4d9b8c2dc26eb
2016-12-16 16:28:31 -08:00
Leland Richardson 71f32fb5a3 Fix documentation for scrollResponderScrollNativeHandleToKeyboard
Summary:
I'm pretty sure this is supposed to be "bottom" as opposed to "top", as it's the offset from the keyboard, which is at the bottom of the screen.
Closes https://github.com/facebook/react-native/pull/11446

Differential Revision: D4339957

Pulled By: lacker

fbshipit-source-id: 62dca544a0167704d76cd972c44570f277ea63aa
2016-12-16 15:13:36 -08:00
tychota 25cd2c5d7b Deprecate RecyclerViewBackedScrollView
Summary:
cc brentvatne

potential reviewers mkonicek and kmagiera

**Motivation for making this change.**

The previous PR was closed : #11095 but the followup actions was never done

I reopened a really similar one so it get merged
RecyclerView is no more used at Facebook (according to previous PR)

According to brentvatne, their were two motivations for RecyclerView:
* ListView with ScrollView component used to bounce back on row insert, but this is now fixed
* This made possible to implement certain performance improvements, but the maintenance cost was not worth the risk

With RN 0.37, the actual code in React Native make the app crash:
- see #10560

I spend one hour investigating this and did also require brent time at exponent slack. I think other people are struggling too.

**Test plan**

<img width="708" alt="screen shot 2016-12-13 at 23 42 22" src="https://cloud.githubusercontent.com/assets/13785185/21162483/dbeb642e-c18d-11e6-9c32-1fe73f1826c1.png">

**Code formatting**

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

Differential Revision: D4340640

Pulled By: mkonicek

fbshipit-source-id: 64c5cf060f2eb035d4d6199b30f0e73afc520180
2016-12-16 12:28:36 -08:00
pedramsaleh 20938ae88c Fixed typo in docs.
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/11459

Differential Revision: D4339946

Pulled By: lacker

fbshipit-source-id: d95e7c62dbf7bf6fd2ab3739b3d64bfcbe83e24a
2016-12-16 10:28:34 -08:00
Adam Comella c0ea23cfb0 Android: Expose textBreakStrategy on Text and TextInput
Summary:
Android has a text API called breakStrategy for controlling how paragraphs are broken up into lines. For example, some modes support automatically hyphenating words so a word can be split across lines while others do not.

One source of complexity is that Android provides different defaults for `breakStrategy` for `TextView` vs `EditText`. `TextView`'s default is `BREAK_STRATEGY_HIGH_QUALITY` while `EditText`'s default is `BREAK_STRATEGY_SIMPLE`.

In addition to exposing `textBreakStrategy`, this change also fixes a couple of rendering glitches with `Text` and `TextInput`. `TextView` and `EditText` have different default values for `breakStrategy` and `hyphenationFrequency` than `StaticLayout`. Consequently, we were using different parameters for measuring and rendering. Whenever measuring and rendering parameters are inconsistent, it can result in visual glitches such as the text taking up too much space or being clipped.

This change fixes these inconsistencies by setting `breakStrategy` and `hyphenat
Closes https://github.com/facebook/react-native/pull/11007

Differential Revision: D4227495

Pulled By: lacker

fbshipit-source-id: c2d96bd0ddc7bd315fda016fb4f1b5108a2e35cf
2016-12-16 01:28:45 -08:00
zongjingyao eba356fb13 result in RCTAsyncStorage.multiGet could be null.
Summary:
App will crash if result is null.
Closes https://github.com/facebook/react-native/pull/10338

Differential Revision: D4335305

Pulled By: lacker

fbshipit-source-id: 4910bfd7c56525a2ef1b252b56b8debd21fa2bae
2016-12-15 22:43:30 -08:00
Neo 4cb8a852a1 fix typo
Summary: Closes https://github.com/facebook/react-native/pull/11249

Differential Revision: D4338083

Pulled By: lacker

fbshipit-source-id: bc997c9fb0c4af0667234d4920ea9a73ac86d2fb
2016-12-15 21:13:38 -08:00
Steven Goff 4394419b60 Android Text component allowFontScaling
Summary:
The reason for this change is to implement `allowFontScaling` on the Android's React Native Text component.  Prior to this PR `allowFontScaling` only works for iOS.

The following link contains images of `allowFontScaling` working in Android on small, normal, large, and huge system fonts (from native Android display settings)

http://imgur.com/a/94bF1

The following link is a video of the same thing working on an Android emulator

https://youtu.be/1jTlZhPdj9Y

Here is the sample code snippet driving the video/images
```
render() {
    const size = [12, 14, 16, 18];
    return (
      <View style={{backgroundColor: 'white', flex: 1}}>
        <Text>
          Default size no allowFontScaling prop (default true)
        </Text>
        <Text allowFontScaling={true}>
          Default size allowFontScaling: true
        </Text>
        <Text style={{ marginBottom: 10, }} allowFontScaling={false}>
          Default size allowFontScaling: false
        </Text>

        { size.map(
Closes https://github.com/facebook/react-native/pull/10898

Differential Revision: D4335190

Pulled By: lacker

fbshipit-source-id: 0480809c44983644ff2abfcaf4887569b2bfede5
2016-12-15 17:43:35 -08:00