Commit Graph

957 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Alex Kotliarskyi 41f2169629 Improve TouchableOpacity
Summary:
I was comparing `<TouchableOpacity>` to `UIButton` in iOS and it just doesn't feel native. The initial delay was fixed by https://github.com/facebook/react-native/pull/10866 but still there is a lag between button release and animation.

I'm also not sure what `_hideTimeout` was used for. When logging `touchableHandle*` events looks like `touchableHandleActivePressIn` is called first, then `touchableHandleActivePressOut` and then `touchableHandlePress`. Which means the fade in animation from `touchableHandleActivePressOut` was interrupted by `touchableHandlePress`.

Reviewed By: vjeux

Differential Revision: D4309789

fbshipit-source-id: b6d4df544952e11c2ade97d860531cbb2fada36b
2016-12-13 11:28:30 -08:00
Maxime Lapointe d56530d7d5 Reworking keyboardShouldPersistTaps to have a middle ground
Summary:
Right now, the ScrollView's keyboard hiding behavior is either all or nothing: Hide the keyboard on any tap, or do nothing ever. This PR introduces a third mode to keyboardShouldPersistTaps which is much closer to what I consider should be the default.

In the new behavior, the tap responding is done in the bubbling phase (instead of the capture phase like =true). As a result, a child can handle the tap. If no child does, then the ScrollView will receive the tap and will hide the keyboard. As a result, changing TextInput focus works as a user expects, with a single tap and without keyboard hiding. But taping on Text or on the empty part of the ScrollView hides the keyboard and removes the focus.

You can view the behavior in a monkey patched ScrollView demo on rnplay:
https://rnplay.org/apps/E90UYw
https://rnplay.org/apps/UGzhKA

In order to have a uniform props set, i added 3 values to the keyboardShouldPersistTaps:
'never' and 'always' are the same as false and true.
'handled' is the new behavior.

I don't
Closes https://github.com/facebook/react-native/pull/10628

Differential Revision: D4294945

Pulled By: ericvicenti

fbshipit-source-id: 1a753014156cac1a23fabfa8e1faa9a768868ef2
2016-12-07 21:43:35 -08:00
Martin Konicek 3ab508e99a Upselling ListView in ScrollView's docs
Summary:
Internal research at FB has shown that many devs don't know why they should use ListView instead of ScrollView, or that ListView even exists. This PR changes ScrollView's docs to upsell ListView.

I could put this as a separate guide in the docs, but I think this place will have the best possible reach for target audience.

Suggestions welcome. Let me know if it doesn't make sense or is too verbose.
Closes https://github.com/facebook/react-native/pull/11349

Differential Revision: D4292109

Pulled By: mkonicek

fbshipit-source-id: e4a14e5a55333c9282d0e407461505e71e850b20
2016-12-07 10:43:48 -08:00
Jake Dawkins 6234a5dfa2 Fix iOS Picker Item Colors
Summary:
I want to resolve #11170 by passing the `color` prop from `PickerIOS.Item` to its implementation.

In `RCTPicker.m`, the label.textColor was already being set and used, but there was nothing referencing the past prop. I passed the prop to the implementation, checked if it exists, and if not, set the default color, like before.

I visually tested the **Colorful Pickers** example in UIExplorer. Those picker `Item`s pass in a `color` prop.

![dec-01-2016 22-07-46](https://cloud.githubusercontent.com/assets/9259509/20821696/ae45d704-b812-11e6-9720-0045d6c0bcd4.gif)

The basic picker does not pass the color prop to the picker `Item`, and there are no errors. Basic functionality is still in tact:

![dec-01-2016 22-09-35](https://cloud.githubusercontent.com/assets/9259509/20821730/ee544f74-b812-11e6-9294-a1b45e78d9f7.gif)
Closes https://github.com/facebook/react-native/pull/11260

Differential Revision: D4272370

fbshipit-source-id: 5fa33c40526dda59ca2ab527c31351bcd27e5cf3
2016-12-03 18:58:29 -08:00
Gaëtan Renaudeau 20e99f5b93 Fix invariant in scrollResponderZoomTo
Summary:
This fixes a cryptic bug to appear when you try to use scrollResponderZoomTo in Android.
before this PR it would break with a `Error: TaskQueue: Error with task : invariant requires an error message argument` because the invariant() was not properly used..

Also, instead of detecting the platform, I think it's better practice to duck type.
Closes https://github.com/facebook/react-native/pull/11186

Differential Revision: D4246674

fbshipit-source-id: 47002a85d8252e5abbd1cd9ecef3d7676fa8615a
2016-11-29 14:43:38 -08:00
Sokovikov 837814240b unselectedItemTintColor property available since iOS10
Summary:
**motivation:**

make possible to use new tab bar property.

![1475603157804](https://cloud.githubusercontent.com/assets/1488195/19085757/8b7cc8a4-8a7c-11e6-82c7-7c76313fb545.jpg)

It is not working for previous versions but not failing.
https://developer.apple.com/reference/uikit/uitabbar/1648949-unselecteditemtintcolor
Closes https://github.com/facebook/react-native/pull/10241

Differential Revision: D4168046

Pulled By: mmmulani

fbshipit-source-id: aa0c9b36cbdbc50a9a60bbbc658355c3066ba1a5
2016-11-29 12:28:55 -08:00
Sokovikov a50bafa678 badgeColor property
Summary:
**motivation:**

make possible to use new tab bar item property

![1476033023249](https://cloud.githubusercontent.com/assets/1488195/19222245/f4c1292c-8e64-11e6-8a29-7b95b45e153c.jpg)
Closes https://github.com/facebook/react-native/pull/10315

Differential Revision: D4000011

Pulled By: mmmulani

fbshipit-source-id: 5c00b0b5f56c551cc4151fcc030da6c8bc1a3649
2016-11-29 11:43:31 -08:00
Janic Duplessis 552c601921 Don't dismiss keyboard when tapping another text input
Summary:
When using text inputs inside a ScrollView with `keyboardShouldPersistTaps=false` (default behavior) tapping another text input dismisses the keyboard instead of keeping it open and focusing the new text input which I think is the better and expected behavior.

See #10628 for more discussion about that. Note that this affects nothing but the behavior with text inputs unlike #10628.

cc satya164 MaxLap ericvicenti
Closes https://github.com/facebook/react-native/pull/10887

Differential Revision: D4178474

Pulled By: ericvicenti

fbshipit-source-id: 0c62ea2fac0017d559d1f8674b0a686a5e1b3d2d
2016-11-25 05:43:30 -08:00
Adam Comella 0e55f5b26d iOS: Introduce spellCheck prop to TextInput
Summary:
This exposes iOS's spellCheckingType functionality to JavaScript. The native functionality is a three state enum. It gets exposed to JavaScript as a boolean. The initial value and JS null map to the third state.

An alternative design for this API would have been to expose a three state enum to JavaScript:
  - "on" which maps to UITextSpellCheckingTypeYes
  - "off" which maps to UITextSpellCheckingTypeNo
  - "auto" (default) which maps to UITextSpellCheckingTypeDefault

For consistency, I decided to use the same API design as spellCheck. We don't have many options for fixing spellCheck in #11055 without introducing a breaking change.

**Test plan (required)**

Verified that switching `spellCheck` between `true`, `false`, and `null` all work correctly in single line and multiline `TextInputs`.
Closes https://github.com/facebook/react-native/pull/11056

Differential Revision: D4232802

Pulled By: javache

fbshipit-source-id: 79e03307fa6a30a169f7e2fd0ec5ac826663e7c1
2016-11-25 04:28:28 -08:00
Adam Comella 1b870d2019 Android: Add disableExtractUI prop to TextInput on Android
Summary:
On Android, if there is a small amount of space available around a text input (e.g. landscape orientation on a phone), Android may choose to have the user edit the text inside of a full screen text input mode. This behavior isn't always desirable. For example, if your app offers some UI controls for controlling the formatting of the text, you want the controls to be visible while the user is editing the text. This Android feature conflicts with that desired experience because the UI controls would be hidden while the text is being edited.

The `disableExtractUI` prop enables developers to choose whether or not Android's full screen text input editing mode is enabled. When this prop is true, Android's `IME_FLAG_NO_EXTRACT_UI` flag is passed to the `setImeOptions` method.

**Test plan (required)**

Verified `disableExtractUI` works for both `true` and `false` values in a test app.

My team is also using this change in our app.

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

Differential Revision: D4226483

Pulled By: mkonicek

fbshipit-source-id: 8f1055f6e612b05bafabe6f07a3705dd8788e3da
2016-11-23 06:43:50 -08:00
Pandiarajan Nagarajan eaccd7e82e Android datepicker mode configurations added
Summary:
Currently, The **DatePickerAndroid** component opens the native date picker with default mode. We can't able to change the mode via configurations. To support android **[date-picker mode](https://developer.android.com/reference/android/widget/DatePicker.html)**, existing component needs to be changed.

**For Android >= 5.0**, The DatePickerDialog doesn't provide the default method to change the mode of a date picker.  So I have added custom theme which will support two kinds of **mode('spinner','calendar')** ref:https://developer.android.com/reference/android/R.attr.html#datePickerStyle.

**For Android < 5.0,** The DatePickerDialog provides the default method to change the mode of a date picker. ref:https://developer.android.com/reference/android/widget/DatePicker.html#setCalendarViewShown(boolean).

With the help of **Build.VERSION.SDK_INT** I have done the above functionality with limited lines of code changes and also I have added the example to UIExplorer.

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

Differential Revision: D4176089

Pulled By: ericvicenti

fbshipit-source-id: 7dfa9101214501ac2124bda7ee273a538f04e7cf
2016-11-23 04:58:31 -08:00
Adam Comella c609aee733 iOS: Add onScroll event to TextInput
Summary:
Corresponding Android PR: https://github.com/facebook/react-native/pull/11001

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/11002

Differential Revision: D4203565

Pulled By: ericvicenti

fbshipit-source-id: 7cb5e10325c3b03c6b395cce0f1bacb0528db40a
2016-11-22 11:58:37 -08:00
Tim Yung 23331df5a4 RN: Cleanup OSS JS & Flow Declarations
Reviewed By: vjeux

Differential Revision: D4210763

fbshipit-source-id: 5abaa547100b8badd13bcf311ceffc5b4098d252
2016-11-20 17:58:29 -08:00
Justin d643eed0f0 Update grammar in TouchableWithoutFeedback.js
Summary:
> Explain the **motivation** for making this change. What existing problem does the pull request solve?

When I'm referring to the `TouchableWithoutFeedback` documentation, I keep noticing this missing 's'.
Closes https://github.com/facebook/react-native/pull/11037

Differential Revision: D4211726

Pulled By: ericvicenti

fbshipit-source-id: 32adf03ec37733128039e064b8fdfa8b817e4a01
2016-11-20 15:28:31 -08:00
Don Yu 1835dbea7b Add in support for showing annotation callouts by default without the user clicking on the pins
Reviewed By: mmmulani

Differential Revision: D4209555

fbshipit-source-id: 38c2459f9bec0dd2279cf673bcb22aef15748347
2016-11-20 00:58:28 -08:00
Linmic 39c18186e1 Fix redundant styles on RefreshControl for Android
Summary:
Fixed a bug that RefreshControl wrongly apply redundant styles on Android, this solves #10742
Closes https://github.com/facebook/react-native/pull/10899

Differential Revision: D4176670

fbshipit-source-id: 357bfd726a39fe8e79d4d70ddfdfd1d39034620e
2016-11-14 17:58:58 -08:00
Slavik Manukyan ec6e274172 relativeKeyboardHeight works wrong in some cases
Summary:
relativeKeyboardHeight calculation is wrong when frame.y < keyboardFrame.y

Let's look at an example:

``` jsx
import React, { Component } from 'react';
import {
  KeyboardAvoidingView,
  TextInput,
  AppRegistry,
  Text,
  View
} from 'react-native';

export default class Test extends Component {
  constructor(props, context) {
    super(props, context);
  }

  render() {
    return (
      <View style={{flex: 1, marginTop: 20}}>
          <Text style={{ flex: 1, alignItems: 'center'}}>
            Hi! This is test.
          </Text>

          <KeyboardAvoidingView behavior={'position'} keyboardVerticalOffset={-20} >
            <TextInput
              style={{height: 40, borderColor: 'gray', borderWidth: 1}}
            />
          </KeyboardAvoidingView>
      </View>
    );
  }
}

AppRegistry.registerComponent('Test', () => Test);
```

![rn-relativekb](https://cloud.githubusercontent.com/assets/13254349/17298119/b2192830-5819-11e6-968c-d9e95b6e4aba.gif)

How _relativeKeyboardHeight_ calculates positio
Closes https://github.com/facebook/react-native/pull/9139

Differential Revision: D4168431

Pulled By: hramos

fbshipit-source-id: 9181276355490452071b51b51ed7dc9ab80b2444
2016-11-14 11:58:58 -08:00
Aria Buckles fa8c536b31 TouchableOpacity: Respond instantly to first touch
Summary:
On iOS, when you press down native fading components, they become
transparent instantly, but then have an animated fade in/out if you
move your finger in/out of their hit box.

On react-native currently, the touchdown fades, instead of providing
instant feedback, which doesn't feel right on iOS.

I'm less familiar with Android conventions, but it seems to use fading
components for buttons less often, instead using the ripple effect from
TouchableNativeFeedback. In either case, instant feedback seems better
for the user.
Closes https://github.com/facebook/react-native/pull/10866

Differential Revision: D4175854

Pulled By: hramos

fbshipit-source-id: d993231074e8190cf4ba7ca86dc24299f05d5d8f
2016-11-14 09:43:34 -08:00
Daniel Nagy b7889e028b Expose NavigatorIOS::replaceAtIndex
Summary:
The React Native docs list `replaceAtIndex` as a public method of the **NavigatorIOS** component but it is never exposed.
Closes https://github.com/facebook/react-native/pull/10577

Differential Revision: D4168180

Pulled By: hramos

fbshipit-source-id: 6d91d9de8404bb229930d804f8b01b324ec16f24
2016-11-11 12:58:35 -08:00
Thomas Beverley b6a38e80e0 Expose setAllowUniversalAccessFromFileURLs in Android WebView
Summary:
This pull request exposes the `setAllowUniversalAccessFromFileURLs` method of Android WebViewSettings as a property. The reason for this is when loading pages with a `file://` baseUrl it's sometimes desirable to allow loading other assets from a file base url. (For example loading an image into a canvas). More information on its use and purpose can be found [in the android docs here](https://developer.android.com/reference/android/webkit/WebSettings.html#setAllowUniversalAccessFromFileURLs%28boolean%29)

Usage example:

``` jsx
return (
  <WebView
    source={{ html: myhtml, baseUrl: 'file://' }}
    allowUniversalAccessFromFileURLs={true}
    javaScriptEnabled={true} />
)
```
Closes https://github.com/facebook/react-native/pull/8905

Differential Revision: D4147245

Pulled By: hramos

fbshipit-source-id: 7eaa884b8c0268de52b284954a34acec0fbd4061
2016-11-08 08:43:38 -08:00
Adam Dierkens f276425ab8 Stop other views from stealing the responder from PickerIOS and DatePickerIOS
Summary:
Similar to 52ddfd9b51 the `DatePickerIOS` and `PickerIOS` components need to stop the propagation of swiping gestures in order to prevent other views from responding to them.

This is most noticable when placed inside a modal behind a scrollView.

<table>
    <tr>
        <td>Before</td>
        <td>After</td>
    </tr>
    <tr>
        <td>
            <img src="https://cloud.githubusercontent.com/assets/13004162/20035981/ad8b97f6-a3b6-11e6-957c-2d3048e0e78b.gif" />
        </td>
        <td>
            <img src="https://cloud.githubusercontent.com/assets/13004162/20036025/e7206766-a3b7-11e6-8630-492f8092f3d4.gif" />
        </td>
    </tr>
</table>
Closes https://github.com/facebook/react-native/pull/10768

Differential Revision: D4142351

Pulled By: spicyj

fbshipit-source-id: 22395aefaf46179bf2f77031c329209d4c33ee71
2016-11-07 18:13:53 -08:00
Ben Griffith a609d1c2b7 Add currentHeight constant to status bar docs
Summary:
This PR is to fix #10561 by adding `currentHeight` to a list of constants for the `StatusBar` component. It also makes it clear that this constant is Android only by also adding a further note to the example use.

Closes #10561

![screen shot 2016-11-01 at 12 37 06](https://cloud.githubusercontent.com/assets/2854338/19889978/f453d43a-a02f-11e6-859e-5a9ebeba9d44.png)
Closes https://github.com/facebook/react-native/pull/10675

Differential Revision: D4137353

fbshipit-source-id: 717494fe78f8eb55c55447d6567ec8bcd0be86d3
2016-11-05 17:13:29 -07:00
Martin Konicek 1605276801 Remove open source deprecation warning from MapView
Summary: The warning is only relevant to open source RN but shown to employees too.

Reviewed By: fkgozali

Differential Revision: D4137216

fbshipit-source-id: 21d5c3051c7964231eeb3f555681a83eacb4c972
2016-11-05 14:13:36 -07:00
Phillip Johnsen cb67d16aee StatusBar: fix incorrect setHidden(hidden) docs description
Summary:
Hi!

Just noticed an incorrect description for the `hidden` argument for `StatusBar.setHidden()` on the website, this trivial change fixes that.

FYI I followed the start procedure for the website mentioned in [CONTRIBUTING.md](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests), and noticed one needs to run `npm install` in the project root directory as well before starting the website. Do you want me to add that instruction as part of this PR, or as a separate PR entirely?
Closes https://github.com/facebook/react-native/pull/10735

Differential Revision: D4131223

fbshipit-source-id: b70c5ef12e72807445c51f13811537b9fa3b6b3e
2016-11-04 09:43:33 -07:00
David Aurelio 3683beb88a RN: Update React (2/2)
Reviewed By: kentaromiura

Differential Revision: D4026114

fbshipit-source-id: 67808af91454d95941fea01eef58a4d9086f46e1
2016-11-04 05:43:44 -07:00
Martin Konicek dca53feb4f Deprecate MapView in favor of airbnb/react-native-maps
Summary:
Compared to the `<MapView>` that comes with React Native, [react-native-maps](https://github.com/airbnb/react-native-maps) work on Android and is more feature complete. It is actively maintained and used extensively (9.2k installs / month, see [JS.Coach](https://js.coach/react-native/react-native-maps?search=react-native-maps)).

We think now is a good time to switch to react-native-maps in your applications and make `react-native-maps` the official `<MapView>` implementation for React Native.

We are going to release the deprecated `<MapView>` as a separate npm module so you can migrate to `react-native-maps` at your own pace.

**Test Plan**

Checked the docs render correctly on the website:

```
cd website
npm install
npm start
```

<img width="696" alt="screenshot 2016-11-01 20 17 31" src="https://cloud.githubusercontent.com/assets/346214/19905831/480074b8-a070-11e6-8779-8e12343c2883.png">

Warning is shown:

<img width="423" alt="screenshot 2016-11-01 20 39 21" src="https://cloud.githu
Closes https://github.com/facebook/react-native/pull/10500

Differential Revision: D4119602

Pulled By: mkonicek

fbshipit-source-id: 86780a98bf999e6047565ab66a5ebbd15e499a46
2016-11-03 16:58:49 -07:00
aybb 68c61203ac Texinput documentation improvement
Summary:
To my mind this feature should be documented as here lots of issues can happen potentially.
Closes https://github.com/facebook/react-native/pull/10706

Differential Revision: D4119506

fbshipit-source-id: 54f9738ea2308144a05678fd1897f529f260966c
2016-11-02 13:58:53 -07:00
Kevin Gozali 8bb707b686 Use native animations in TouchableBounce and TouchableOpacity
Summary:
this brings back the previous commit that had to be reverted due to internal breakages.

original commit: 1bb323e256

Reviewed By: AaaChiuuu

Differential Revision: D4109811

fbshipit-source-id: b50de145eaf6851138429635bc0302518d656b75
2016-11-01 15:58:41 -07:00
James Ide 5105c09f56 Fix missing methods in Keyboard module
Summary:
They keyboard module is an instance of `NativeEventEmitter` which is an instance of `EventEmitter`. But the exported module only has a small subset of the APIs. This broke existing codebases which are using the methods not exported currently.

The PR just reassigns the variable before exporting so that the actual module is exported instead of the dummy object used for documentation. It also fixes a layout issue in the documentation.
Closes https://github.com/facebook/react-native/pull/10671

Differential Revision: D4110355

fbshipit-source-id: a6757f3ca8c2494970ba221b10a7e6e9a5f2d64d
2016-11-01 08:58:39 -07:00
Adam Miskiewicz 426e66cfe6 Reverted commit D4099819
Summary:
Now that native animations for opacity and springs have landed in both iOS and Android, we can enable native animations both for TouchableBounce and TouchableOpacity.
Closes https://github.com/facebook/react-native/pull/10583

Differential Revision: D4099819

Pulled By: jingc

fbshipit-source-id: de70f8732b84d4caf0e4adfb2ad0e95b3de5da0f
2016-10-29 13:59:02 -07:00
Adam Miskiewicz 1bb323e256 Use native animations in TouchableBounce and TouchableOpacity
Summary:
Now that native animations for opacity and springs have landed in both iOS and Android, we can enable native animations both for TouchableBounce and TouchableOpacity.
Closes https://github.com/facebook/react-native/pull/10583

Differential Revision: D4099819

Pulled By: lacker

fbshipit-source-id: 247d7bff9a778e520af764f571caf6286b4a5749
2016-10-28 17:58:41 -07:00
Pieter De Baets 384ea330c8 Move Platform constants to RCTPlatform
Reviewed By: majak

Differential Revision: D4081849

fbshipit-source-id: bee08af2f68dcc1af424f382f960ff897ba11945
2016-10-27 04:29:00 -07:00
Anthony Sherbondy f930270b00 Fix for TouchableNativeFeedback having Animated.Component direct child
Summary:
Fixes #7996.
Test included.
Not sure this is the best way to go, just a simple solution since the TouchableNativeFeedback is trying to clone the component with a Native component, then seems like it should wrap it with Animated.Component if the incoming child was.
Closes https://github.com/facebook/react-native/pull/10081

Differential Revision: D4073603

fbshipit-source-id: 7827198a3e4697c14e37762cdca93f46a5a1d716
2016-10-25 00:28:37 -07:00
Denis 20598e54c6 Update NavigatorIOS.ios.js
Summary: Closes https://github.com/facebook/react-native/pull/9823

Differential Revision: D4055617

Pulled By: hramos

fbshipit-source-id: ec8d60ce93ead692c324eedf0678e8354202cc93
2016-10-21 02:43:47 -07:00
Geordie 73c5360470 NavigatorIOS: stopPropagation on navigationComplete event. Fixes #1241
Summary:
With nested NavigatorIOS components:

```
<NavigatorIOS initialRoute={{
  component: ComponentWithAnotherNavigatorIOSInSubtree
  title: 'xyz'
}}>
```

Navigating (via push etc.) in ComponentWithAnotherNavigatorIOSInSubtree's `navigator` caused an invariant error, making apps with this structure unusable. The reason was that the `navigationComplete` nativeEvent was being propagated to the outer Navigator due to React's automatic event bubbling, making the outer NavigatorIOS incorrectly think it was holding navigation stack state inconsistent with its native UINavigationController.

Concretely, if the outer navigation stack is empty except for its initial state and something is pushed onto the inner stack, the outer NavigatorIOS suddenly complains that it has 2 items on its stack rather than 1. In reality, the outer Navigator still only has 1 item on its stack but the inner Navigator's event (containing information about the inner Navigator) incorrectly bubbles up and reaches the outer Navigator too.
Closes https://github.com/facebook/react-native/pull/9828

Differential Revision: D4030167

Pulled By: ericvicenti

fbshipit-source-id: d04de3d5b70b4862a78610c92701ebdab2b047dd
2016-10-17 10:28:41 -07:00
Cristian Carlesso 6a462fb085 Moving the jest configuration from jest-react-native to react native.
Reviewed By: cpojer

Differential Revision: D3923609

fbshipit-source-id: 62804df81b064871b499ae8c091e13dd1e0f229b
2016-10-17 08:44:05 -07:00
leeight 9db8910e36 Clean unused import modules.
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/10413

Differential Revision: D4028108

fbshipit-source-id: 99a864dfda578d640f582b296583591415ba26cd
2016-10-16 11:13:40 -07:00
Jacob Parker abb8ea3aea Implement a postMessage function and an onMessage event for webviews …
Summary:
JS API very similar to web workers and node's child process.

Work has been done by somebody else for the Android implementation over at #7020, so we'd need to have these in sync before anything gets merged.

I've made a prop `messagingEnabled` to be more explicit about creating globals—it might be sufficient to just check for an onMessage handler though.

![screen shot 2016-09-06 at 10 28 23](https://cloud.githubusercontent.com/assets/7275322/18268669/b1a12348-741c-11e6-91a1-ad39d5a8bc03.png)
Closes https://github.com/facebook/react-native/pull/9762

Differential Revision: D4008260

fbshipit-source-id: 84b1afafbc0ab1edc3dfbf1a8fb870218e171a4c
2016-10-16 06:43:46 -07:00
Konstantin Raev 6ea26c01de Reverted commit D4027388
Reviewed By: yungsters

Differential Revision: D4027388

fbshipit-source-id: 8e3341b6f393ccf432c1a4e22a7cbf422284a06f
2016-10-16 04:13:42 -07:00
leeight dbfd046145 Change require('invariant') to require('fbjs/lib/invariant')
Summary:
FIX #10400
Closes https://github.com/facebook/react-native/pull/10409

Differential Revision: D4027850

fbshipit-source-id: c69e2ce892d119847902db3d6689ec237df35332
2016-10-16 02:13:52 -07:00
Jan Kassens e58d17e68b React.Element<any> » React.Element<*>
Reviewed By: yungsters

Differential Revision: D4027388

fbshipit-source-id: 5bc178eab1ab72283622b4b7d418f9fd43ec0792
2016-10-15 17:58:38 -07:00
Timur Gibadullin c32ab7e608 Add disabled prop
Summary:
Implemented feature requested in https://github.com/facebook/react-native/issues/10354, updated docs.
The colours were picked from native interface for iOS and from material-ui for android.
Closes https://github.com/facebook/react-native/pull/10398

Differential Revision: D4026189

Pulled By: ericvicenti

fbshipit-source-id: f3316e76f5a4126c07ffcdfb134cd902f40624d5
2016-10-14 19:43:40 -07:00
Tim Yung efcdef711e RN: Stop Deep Linking `ReactChildren`
Reviewed By: sebmarkbage

Differential Revision: D4025469

fbshipit-source-id: 311f9d741101133155395355d8468938435063f7
2016-10-14 18:59:10 -07:00
Tim Yung edecbcddcc RN: Stop Deep Linking `ReactElement`
Reviewed By: sebmarkbage

Differential Revision: D4025461

fbshipit-source-id: bdb35bd8948bf96e791e2c0d567ad6bd42806188
2016-10-14 18:59:10 -07:00
Tim Yung 7263c349c7 RN: Stop Deep Linking `ReactPropTypes`
Reviewed By: sebmarkbage

Differential Revision: D4025448

fbshipit-source-id: 4e9b6ee002a86f638fc57a4bbeb45bf35fabf74c
2016-10-14 18:59:10 -07:00
Tim Yung c4fc13b997 RN: Change `onlyChild => React.Children.only`
Reviewed By: sebmarkbage

Differential Revision: D4025440

fbshipit-source-id: efbcb44dcc89a6059688cf5a00cf28ada8a6a4c4
2016-10-14 18:59:10 -07:00
Tim Yung 331c13d4dc RN: Require {react/lib/ => }ReactNative
Reviewed By: sebmarkbage

Differential Revision: D4024375

fbshipit-source-id: cd2226a3580a7a4ff319d6a93b67b68f2942eb00
2016-10-14 18:59:10 -07:00
Tim Yung e8198aed8d Cleanup: Prefer `React.Element` over `React$?Element`
Reviewed By: vjeux

Differential Revision: D4013049

fbshipit-source-id: 18a447fdbc584418d6a51770363bcd221e7fb7dc
2016-10-14 08:59:37 -07:00
Cristian Carlesso 9ffe2ee0d8 Updating jest to 16.0.1
Reviewed By: cpojer

Differential Revision: D4001464

fbshipit-source-id: cbbf6a9d77605657151c86334fbc03d21f16e5fd
2016-10-13 13:13:46 -07:00
leeight c9960817ee Add viewConfig to RCTSlider Component, fix #10158
Summary:
And check componet.viewConfig before call component.setNativeProps method.

FIX #10158
Closes https://github.com/facebook/react-native/pull/10238

Differential Revision: D4008640

Pulled By: javache

fbshipit-source-id: 1bf9b34c0e56f1ffbcd31ae64b3cbafe77a9a1fd
2016-10-12 08:59:05 -07:00
leeight ddb1e44b43 Warning: bind(): You are binding a component method to the component
Summary:
Warning: bind(): You are binding a component method to the component.
React does this for you automatically in a high-performance way, so you can safely remove this call. See TouchableOpacity
Closes https://github.com/facebook/react-native/pull/10349

Differential Revision: D4008552

Pulled By: javache

fbshipit-source-id: d98fe9a0d694dee74ea872e51b02fbd75a133e43
2016-10-12 08:28:50 -07:00
Pieter De Baets c90bf303c1 Remove queryLayoutByID
Reviewed By: vjeux

Differential Revision: D3987495

fbshipit-source-id: 43a3cc0fb9ea718064e59e988619c39a23cd0c38
2016-10-11 11:43:40 -07:00
Satyajit Sahoo fa5ad85252 Remove deprecated APIs and modules
Summary:
We've deprecated these APIs for quite a few releases and we should be able to get rid of them now.

Remove following deprecated modules/components
 - AppStateIOS
 - ActivityIndicatorIOS
 - IntentAndroid
 - SliderIOS
 - SwitchAndroid
 - SwitchIOS
 - LinkingIOS

Update following modules to remove callback support
 - Clipboard
 - NetInfo

cc bestander
Closes https://github.com/facebook/react-native/pull/9891

Reviewed By: bestander

Differential Revision: D3974094

Pulled By: javache

fbshipit-source-id: 9abe32716bd85d0cea9933894f4447d53bdd5ee7
2016-10-11 07:43:52 -07:00
Jing Chen a5698f5cea Override onContentSizeChange prop on ScrollView before rendering
Summary:
We got a report that onContentSizeChange function was being called with an object instead of a number for width, sometimes. Upon debugging, it looked like the param being passed in was a native event wrapper. Tim eventually figured out that this is because there's a TextInput child, and the event bubbles: diffusion/FBS/browse/master/fbobjc/Libraries/FBReactKit/js/react-native-github/Libraries/Text/RCTTextViewManager.m;afbdef32df50$39

Because ScrollView just passes all its props down to the component it eventually renders (RCTScrollView on iOS), the TextInput event bubbles up and triggers the onContentSizeChange prop that was passed in directly, instead of going through the layer in ScrollView that normally unpacks width/height from the native event: diffusion/FBS/browse/master/fbobjc/Libraries/FBReactKit/js/react-native-github/Libraries/Components/ScrollView/ScrollView.js;247ddb2022151b68dd9f83a888b6e0ec9923737a$413-416

Overriding the prop before passing down to RCTScrollView will break that chain, so that the event will continue to bubble but it won't find the incorrect prop from ScrollView.

Reviewed By: yungsters

Differential Revision: D3999689

fbshipit-source-id: d6c3bf711969b3e1c6fc1e51fd44c6894910bc3d
2016-10-11 00:13:39 -07:00
Eric Vicenti 2ae73ffa00 Introduce Button Component
Summary:
Button is an important component to help the community get onboarded with RN quickly, so the first few minutes of a developer's experience is not spent formatting a simple button component.

In my opinion, `<Button />` should be seen as a "lowest common demoniator" component, rather than "the one button to rule them all". In other words, we should only support features in Button that will work on any platform. We should encourage people to fork Button if they need to add specific features to it, rather than trying to twist and bloat this component until it supports everything.

These platform imitations may not have the perfect constants just yet, but they are good enough to make a user feel at home in the app, without any modification. The community can help tweak the final formatting to make them look just right- PRs are welcome!

Reviewed By: frantic

Differential Revision: D3929041

fbshipit-source-id: 3785fb67472a7614eeee0a9aef504c0bdf62ede7
2016-10-10 17:28:39 -07:00
Isak Dunér 770091f3c1 add null check for keyboardFrame variable in KeyboardAvoidingView component
Summary:
This is a critical change and should be pushed to stabel asap

The reason for the pull request is to prevent crashes that can occure if the function relativeKeyboardHeight(keyboardFrame: ScreenRect) got null as an input variable which sometimes does happen.
Closes https://github.com/facebook/react-native/pull/10287

Differential Revision: D3988359

Pulled By: bestander

fbshipit-source-id: 0d1052b590b2684907ea6f7d6b4fe9b89989d4dd
2016-10-08 20:28:42 -07:00
Nader Dabit 91d266ba87 Update ScrollView.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/10157

Differential Revision: D3974091

Pulled By: javache

fbshipit-source-id: c756fb82422253bb9098c37fbcb5637e58e53340
2016-10-05 05:05:07 -07:00
sunnylqm 1941450649 no "window" in react native
Summary:
There is no "window" in react native. And by the way fix the indent.
Closes https://github.com/facebook/react-native/pull/10182

Differential Revision: D3974090

Pulled By: javache

fbshipit-source-id: e0e47e15364abff5bcb136d988e234fc8e1f0a8b
2016-10-05 04:43:45 -07:00
pedramsaleh fb355f663d Update TouchableHighlight.js
Summary:
Update to docs to indicate that TouchableHighlight must have exactly one child (i.e. not zero or more than one). Previously it was only indicated that it cannot have more than one.
Closes https://github.com/facebook/react-native/pull/10244

Differential Revision: D3970841

fbshipit-source-id: f1c4c223cfaf150fec9bbae1041567d0c81eb63b
2016-10-04 15:43:36 -07:00
Felix Oghina 6d175f2c25 Android: enable foreground ripple
Reviewed By: astreet

Differential Revision: D3932066

fbshipit-source-id: ee2f019cb9ba41e32cbbd8c1cd07c9ed5263fddc
2016-10-03 04:28:46 -07:00
Felix Oghina 8915507244 show touchable feedback for short touches
Summary: Currently, for short touches (under 130ms by default), we don't trigger the highlight effect. This diff makes it so that if we're not highlighted when we invoke onPress, we highlight.

Reviewed By: astreet

Differential Revision: D3932019

fbshipit-source-id: c0ff7d4c646890507ce510f51c279c88aeba66ae
2016-10-03 04:28:46 -07:00
Jeff Morrison 1a9853da37 fbobjc
Reviewed By: gabelevi

Differential Revision: D3949455

fbshipit-source-id: 1cbce4a85fe5b8798496752863bbca64b078aa9c
2016-10-01 11:16:21 -07:00
Alexander Pantyuhov c4ac8b329c StatusBar: barStyle support for Android (API 23+)
Summary:
Android (starting from API 23) supports "light status bar", thus it is possible to extend StatusBar and make `barStyle` property work not only for iOS, but also for Android.

This PR introduces one more `barStyle` option `dark-content` in addition to two existing ones (`default` and `light-content`).
Why there are 3 options instead of 2?

Two simple reasons:
1) to make all existing applications fully compatible with these changes;
2) the default status bar on Android is dark with white text and icons, while on iOS it is light with black text and icons on it. Thus the `default` option means something like "I don't really care, just apply the default color for this platform", while two other options (`light-content` and `dark-content`) allow to accurately specify the required result.
Closes https://github.com/facebook/react-native/pull/10185

Differential Revision: D3952346

fbshipit-source-id: 999a67614abff52321fbeb06298ebf1946c3f1d1
2016-09-30 12:58:37 -07:00
Gant Laborde 542ab8643e adds `Keyboard.dismiss()` function and document Keyboard
Summary:
Simple and elegant.  Now someone can dismiss a keyboard in a way that makes sense.

```js
import { Keyboard } from 'react-native'

// Hide that keyboard!
Keyboard.dismiss()
```

+ docs
Closes https://github.com/facebook/react-native/pull/9925

Differential Revision: D3935357

fbshipit-source-id: ecd2fb5c72c4dd769951d308e9bb6ee5d888052a
2016-09-28 18:13:37 -07:00
Emil Sjolander c43a3f5d84 Default scrollview to flexShrink to allow views below it
Summary: Changing from flex -> flexGrow on Scrollview caused some layouts to break due to having views below the scrollview. Adding flexShrink allows for the behavior again.

Reviewed By: blairvanderhoof

Differential Revision: D3936963

fbshipit-source-id: 0f43e6f5148918d3d431b98d26d185bbcc1548d0
2016-09-28 10:13:37 -07:00
Emil Sjolander 0a9b6bedb3 BREAKING - Fix unconstraint sizing in main axis
Summary:
This fixes measuring of items in the main axis of a container. Previously items were in a lot of cases measured with UNSPECIFIED instead of AT_MOST. This was to support scrolling containers. The correct way to handle scrolling containers is to instead provide them with their own overflow value to activate this behavior. This is also similar to how the web works.

This is a breaking change. Most of your layouts will continue to function as before however some of them might not. Typically this is due to having a `flex: 1` style where it is currently a no-op due to being measured with an undefined size but after this change it may collapse your component to take zero size due to the implicit `flexBasis: 0` now being correctly treated. Removing the bad `flex: 1` style or changing it to `flexGrow: 1` should solve most if not all layout issues your see after this diff.

Reviewed By: majak

Differential Revision: D3876927

fbshipit-source-id: 81ea1c9d6574dd4564a3333f1b3617cf84b4022f
2016-09-26 06:13:56 -07:00
Matej Matiasko 295ee16430 Fix View documentation typo
Summary:
Fix typo in View component documentation.
Closes https://github.com/facebook/react-native/pull/10097

Differential Revision: D3923619

Pulled By: davidaurelio

fbshipit-source-id: ebe63eec8ebdb36cfa7e3f501a214b9e11b17aef
2016-09-26 06:13:55 -07:00
Dustin Hoffner 727b7dffb4 Changed scrollEventThrottle check
Summary:
Hi there,

when using the ScrollView component with `onScroll` and `scrollEventThrottle = 0` as it is documented in [react-native/docs/scrollview](https://facebook.github.io/react-native/docs/scrollview.html#scrolleventthrottle) this message will appear unnecessary.

This happens because `!this.props.scrollEventThrottle` is `true` when the value is `0`.

So I changed it to `this.props.scrollEventThrottle == null`. Now it is `false` when the value is `0`.
Closes https://github.com/facebook/react-native/pull/10038

Differential Revision: D3909323

fbshipit-source-id: 3c701f23708b64576a8c9f47e140d87159087894
2016-09-22 13:58:31 -07:00
Martin Konicek 048449b678 Active opacity for TouchableHighlight should be 0.85 to match iOS native look
Summary:
While working on a feature in realized the buttons I built using `TouchableHighlight` were too dark when pressed.

When used white white views, `TouchableHighlight` produces the color `d4d5d5`. This is different from `dedede` which iOS uses.

Let's use opacity 0.85 instead of 0.8 to make the color match iOS. See a React Native view compared to iOS settings screen (same color for pressed items now): http://imgur.com/a/6CyL3

On Android, people should be using `TouchableNativeFeedback` everywhere.

Reviewed By: sahrens

Differential Revision: D3896168

fbshipit-source-id: a7dd12b4bde079b120faaffc36d25292533a2c6d
2016-09-21 07:13:38 -07:00
Damien 644b93dc11 Add very basic usage example for android toast
Summary:
Currently, it's hard to find out that it's very easy to use android toasts. The example is very complex and hard to grasp for a beginner. So, I propose to add an easy to understand example.

I'm sure the syntax of this PR is not really correct, it's just a start to show the kind of thing I propose.
Closes https://github.com/facebook/react-native/pull/9859

Differential Revision: D3886274

Pulled By: donyu

fbshipit-source-id: 15e693f5ddb1efea0fc6b7accfa688fd5f99a100
2016-09-19 06:43:54 -07:00
Janic Duplessis d0d1712851 Reverted commit D3827366
Summary:
This adds support for sticky headers on Android. The implementation if based primarily on the iOS one (https://github.com/facebook/react-native/blob/master/React/Views/RCTScrollView.m#L272) and adds some stuff that was missing to be able to handle z-index, view clipping, view hierarchy optimization and touch handling properly.

Some notable changes:
- Add `ChildDrawingOrderDelegate` interface to allow changing the `ViewGroup` drawing order using `ViewGroup#getChildDrawingOrder`. This is used to change the content view drawing order to make sure headers are drawn over the other cells. Right now I'm only reversing the drawing order as drawing only the header views last added a lot of complexity especially because of view clipping and I don't think it should cause issues.

- Add `collapsableChildren` prop that works like `collapsable` but applies to every child of the view. This is needed to be able to reference sticky headers by their indices otherwise some subviews can get optimized out and break indexes.
Closes https://github.com/facebook/react-native/pull/9456

Differential Revision: D3827366

Pulled By: fred2028

fbshipit-source-id: d346068734c5b987518794ab23e13914ed13b5c4
2016-09-15 12:13:39 -07:00
Janic Duplessis 0e8b75b22c Implement ScrollView sticky headers on Android
Summary:
This adds support for sticky headers on Android. The implementation if based primarily on the iOS one (https://github.com/facebook/react-native/blob/master/React/Views/RCTScrollView.m#L272) and adds some stuff that was missing to be able to handle z-index, view clipping, view hierarchy optimization and touch handling properly.

Some notable changes:
- Add `ChildDrawingOrderDelegate` interface to allow changing the `ViewGroup` drawing order using `ViewGroup#getChildDrawingOrder`. This is used to change the content view drawing order to make sure headers are drawn over the other cells. Right now I'm only reversing the drawing order as drawing only the header views last added a lot of complexity especially because of view clipping and I don't think it should cause issues.

- Add `collapsableChildren` prop that works like `collapsable` but applies to every child of the view. This is needed to be able to reference sticky headers by their indices otherwise some subviews can get optimized out and break indexes.
Closes https://github.com/facebook/react-native/pull/9456

Differential Revision: D3827366

fbshipit-source-id: cab044cfdbe2ccb98e1ecd3e02ed3ceaa253eb78
2016-09-14 20:43:29 -07:00
Emil Sjolander a6e1e33a50 Reverted commit D3855801
Summary: Introduce `overflow:scroll` so that scrolling can be implemented without the current overflow:visible hackiness. Currently we use AT_MOST to measure in the cross axis but not in the main axis. This was done to enable scrolling containers where children are not constraint in the main axis by their parent. This caused problems for non-scrolling containers though as it meant that their children cannot be measured correctly in the main axis. Introducing `overflow:scroll` fixes this.

Reviewed By: astreet

Differential Revision: D3855801

fbshipit-source-id: 3c365f9e6ef612fd9d9caaaa8c650e9702176e77
2016-09-14 11:28:34 -07:00
Emil Sjolander 1f9c9ecb4b BREAKING - Fix unconstraint sizing in main axis
Summary: Introduce `overflow:scroll` so that scrolling can be implemented without the current overflow:visible hackiness. Currently we use AT_MOST to measure in the cross axis but not in the main axis. This was done to enable scrolling containers where children are not constraint in the main axis by their parent. This caused problems for non-scrolling containers though as it meant that their children cannot be measured correctly in the main axis. Introducing `overflow:scroll` fixes this.

Reviewed By: astreet

Differential Revision: D3855801

fbshipit-source-id: 6077b0bcb68fe5ddd4aa22926acab40ff4d83949
2016-09-14 09:14:02 -07:00
Spike Brehm 157febcd54 Point to airbnb/react-native-maps
Summary:
We've moved https://github.com/lelandrichardson/react-native-maps to
https://github.com/airbnb/react-native-maps. Update the docs to reflect
the change.

to: lelandrichardson
Closes https://github.com/facebook/react-native/pull/9873

Differential Revision: D3855581

fbshipit-source-id: b4a2dd3a9125878694e9b7a7aecdc4c90961a185
2016-09-13 01:13:45 -07:00
Atticus White 2e4ab9ff70 Bugfix - Only add valid IOSPicker items.
Summary:
Fixes https://github.com/facebook/react-native/issues/9216.

As nickzuber describes in #9216, conditional `Picker.Item` elements will lead to exceptions downstream when the `Picker` attempts to construct the collection of items.

[In the picker source](a2fb703bbb/Libraries/Components/Picker/PickerIOS.ios.js (L48-L53)) we can see that `child.props` is accessed when `child` has the potential to be an invalid `React` element.

```js
ReactChildren.forEach(props.children, function (child, index) {
  if (child.props.value === props.selectedValue) {
    selectedIndex = index;
  }
  items.push({value: child.props.value, label: child.props.label});
});
```

This change ensures the incoming element is valid

```diff
ReactChildren.forEach(props.children, function (child, index) {
+ if (!React.isValidElement(child)) {
+   return;
+ }
  if (child.props.value === props.selectedValue) {
    selectedIndex = index;
  }
  items.
Closes https://github.com/facebook/react-native/pull/9243

Differential Revision: D3847514

Pulled By: spicyj

fbshipit-source-id: f46fbd4b0f81de7a92e1ca3e60b5ed15a9cbbf78
2016-09-10 21:43:37 -07:00
Pieter De Baets 53eaf9062d Replace local copy of TimerMixin with module from npm.
Reviewed By: spicyj, davidaurelio

Differential Revision: D3819543

fbshipit-source-id: 69d68a7653fce05a31cbfd61e48878b7a0a2ab51
2016-09-09 10:13:41 -07:00
leeight 6efe8e1d81 ViewPagerAndroid: FIX folly::toJson: JSON object value was a NaN or INF
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

Under certain scenario, `PageScrollEvent.offset` was initialized to `NaN`, which cause `folly::toJson` failed, and FIX #9750

<e71ecb2c4d/core/java/com/android/internal/widget/ViewPager.java (L1689)>

![image](https://cloud.githubusercontent.com/assets/104052/18266416/2a01f882-744d-11e6-86c4-3a2de3a1ca25.png)

**Test plan (required)**

<http://stackoverflow.com/questions/39327429/reactnative-viewpagerandroid-rcteventemitter>
Closes https://github.com/facebook/react-native/pull/9755

Differential Revision: D3841674

Pulled By: andreicoman11

fbshipit-source-id: d4cd9f4b2f61daad9005a098161ad7f75555345d
2016-09-09 08:58:46 -07:00
Jacob Parker 9e6e573e19 NavigatorIOS System Icon Support
Summary:
Continuation on #3959 (started by cancan101). Rebased to latest master, adds support for left system icon, fixes issues mentioned in previous PR.

<img width="432" alt="screen shot 2016-09-05 at 13 54 41" src="https://cloud.githubusercontent.com/assets/7275322/18248478/5b7aa25c-7370-11e6-8c51-01a2b7fd1030.png">
Closes https://github.com/facebook/react-native/pull/9742

Differential Revision: D3836850

Pulled By: javache

fbshipit-source-id: ef9f6e42211ed18bf5f3dc1eb7a8b1318d939674
2016-09-08 17:58:50 -07:00
Anton Kuznetsov efd8b10135 Brings accessibilityLabel into PickerAndroid
Summary:
Hi!

I found problem with accessibilityLabel on PickerAndroid.
There's no value in content-desc attribute while accessibilityLabel is correct.
I found that accessibilityLabel is not propagated into native components via
native props.

This PR brings accessibilityLabel for PickerAndroid.

Without this solution my appium tests fails, for example:

My code:
```jsx
<Picker
    style={this.props.style}
    selectedValue={this.props.value}
    onValueChange={this.onChange}
    disabled={this.props.disabled}
    accessibilityLabel="select_wineType">
    // Chilren
</Picker>
```

```sh
✖  Error: element (~select_wineType) still not visible after 5000ms
```
Because xml of this view is (look into content-desc of Spinner):
```xml
<android.widget.Spinner index="0" text="" class="android.widget.Spinner" package="com.hello_github" content-desc="" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" scrollable="true" long-clickable="false" password=
Closes https://github.com/facebook/react-native/pull/8873

Differential Revision: D3831691

Pulled By: spicyj

fbshipit-source-id: a494f22cb8be8cd6964981fe7ef7d9ff3773bcce
2016-09-07 16:58:30 -07:00
Pierre-Yves Desnoues 86db1b53b5 Update Switch.js docs - tintColor changes border
Summary:
Update documentation for Switch as it's not a background color that is displayed when the switch off, but juste the border (the background remains transparent)
Closes https://github.com/facebook/react-native/pull/9707

Differential Revision: D3819887

Pulled By: mkonicek

fbshipit-source-id: 218fd20deaded5260cc51e815b559f3cbbb3f752
2016-09-05 13:43:37 -07:00
Janic Duplessis 3c1b69c1a9 Add TextInput controlled selection prop on Android
Summary:
Android PR for TextInput selection, based on the iOS implementation in #8958.

** Test plan **
Tested using the text selection example in UIExplorer.
Closes https://github.com/facebook/react-native/pull/8962

Differential Revision: D3819285

Pulled By: andreicoman11

fbshipit-source-id: 9a2408af2a8b694258c88ab5c46322830c71452a
2016-09-05 07:13:46 -07:00
Nobuhito Kurose 5ba40fe6ef Improve loading error handling on Android WebView
Summary:
Loading invalid urls will happen in normal use so this line should be console.warn instead.
Actually ios WebView uses console.warn for this.
See https://github.com/facebook/react-native/issues/2904.
Closes https://github.com/facebook/react-native/pull/9623

Differential Revision: D3815167

Pulled By: spicyj

fbshipit-source-id: 0badb811b79d89d54c70b41692c609da0a3ef169
2016-09-02 23:28:35 -07:00
m3vaz 61832b4323 _getText defaults to blank string when no default value set
Summary:
One of the potential fixes that grabbou suggested was to make _getText return an empty string in the worst case of null value and null defaultValue.
Closes https://github.com/facebook/react-native/pull/9553

Differential Revision: D3800913

fbshipit-source-id: 30d9c0a7384d39477a71947714eec3340ba5380f
2016-08-31 16:14:03 -07:00
Sokovikov 0a1d7280eb add missing KeyboardAvoidingView documentation
Summary: Closes https://github.com/facebook/react-native/pull/9667

Differential Revision: D3791743

Pulled By: hramos

fbshipit-source-id: 823bf44028d8fb01f13510753362b8da3692f936
2016-08-30 10:43:33 -07:00
Andrew Y. Chen 22de6550d6 Add onContentSizeChange prop to WebView
Summary: Added support for WebViews to take in an onContentSizeChange prop, which will return a native event that contains the width and height of the html content in the WebView. Also moved the ContentSizeChangeEvent from the recyclerview dir to the uimanager/events dir

Reviewed By: andreicoman11

Differential Revision: D3775399

fbshipit-source-id: 19a0579f8345e5853cc7311b80f1f1393c77ab58
2016-08-29 12:28:52 -07:00
Janic Duplessis f0a3c56048 Add TextInput controlled selection prop on iOS
Summary:
This adds support for a controlled `selection` prop on `TextInput` on iOS (Android PR coming soon). This is based on the work by ehd in #2668 which hasn't been updated for a while, kept the original commit and worked on fixing what was missing based on the feedback in the original PR.

What I changed is:
- Make the prop properly controlled by JS
- Add a RCTTextSelection class to map the JS object into and the corresponding RCTConvert category
- Make sure the selection change event is properly triggered when the input is focused
- Cleanup setSelection
- Changed TextInput to use function refs to appease the linter

** Test plan **
Tested using the TextInput selection example in UIExplorer on iOS.
Also tested that it doesn't break Android.
Closes https://github.com/facebook/react-native/pull/8958

Differential Revision: D3771229

Pulled By: javache

fbshipit-source-id: b8ede46b97fb3faf3061bb2dac102160c4b20ce7
2016-08-25 17:28:37 -07:00
Andrei Coman 9840ced929 Reverted commit D3735237
Summary:
Currently, text inputs do not scroll when inside other components like scroll
views. This fixes it by blocking any parent native component from taking the
responder when the text input is focused and is being scrolled. This fixes the
previous implementation, where the scroll view was not able to scroll on top of
other text inputs, even though they were not focused.
This makes the component similar to it's ios counterpart.

Reviewed By: foghina

Differential Revision: D3735237

fbshipit-source-id: 724f94a6e7332d03261a80f63ffa60d0e5846932
2016-08-24 08:43:42 -07:00
Andrei Coman 0082517a6c Scroll multiline textinputs when focused
Summary:
Currently, text inputs do not scroll when inside other components like scroll
views. This fixes it by blocking any parent native component from taking the
responder when the text input is focused and is being scrolled. This fixes the
previous implementation, where the scroll view was not able to scroll on top of
other text inputs, even though they were not focused.
This makes the component similar to it's ios counterpart.

Reviewed By: foghina

Differential Revision: D3735237

fbshipit-source-id: 0e56b2bbd3f5636540b4c3cc7cc13aa0f4d2737e
2016-08-19 09:43:41 -07:00
Andrei Coman 959c8b170e Refactor text input props
Summary: Just cleaning the props for android rendering, similar to iOS

Reviewed By: foghina

Differential Revision: D3735324

fbshipit-source-id: aaf222543701409710a2cd217cc580e79f23bf7b
2016-08-19 07:28:40 -07:00
David Aurelio 94666f16c7 Auto-fix lint errors
Reviewed By: bestander

Differential Revision: D3683952

fbshipit-source-id: 9484d0b0e86859e8edaca0da1aa13a667f200905
2016-08-09 06:43:46 -07:00
ios122 5707c3d913 mediaPlaybackRequiresUserAction default value is true,not `false`
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.**

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

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/face
Closes https://github.com/facebook/react-native/pull/8999

Differential Revision: D3664512

Pulled By: javache

fbshipit-source-id: 030fe4752e53efcde21baadfc2502413b7fc9c8c
2016-08-03 17:43:49 -07:00
Slavik Manukyan 54d8f221c2 Way to pass styles to nested view
Summary:
Ability to pass styles to nested view for _position_ behavior.

Use case:

``` jsx
<KeyboardAvoidingView
          behavior={'position'}
          style={{ flex: 1 }}
          contentContainerStyle={{ flex: 1 }}
          keyboardVerticalOffset={ - VERTICAL_OFFSET }
>
          <SomeContainer   />
</KeyboardAvoidingView>
```
Closes https://github.com/facebook/react-native/pull/9065

Differential Revision: D3662876

Pulled By: javache

fbshipit-source-id: 9b08a04449431c4e563ef4464b5a7dba1fc02e4b
2016-08-03 11:28:58 -07:00
Will Moritz b44d617999 NavigatorIOS docs: need to import PropTypes
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.**

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

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/face
Closes https://github.com/facebook/react-native/pull/9141

Differential Revision: D3650195

Pulled By: hramos

fbshipit-source-id: 2a4bb06f92109b36bec761259e13a5782cc9929b
2016-08-01 11:58:36 -07:00
yueshuaijie 15bf2c57b8 Add TextInput.dataDetectorTypes prop.
Summary:
On iOS, if `TextInput` is used with prop `multiline={true}`, the backend view is `UITextView`. Sometimes we need `UITextView.dataDetectorTypes` to detect clickable url in the text view. The PR add this prop to `TextInput`, so we can use it like this:

`<TextInput`
`    defaultValue="Detect phone number: 88888888."`
`    editable={false}`
`    multiline={true}`
`    dataDetectorTypes="all"`
`    />`

Similar as #8743 .
Closes https://github.com/facebook/react-native/pull/8863

Differential Revision: D3648027

fbshipit-source-id: 987bd4f46fb5be74099b62988135a32115d9269c
2016-07-31 14:28:28 -07:00
Antoine Rousseau 2ca2f87a82 Fix onLayout support in <TextInput> for Android (same than iOS fix: #8042)
Summary:
See #8042: exactly the same bug and fix on Android

**Test plan**

```jsx
<TextInput onLayout={function(e) { console.log(e.nativeEvent); }} />
```
Closes https://github.com/facebook/react-native/pull/9113

Differential Revision: D3647808

Pulled By: mkonicek

fbshipit-source-id: 252a610e26a72a73411c3407faedea0477bee54e
2016-07-31 07:58:24 -07:00
origsun e8c8a06329 Fix bad link typo in View document
Summary:
This is trivial.

It fixes a bad link in http://facebook.github.io/react-native/docs/view.html#importantforaccessibility (the "Android importantForAccessibility docs" link).
Closes https://github.com/facebook/react-native/pull/9099

Differential Revision: D3647803

Pulled By: mkonicek

fbshipit-source-id: 8c75da03d926f60db0c75237b9ad48983bf9738f
2016-07-31 07:28:23 -07:00
Fadil Sutomo 63d15af18d Activity indicator: add size prop
Summary:
**motivation**

Previously, size can only accept either 'small' or 'large'. And to obtain a custom size, scale transformation is used. This is to let users to possibly pass number value directly to define ActivityIndicator's size.

**Test plan**

I have also modified the current example to reflect the new size prop in action.
Closes https://github.com/facebook/react-native/pull/8935

Differential Revision: D3637910

fbshipit-source-id: 6b8e1d4504964916df327b2d3eaaef1bb8cd5112
2016-07-28 15:28:43 -07:00
Simon Ayzman 7e2e0deeb0 Updated ScrollView's keyboardShouldPersistTaps doc
Summary:
I noticed that even when a ScrollView's `keyboardShouldPersistTaps` prop is set to true, the ScrollView's children can still respond to tap events (even if the scroll view itself will not respond to tap events and the keyboard does not dismiss automatically). This is a point of ambiguity in the React Native docs; it implies that no touch events can be handled if `keyboardShouldPersistTaps` is set to true.
Closes https://github.com/facebook/react-native/pull/9053

Differential Revision: D3636711

Pulled By: hramos

fbshipit-source-id: 2f0aea86202ab66d5a9174ce8611509dff67e15f
2016-07-28 12:43:34 -07:00
Christoph Pojer 75ecaf4190 Update to 14.0
Reviewed By: kassens

Differential Revision: D3627753

fbshipit-source-id: 35b8246c8cb61e60908d8c233a6e72063bf67096
2016-07-27 22:13:26 -07:00
Ben Alpert a2fb703bbb Convert from React.createClass to ES6 classes
Reviewed By: cpojer

Differential Revision: D3619143

fbshipit-source-id: e14e81468d467437ee3d79c34c34b7780a46ca1c
2016-07-26 01:13:31 -07:00
StevenChung d15d6d7ce0 Update NavigatorIOS.ios.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.**

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

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

I'm new to React-Native and noticed a broken link in the documentation.  It's just a quick fix.

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. Mat
Closes https://github.com/facebook/react-native/pull/8982

Differential Revision: D3612982

fbshipit-source-id: 2996730e51ae7a243697f305cd2ed2eb0d2985a8
2016-07-25 04:43:37 -07:00
Siqi Liu 235c059605 Support API "scrollTo" in RecyclerViewBackedScrollView on Android
Summary:
In Android `RecyclerViewBackedScrollView` didn't provide the `scrollTo` API, however iOS does.
If a ListView was created with `RecyclerViewBackedScrollView` as its `renderScrollComponent`, then calling `scrollTo` wouldn't work.

This diff enables the `scrollTo` API in `RecyclerViewBackedScrollView` on Android.

Reviewed By: dmmiller

Differential Revision: D3605233

fbshipit-source-id: f192053361f45453e5fce3fb6038ab03ac4025af
2016-07-22 09:28:40 -07:00
Don Yu 12ec213c0d Add support for layout gravity to ToastAndroid
Summary: Add support for top, bottom, and center layout gravity to ToastAndroid

Reviewed By: AaaChiuuu

Differential Revision: D3590224

fbshipit-source-id: 84dbbcfbe4133f291d62723c5c261acd7b32b46e
2016-07-20 08:13:37 -07:00
Leonardo Tegon 0c0ac6e21c Support RefreshControl in RecyclerViewBackedScrollView in Android
Summary:
In Android, `RecyclerViewBackedScrollView` wasn't using `refreshControl` prop.
If a ListView were created with `RecyclerViewBackedScrollView` as its `renderScrollComponent`, then the `refreshControl` wouldn't work.
example:
```js
        <ListView
          dataSource={this.props.dataSource}
          renderRow={this._renderRow.bind(this)}
          refreshControl={
            <RefreshControl
              refreshing={this.props.isRefreshing}
              onRefresh={this._onRefresh.bind(this)}
            />
          }
          renderScrollComponent={props => <RecyclerViewBackedScrollView {...props} />}/>;
```
This works in iOS, since the `RecyclerViewBackedScrollView` just returns an `ScrollView`.

This pull request uses the `refreshControl` to decide whether it should wrap the `NativeAndroidRecyclerView` with an
`AndroidSwipeRefreshLayout` or not.

This fixes the issue #7134.
Closes https://github.com/facebook/react-native/pull/8639

Differential Revision: D3564158

fbshipit-source-id: c10a880ea61cd80b8af789b00be90d46d63eaf9a
2016-07-14 14:43:24 -07:00
Martin Konicek 70ac81f0b5 Update Touchable docs with new image require syntax
Summary:
Just noticed the old syntax was used in the docs.
Closes https://github.com/facebook/react-native/pull/8765

Differential Revision: D3560355

Pulled By: mkonicek

fbshipit-source-id: 13db21a498be205a32921a89058167dd47e1bbdf
2016-07-13 23:13:22 -07:00
Hugo Dozois 90c2605950 Change TextInput prop check to print instead of throw
Summary:
Follow up of https://github.com/facebook/react-native/pull/8499! Open to discussion

Motivation:

See https://github.com/facebook/react-native/pull/8499#issuecomment-230004068

Goal is to have the same failure mode in dev and prod.

/cc ide
Closes https://github.com/facebook/react-native/pull/8757

Differential Revision: D3558991

fbshipit-source-id: c7d133f958e67ab23da486b1ffcb8f9963509b79
2016-07-13 16:43:38 -07:00
yueshuaijie 8612d7640d Add WebView.dataDetectorTypes prop.
Summary:
WebView component detect phone numbers in html as URL links by default. But sometimes we don't want this behavior.
This PR add dataDetectorTypes as a prop of WebView, so one can specify value of this prop as one or more of phoneNumber/link/address/calendarEvent/none/all
This prop maps to UIWebView.dataDetectorTypes
Closes https://github.com/facebook/react-native/pull/8743

Differential Revision: D3556440

fbshipit-source-id: 55f01d2cdd785381f261a9dc931aa9311f0ad1d4
2016-07-13 14:43:25 -07:00
Simon Dohmen d73446c549 Fixed position of ripple-effect
Summary:
I recognised that the ripple effect was always located at the bottom of my buttons. So i started to search for other ppl having the same problem. I also found this bug on the f8 app.

The gifs show the behaviour before and after my changes:

[The ripple effect is always on the bottom of the element, because pageY is used instead of the relative pos]
![before](https://cloud.githubusercontent.com/assets/956410/16042805/df49d97e-323c-11e6-8ce2-b0658ec85b27.gif)

![after](https://cloud.githubusercontent.com/assets/956410/16042804/df483a60-323c-11e6-862f-e8c97b835339.gif)

Before, the absolute position of the touch was used to update the position during movement but it should be the relative position. Just some small calculation changes were needed to achieve the correct behaviour :)
Closes https://github.com/facebook/react-native/pull/8111

Differential Revision: D3539652

fbshipit-source-id: dd8c8f3c7402d0d435f1c2ca67c1a59b474efda3
2016-07-08 19:33:20 -07:00
Janic Duplessis 2537157d99 Implement TextInput onContentSizeChange
Summary:
This adds proper support for tracking a TextInput content size as discussed in #6552 by adding a new callback that is called every time the content size changes including when first rendering the view.

Some points that are up for discussion are what do we want to do with the onChange callback as I don't see any use left for it now that we can track text change in onChangeText and size changes in onContentSizeChange. Also a bit off topic but should we consider renaming onChangeText to onTextChange to keep the naming more consistent (see [this naming justification](https://twitter.com/notbrent/status/709445076850597888)).

This is split in 2 commits for easier review, one for iOS and one for android.

The iOS implementation simply checks if the content size has changed everytime we update it and fire the callback, the only small issue was that the content size had several different values on initial render so I added a check to not fire events before the layoutSubviews where at this point the value is g
Closes https://github.com/facebook/react-native/pull/8457

Differential Revision: D3528202

Pulled By: dmmiller

fbshipit-source-id: fefe83f10cc5bfde1f5937c48c88b10408e58d9d
2016-07-07 09:00:01 -07:00
David Aurelio bd60d828c5 Remove `node_modules/react` from the list of discoverable haste modules
Summary: This removes `node_modules/react` from the list of directories that are used for haste module resolutions. Modules required from React are now imported with `require('react/lib/…')`.

Reviewed By: astreet

Differential Revision: D3509863

fbshipit-source-id: 32cd34e2b8496f0a6676dbe6bb1eacc18124c01e
2016-07-05 06:44:33 -07:00
Christoph Pojer 65eee61f24 Update to 13.1
Reviewed By: kentaromiura

Differential Revision: D3516030

fbshipit-source-id: 739003d8c1984207312b650e424397a419c5eb6a
2016-07-05 01:13:51 -07:00
ianlin e1497ce2b6 improve TextInput docs
Summary:
Add `phone-pad` as one of cross-platform values to `keyboardType`.
Closes https://github.com/facebook/react-native/pull/8555

Differential Revision: D3515002

Pulled By: JoelMarcey

fbshipit-source-id: 4f30dd72e8e30905a8a5fb90d3f361fb58eb825e
2016-07-04 08:13:22 -07:00
Hugo Dozois 508cc06565 Add __DEV__ around textInput prop check
Summary:
**Motivation**

The prop validation was run on every render, even in prod which seems odd to me. This adds a dev check to make sure prod build skips the validation.

**Test plan (required)**

There are no changes to the ui.
Closes https://github.com/facebook/react-native/pull/8499

Differential Revision: D3508805

Pulled By: javache

fbshipit-source-id: 68c6a1224e33997f9df93481426daff790ef5bcd
2016-07-01 04:13:24 -07:00
Christoph Pojer 7c53addcd5 First snapshot test, rendering "native" React component.
Reviewed By: frantic

Differential Revision: D3449781

fbshipit-source-id: 7abf9280f98cee06d04d7e222b884de1744afb8d
2016-06-29 21:58:17 -07:00
Héctor Ramos 3085b35e63 Initial stab at NavigationExperimental tutorial
Summary:
Add a NavigationExperimental section to the Navigation guide.

![navexp](https://cloud.githubusercontent.com/assets/165856/16355280/120e7d38-3a67-11e6-9567-51c19c249fdf.png)
Closes https://github.com/facebook/react-native/pull/8431

Differential Revision: D3493158

Pulled By: JoelMarcey

fbshipit-source-id: 5e9646c3abf97f5cce6f5ba5b3d10853aa84ee8e
2016-06-29 05:28:24 -07:00
Joel Marcey 5c31ba5098 Fix TextInput API update nits
Summary:
Ref: 7e7c2b5d57 (r68444537)

Ref: 7e7c2b5d57 (r68444442)
Closes https://github.com/facebook/react-native/pull/8476

Differential Revision: D3494641

Pulled By: JoelMarcey

fbshipit-source-id: 9a75ff66ccb895deb2f5027bdffe5d5bfe898e41
2016-06-28 14:58:17 -07:00
Martín Bigio eafc5dac62 Add support for `drawableLeft` and `drawablePadding` props
Summary: Add support inlining images into text inputs. For now this is only available on Android.

Reviewed By: andreicoman11

Differential Revision: D3470805

fbshipit-source-id: 14db05ec4d5af549bf314b903654314f39bf73ea
2016-06-28 14:13:48 -07:00
Joel Marcey 91134d16c9 Update TextInput API
Summary:
- Make the examples runnable (both copy/paste and with the web player)
- Add a bit more information in props where needed.
Closes https://github.com/facebook/react-native/pull/8392

Differential Revision: D3482747

Pulled By: caabernathy

fbshipit-source-id: 8f2d812efc1efb3f14db45b5c054ce0d5c14f5f5
2016-06-24 11:58:53 -07:00
Héctor Ramos 35f5ce296b Add Navigation Overview
Summary:
Initial stab at writing a high level guide on navigation. Its main focus is on Navigator due to it being cross-platform and fairly simple to use.

This guide should be expanded to cover tabbed applications in a future pull request.

The Navigation (Experimental) section will be similarly expanded upon as the API stabilizes.

![navigation](https://cloud.githubusercontent.com/assets/165856/16324560/52b508dc-396a-11e6-94b7-b2d1175f69e0.png)
Closes https://github.com/facebook/react-native/pull/8390

Differential Revision: D3480304

Pulled By: caabernathy

fbshipit-source-id: 280da9185fca295bc107a2df20106c783b461be7
2016-06-24 07:43:37 -07:00
Christine Abernathy 82b99a1ca3 Update MapView doc
Summary:
Reference: #8203

Changes made:

- Added a MapView example to the intro section
- Added more details to prop explanations
- Added more info to an exported type, even if it's not used anywhere I can see
- Removed mention of ios platform in props. Left an android one in there as I didn't want to touch code.

**Test plan (required)**

Ran the website locally and checked: http://localhost:8079/react-native/docs/mapview.html

![component_mapview_2](https://cloud.githubusercontent.com/assets/691109/16329753/43419508-3999-11e6-9310-11c53ca8c04b.png)
Closes https://github.com/facebook/react-native/pull/8389

Differential Revision: D3481609

Pulled By: JoelMarcey

fbshipit-source-id: 71e35ce49193dc09d40546ff16bc48559135d63f
2016-06-24 07:00:45 -07:00
Pieter De Baets d29e8ae0ca Implement onTextInput events for RCTTextView
Reviewed By: blairvanderhoof

Differential Revision: D3475581

fbshipit-source-id: df2fb8e1e898dfe6af455db0f96ecb23b4aa0721
2016-06-24 06:43:37 -07:00
Héctor Ramos 0c9dba46bb Move everything out of Known Issues and into more appropriate locations.
Summary:
Two of the known issues have been moved to the issue tracker:

* #8315
* #8316

Others have been moved into more appropriate locations, such as the `TextInput` issue to the API doc itself, and the React debugging issue to the Debugging doc.

The Android-specific compatibility concerns have been dropped entirely as it does not seem like people would find these in the docs.
Closes https://github.com/facebook/react-native/pull/8321

Differential Revision: D3477999

Pulled By: JoelMarcey

fbshipit-source-id: dfffc9910ebf5514eb14c6aa8a9a3e70761db874
2016-06-23 14:13:37 -07:00
Christine Abernathy 8e9e489f21 Update webview doc
Summary:
Reference: #8203

Changes made:

Added a webview example to the intro section
Added more details to prop explanations
Test plan (required)

Ran the website locally and checked: http://localhost:8079/react-native/docs/webview.html

![component_webview_2](https://cloud.githubusercontent.com/assets/691109/16316552/f6847c56-393b-11e6-8fdd-a0b61e7f787b.png)
Closes https://github.com/facebook/react-native/pull/8372

Differential Revision: D3477685

Pulled By: JoelMarcey

fbshipit-source-id: a624f5c6c12a8367aea2a6e7c2e520da7a074bbd
2016-06-23 13:14:06 -07:00
Christine Abernathy a111a564f9 Update NavigatorIOS component doc
Summary:
Reference: #8203

Changes made:

- Added more to the intro section and updated the intro examples to ES6
- Added more details to prop explanations
- Added parameter descriptions for methods

**Test plan (required)**

Ran the website locally and checked: http://localhost:8079/react-native/docs/navigatorios.html

![component_navigatorios_2](https://cloud.githubusercontent.com/assets/691109/16315939/1501ba2a-3939-11e6-8ec0-54b43e03b323.png)
Closes https://github.com/facebook/react-native/pull/8334

Differential Revision: D3476066

Pulled By: JoelMarcey

fbshipit-source-id: 9fcefe3f9d59008d8c72683c57cb004d1f185f62
2016-06-23 12:58:23 -07:00
Joel Marcey 678ea5b233 Fix nits in update View API documentation
Summary:
Ref comments in #8341

Ref #8203
Closes https://github.com/facebook/react-native/pull/8361

Differential Revision: D3477174

Pulled By: caabernathy

fbshipit-source-id: 495011c2d370d06d355e966d6ba2c52880146183
2016-06-23 12:13:34 -07:00
alvaromb 9bd80cbc26 Added the ability to set an image title in the NavigatorIOS
Summary:
This pull request adds support for setting an image title in `NavigatorIOS`. It sets the `titleView` property of `UINavigationItem`.

Added an example into `UIExplorer`

<img width="487" alt="ex" src="https://cloud.githubusercontent.com/assets/289640/16147578/3d552606-3484-11e6-9a26-1e8c113ace03.png">

The code follows the same style as the rest of `RCTNavItem` and `RCTWrapperViewController`.
Closes https://github.com/facebook/react-native/pull/8182

Differential Revision: D3469073

Pulled By: javache

fbshipit-source-id: 2d3e4bad534f92b6e6b24a6b74f2993f3a8c9012
2016-06-23 08:28:30 -07:00
Eric Kreutzer 7fc51c8cea use ColorPropType everywhere there is a color prop on TextInput
Summary:
If using colors that are not strings react native would warn you of the problem. I made some changes so color props use `ColorPropType` instead of `PropTypes.string`.
Closes https://github.com/facebook/react-native/pull/8325

Differential Revision: D3475516

Pulled By: javache

fbshipit-source-id: b7e40a0de5e665fc5f41a975650bbba0ec210814
2016-06-23 03:13:28 -07:00
Joel Marcey 9b9df78e28 Update Views API documentation
Summary:
Ensure all `props` have documentation. Add more details to current `props`.
Provide more information to the API in general.

> Would like to try to integrate the React Native Web Player for the initial
> example, but not right now.
Closes https://github.com/facebook/react-native/pull/8341

Differential Revision: D3475105

Pulled By: caabernathy

fbshipit-source-id: 00ad30b2359831740715517278bec1d0231e089d
2016-06-23 02:28:58 -07:00
Christine Abernathy 22f59a88a6 Improve autogen for reference docs including jsdoc support
Summary:
As part of improving the API and Component reference docs #8154 this pull request adds the following:

- jsdoc support for API docs. See the AlertIOS changes as an example.
- type definitions support and added to both API and Component docs. This is supported via react-docgen and jsdoc.
- better formatting of method properties (now shown in a table).

FYI, API and Component docs were previously generated in two different ways. Components were using react-docgen and that basically remains as-is. APIs were using custom parsing code and that's been switched to use a jsdoc parser + react-docgen as an option for typedefs (it could also use the jsdoc parser).

Two docs have been updated to showcase how we'd like the new docs to look:

- AlertIOS (API): showing method parameters, examples, typedefs, more details overall.
- Statusbar (Component): showing method parameters, typedefs, more details overall.

**Note**: To convert new API docs to use the new format, add `jsdoc` to the initial file comment. C
Closes https://github.com/facebook/react-native/pull/8196

Differential Revision: D3465037

Pulled By: lacker

fbshipit-source-id: 78415d44bc5be02db802f5b1f7a0b249689abdf7
2016-06-21 14:28:43 -07:00
Omeid 4f187074bf Components:Touchables: Expose Accessibility prop. Fix #6550
Summary:
With accessibility prop set to true, it is not possible to access
childern elements. This makes it impossible to test Components with
appium and releatives. This commit adds support to change accessiblity
property on Touchable elements to overcome the aforementioned issue.
Closes https://github.com/facebook/react-native/pull/8243

Differential Revision: D3462949

Pulled By: javache

fbshipit-source-id: 65ce6507a1619218ab5b527c970a74af197ef462
2016-06-21 08:28:23 -07:00
Denis b2c5584fce set state to LOADING on reload()
Summary:
https://github.com/facebook/react-native/issues/8239
Closes https://github.com/facebook/react-native/pull/8247

Differential Revision: D3460015

Pulled By: javache

fbshipit-source-id: dd41fc7cf01a07acecd124733f8ef109de5ccc35
2016-06-21 02:43:49 -07:00
Chirag Shah d929f1ccef Added userAgent prop type in docs for webview
Summary:
userAgent as a prop type is available in WebView for android but is not documented. This PR fixes it.

**TestPlan** : Not required as this just adds an entry in the documentation

![webview react native a framework for building native apps using react 2016-06-18 02-14-58](https://cloud.githubusercontent.com/assets/6805530/16164289/e8908526-34fa-11e6-98fe-face38ff9f51.png)
Closes https://github.com/facebook/react-native/pull/8200

Differential Revision: D3454625

fbshipit-source-id: 260087044f78a1339cf7ec8760e92cd9fbdb5111
2016-06-17 22:28:21 -07:00
Janic Duplessis 4c245160bd Replace deprecated ActivityIndicatorIOS and ProgressBar with ActivityIndicator
Summary:
This replaces ActivityIndicatorIOS and indeterminate ProgressBar that were deprecated recently with ActivityIndicator across the codebase and examples and a few other cleanups.

This also make a small tweak to ActivityIndicator so it uses the Android theme color instead of gray when no color is specified.

Use Slider instead of SliderIOS in CameraRoll example.

Remove the line about unifying ActivityIndicator and ProgressBar.

**Test plan**
Tested the affected components in UIExplorer on iOS and Android, tested the changes made in Movies example on iOS and Android.
Closes https://github.com/facebook/react-native/pull/8082

Differential Revision: D3429770

fbshipit-source-id: 3b2e1196a8b9fe00d47a7aa1bbc079b094796421
2016-06-13 22:28:24 -07:00
Ben Hoyt a4f772f5f7 Note that MapView is not yet available on Android
Summary:
The MapView component is not labelled as iOS-only, but it is. It took me a bit of digging to figure out that the Android source code hasn't been released. Found it in this [SO answer](http://stackoverflow.com/questions/32625259/no-view-manager-defined-for-class-rctmap) in the end, and it is documented [here](http://facebook.github.io/react-native/docs/known-issues.html#views), but it'd be nice if it said that directly in the MapView docs. (The mention of the Android-specific prop `active` put me off the trail for a bit.)
Closes https://github.com/facebook/react-native/pull/7361

Differential Revision: D3426119

fbshipit-source-id: 7bd210373a223a5dd756d3f095c6d1a3d8788b03
2016-06-13 12:43:33 -07:00
Keri Clowes 7271a9dc24 Fix Typo
Summary:
Nitpicky, I know :)
Closes https://github.com/facebook/react-native/pull/8056

Differential Revision: D3419299

fbshipit-source-id: b3bfe985a2a8dff4572e798c9d0e09662ab37ed0
2016-06-10 13:58:22 -07:00
Paul Shen 92926f9858 Fix onLayout support in <TextInput>
Summary:
The `onLayout` prop is overridden by `<TouchableWithoutFeedback>` and thus does not work on `<TextInput>` components. fb0007d853/Libraries/Components/Touchable/TouchableWithoutFeedback.js (L176)

This makes it so the following works.

```javascript
<TextInput onLayout={...} />
```

I only tested on iOS but I assume a similar fix might be needed for Android. fb0007d853/Libraries/Components/TextInput/TextInput.js (L575)

**Test Plan**

https://rnplay.org/apps/euIZtg (confirm bug)
With fix, set `onLayout` on `<TextInput>` and see it is fired correctly.

```javascript
<TextInput onLayout={function(e) { console.log(e.nativeEvent); }} />
```
Closes https://github.com/facebook/react-native/pull/8042

Differential Revision: D3417192

fbshipit-source-id: 536ec81d3479e6bda474ac766b27afb39242c01a
2016-06-10 03:28:44 -07:00
Wenjing Wang 13dfb6267a Fix broken image cropper - can not scroll
Summary: ImageCropper is broken on iOS. Can not scroll up and down

Differential Revision: D3413397

fbshipit-source-id: 75096fc1d5dd14764c0ddd4fd3888a9576c1d1ce
2016-06-09 23:13:31 -07:00
Nick Lockwood 8b78846a95 Open sourced KeyboardAvoidingView
Summary:
KeyboardAvoidingView is a component we built internally to solve the common problem of views that need to move out of the way of the virtual keyboard.

KeyboardAvoidingView can automatically adjust either its position or bottom padding based on the position of the keyboard.

Reviewed By: javache

Differential Revision: D3398238

fbshipit-source-id: 493f2d2dec76667996250c011a1c5b7a14f245eb
2016-06-07 07:43:49 -07:00
Nathan Azaria 993a928833 Fixed MapView's draggable annotation
Reviewed By: javache

Differential Revision: D3384947

fbshipit-source-id: 801a0998c8db788a731d27ae5956193ff23aa198
2016-06-07 07:28:27 -07:00
Dave Miller f3507f99f1 Remove support for password property and only use secureTextEntry
Summary:
Reduce the public surface area of TextInput.  It only exposes a secureTextEntry property, but on Android was also accepting password as a prop.
This removes that.

Reviewed By: javache

Differential Revision: D3392223

fbshipit-source-id: 67c36fbe16fe493e2841d5d9deb78e3be2209ebd
2016-06-06 10:13:28 -07:00
Pieter De Baets 4de616b4c1 Remove deprecated calls from StatusBarIOS
Reviewed By: nicklockwood

Differential Revision: D3346701

fbshipit-source-id: 17809a4cd686f3b431257e85d85770aee640bbc9
2016-06-06 09:13:24 -07:00
Jakob Kerkhove cec913e7ce Native propTypes RCTDatePickerIOS !== propTypes DatePickerIOS
Summary:
The propTypes of RCTDatePickerIOS do not fit with the propTypes of DatePickerIOS.
All dates (date, minimumDate, maximumDate) are a timestamp (check line 126), so they should have propType number.
OnDateChange function should not be required since it is called onChange in the iOS implementation.

The problem currently causes warnings that the given types are wrong, while they were added correctly.
Closes https://github.com/facebook/react-native/pull/7833

Differential Revision: D3371324

Pulled By: nicklockwood

fbshipit-source-id: bca5b2bbe7e9dd2e045288bfbd268578848c7bff
2016-06-01 08:58:22 -07:00
Nick Lockwood 002024cc45 Removed hard-coded DatePicker width
Summary: The DatePicker had a hard-coded width of 320 for no reason I can think of. Removing it allows the DatePicker to naturally scale to fit the width of the container, which is how the regular Picker works already.

Reviewed By: lexs

Differential Revision: D3371355

fbshipit-source-id: e06d31f7275de41bb00226232cf47ad022d25b4d
2016-06-01 06:58:23 -07:00
Emil Sjolander 6603cef95c Fix ScrollView to work correctly for new css-layout
Reviewed By: sahrens

Differential Revision: D3367140

fbshipit-source-id: ea470f289c92ebca71543a9b9328a7a5ed6d572b
2016-06-01 04:28:29 -07:00
Janic Duplessis 26e8426248 Cross platform ActivityIndicator
Summary:
The API for `ActivityIndiatorIOS` and `ProgressBarAndroid` is very similar and can be merged in a cross platform component that displays a circular indeterminate loading indicator.

This deprecates `ActivityIndiatorIOS` and non-horizontal `ProgressBarAndroid` in favor of this new component.

**Test plan (required)**

Tested with the ActivityIndicator example in UIExplorer on android and ios. Also made sure that `ActivityIndicatorIOS` still works and displays a deprecation warning. Also tested that `ProgressBarAndroid` with `indeterminate == true` and `styleAttr != 'Horizontal'` displays a deprecation warning.
Closes https://github.com/facebook/react-native/pull/6897

Differential Revision: D3351607

Pulled By: dmmiller

fbshipit-source-id: b107ce99d966359003e8b3118cd97b90fa1d3d7d
2016-05-26 13:58:17 -07:00
Adam Comella 26aa27da63 Fix TextInput autocorrect (#7496)
Summary:
Autocorrect was broken for controlled TextInput components by a change to batch event handling in React Native:
9f11f8c263

For example, a TextInput like this would be affected by this bug:

```javascript
<TextInput
  autoCorrect={true}
  style={{height: 26, width: 100}}
  onChangeText={(text) => this.setState({ text })}
  value={this.state.text}
/>
```
This fix uses the same approach as
0cd2904b23

The problem is that TextInput's _onChange handler relied on this.props.value being updated synchronously when calling this.props.onChangeText(text). However, this assumption was broken when React Native event handling started being batched.

The fix is to move the code that relies on this.props.value being up-to-date to componentDidUpdate.

**Test plan (required)**

Tested autocorrect now works on iOS in a small app and a large app. Also tested t
Closes https://github.com/facebook/react-native/pull/7676

Differential Revision: D3346221

Pulled By: nicklockwood

fbshipit-source-id: 715df3e8a03aa58cb0a462de4add02289d42782f
2016-05-26 07:28:18 -07:00
Basil Hosmer ac5636dd59 explicit type args in react-native-github
Reviewed By: vjeux

Differential Revision: D3342856

fbshipit-source-id: ba5a4d5529fc9d1d1efe98cc175d718c5f044a5b
2016-05-24 18:28:26 -07:00
Janic Duplessis a71a9efe96 Remove deprecated PullToRefreshViewAndroid and onRefreshStart / endRefreshing
Summary:
Removes the deprecated APIs that were replaced by `RefreshControl`. Those API have been deprecated for a while already so I think it's fine to remove them at this point. Also ported the `SwipeRefreshLayoutTestModule` test to use `RefreshControl` instead of `PullToRefreshViewAndroid`.

**Test plan (required)**

Made sure no references are left in the codebase to `PullToRefreshViewAndroid`, `onRefreshStart` and `endRefreshing`.
Tested that `ScrollView` examples in UIExplorer still work properly.
Check that the `SwipeRefreshLayoutTestModule` passes on CI.
Closes https://github.com/facebook/react-native/pull/7447

Reviewed By: mkonicek

Differential Revision: D3292391

Pulled By: bestander

fbshipit-source-id: 27eb2443861e04a9f7319586ce2ada381b714d47
2016-05-24 03:28:25 -07:00
Mike Grabowski a45d025385 TabBarIOS itemPositioning - Fixes #4136
Summary:
The default itemPositioning is `automatic` (referred to `auto` in this pull request) - you can check its behaviour in the docs attached.

Sometimes that value has to be modified to have more predictable appearance as described in #4136.
Closes https://github.com/facebook/react-native/pull/7217

Differential Revision: D3220958

Pulled By: mkonicek

fbshipit-source-id: d4bf648b16e71825cd31c06d6b6396479767d19f
2016-05-20 17:28:50 -07:00
Jimmy Mayoukou 2849bafbc3 Fix typo in ViewPagerAndroid.android.js
Summary: Closes https://github.com/facebook/react-native/pull/7456

Differential Revision: D3299061

fbshipit-source-id: 417995191d675e2ae625926df93412c660d1931a
2016-05-13 11:58:23 -07:00
Nathan Spaun b67d4a20d7 Add FpsListener to React Scroll Views
Summary:
We want to give people the ability to log scroll performance (including Fb).
This adds an interface that can be enabled and disabled from the react scroll views.
This is a prerequisite to implementing the actual framerate logger that will log dropped
frames while scrolling in prod.

Reviewed By: astreet

Differential Revision: D3283588

fbshipit-source-id: ed9736cb9ed3f441511647f36b1460092bd91e56
2016-05-13 11:28:21 -07:00
Nick Lockwood 2525feb37f Updated Websocket to use new event system
Reviewed By: javache

Differential Revision: D3292473

fbshipit-source-id: f9a9e0a1b5a12f7fa8b36ebdba88405370f91c54
2016-05-12 08:30:24 -07:00
Kevin Johnson 31250ad150 Ability to disable/lock the android ViewPager scroll from props
Summary:
This is a nice feature to have.

I've tested this by copying and renaming the ViewPager java and javascript files from the react-native repo and including them in a project. Whats the best way to test this directly from the repo?
Closes https://github.com/facebook/react-native/pull/5968

Differential Revision: D3240651

Pulled By: mkonicek

fbshipit-source-id: 5f1d157216df4f3314915496188a92aec1b85e91
2016-05-11 16:51:17 -07:00
Nick Lockwood 9ee1f37bad Added native event emitter
Summary:
This is a solution for the problem I raised in https://www.facebook.com/groups/react.native.community/permalink/768218933313687/

I've added a new native base class, `RCTEventEmitter` as well as an equivalent JS class/module `NativeEventEmitter` (RCTEventEmitter.js and EventEmitter.js were taken already).

Instead of arbitrary modules sending events via `bridge.eventDispatcher`, the idea is that any module that sends events should now subclass `RCTEventEmitter`, and provide an equivalent JS module that subclasses `NativeEventEmitter`.

JS code that wants to observe the events should now observe it via the specific JS module rather than via `RCTDeviceEventEmitter` directly. e.g. to observer a keyboard event, instead of writing:

    const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
    RCTDeviceEventEmitter.addListener('keyboardWillShow', (event) => { ... });

You'd now write:

    const Keyboard = require('Keyboard');
    Keyboard.addListener('keyboardWillShow', (event) => { ... });

Within a component, you can also use the `Subscribable.Mixin` as you would previously, but instead of:

     this.addListenerOn(RCTDeviceEventEmitter, 'keyboardWillShow', ...);

Write:

    this.addListenerOn(Keyboard, 'keyboardWillShow', ...);

This approach allows the native `RCTKeyboardObserver` module to be created lazily the first time a listener is added, and to stop sending events when the last listener is removed. It also allows us to validate that the event strings being observed and omitted match the supported events for that module.

As a proof-of-concept, I've converted the `RCTStatusBarManager` and `RCTKeyboardObserver` modules to use the new system. I'll convert the rest in a follow up diff.

For now, the new `NativeEventEmitter` JS module wraps the `RCTDeviceEventEmitter` JS module, and just uses the native `RCTEventEmitter` module for bookkeeping. This allows for full backwards compatibility (code that is observing the event via `RCTDeviceEventEmitter` instead of the specific module will still work as expected, albeit with a warning). Once all legacy calls have been removed, this could be refactored to something more elegant internally, whilst maintaining the same public interface.

Note: currently, all device events still share a single global namespace, since they're really all registered on the same emitter instance internally. We should move away from that as soon as possible because it's not intuitive and will likely lead to strange bugs if people add generic events such as "onChange" or "onError" to their modules (which is common practice for components, where it's not a problem).

Reviewed By: javache

Differential Revision: D3269966

fbshipit-source-id: 1412daba850cd373020e1086673ba38ef9193050
2016-05-11 06:27:29 -07:00
Spencer Ahrens 2d43663ac8 Remove cruft from ScrollView
Reviewed By: dmmiller

Differential Revision: D3287077

fbshipit-source-id: dfc238469bce540d69c38d3e17c87163e10d7b23
2016-05-11 05:22:20 -07:00
Spencer Ahrens 892e509a0c Fix flow and lint for ScrollView
Summary:
- getScrollResponder returns a...ScrollView!
- no more var
- no more string refs

Reviewed By: spicyj

Differential Revision: D3286596

fbshipit-source-id: d9e6e0a318eadd2521c9f5c69d2ec368f1d7b626
2016-05-11 03:00:27 -07:00
nemothecapt df9a2b20a1 React.PropTypes.oneOf accepts array as parameter, non-array given
Summary:
React.PropTypes.oneOf accepts array as parameter, non-array given. this make the app throw a warning.
Closes https://github.com/facebook/react-native/pull/7498

Differential Revision: D3285737

fbshipit-source-id: 3d86b4b36d696e054f9225d7e3a9eddf91477813
2016-05-10 21:04:23 -07:00
Pieter De Baets 57ceeafd4f Move UI-specific logic from NativeModules to UIManager
Summary: Move all requires of UIManager to UIManager.js, so we can load the view manager configuration lazily when UIManager is required.

Reviewed By: majak

Differential Revision: D3270147

fb-gh-sync-id: 8208ee8d5919102ea5345e7031af47ee78162fe0
fbshipit-source-id: 8208ee8d5919102ea5345e7031af47ee78162fe0
2016-05-09 08:21:19 -07:00
UnoDeTantos f7ce0c1c2f Adds progressViewOffset to RefreshControl
Summary:
Add the possibility to define a progress view top offset to RefreshControl on android. As i comment in #6740, contentInset does the trick on IOS.

Looking android documentation seems that exists a possible solution:
http://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html#setProgressViewOffset(boolean, int, int)

This pull request implement that but keeping it simple, only a top offset.

For example, now we could put navigation bar over the scrollview (or listview) and define a progressViewOffset on RefreshView in order to start behind the navigation. At this point we could make some kind of coordinator layout to hide/show navigation on scroll.

To maintain the default behavior, start point is equal to start point minus progress circle diameter in order to create that progress circle before the start point.
Closes https://github.com/facebook/react-native/pull/6759

Differential Revision: D3240664

Pulled By: mkonicek

fb-gh-sync-id: ccf866272e871811c1c6dcc2a34f5c217967feee
fbshipit-source-id: ccf866272e871811c1c6dcc2a34f5c217967feee
2016-05-09 01:51:22 -07:00
Janic Duplessis 9aa37e8fb2 Make RefreshControl properly controlled by JS
Summary:
There was an issue with the way we made `RefreshControl` a controlled component when react doesn't render synchronously. This fixes the issue by using the same technique used in the commit 0cd2904b23 for`PickerAndroid`

**Test plan (required)**

Tested normal behaviour and tested that if not setting the `refreshing` prop to `true` during the `onRefresh` callback that the `RefreshControl` stops refreshing immediately. Also made sure that `setNativeProps` is only called if needed when the native refreshing state is not in sync with JS.

Fix #7414
Closes https://github.com/facebook/react-native/pull/7445

Differential Revision: D3274981

fb-gh-sync-id: a1b9d46329f552984e33d11fa0e29ad6da689511
fbshipit-source-id: a1b9d46329f552984e33d11fa0e29ad6da689511
2016-05-08 17:03:18 -07:00
Alessandro Nadalin b88d9d2380 Fixed typo
Summary: Closes https://github.com/facebook/react-native/pull/7448

Differential Revision: D3274779

fb-gh-sync-id: ae50ff1939778663af2f212fd510ed04ea640bb2
fbshipit-source-id: ae50ff1939778663af2f212fd510ed04ea640bb2
2016-05-08 11:47:49 -07:00
Ben Alpert 0cd2904b23 Fix Android picker controlling
Reviewed By: mkonicek

Differential Revision: D3261602

fb-gh-sync-id: da67d28420c5d855d672b481deeb92fa8b5d017c
fbshipit-source-id: da67d28420c5d855d672b481deeb92fa8b5d017c
2016-05-07 15:52:19 -07:00
Adam Comella 4d2c72b977 NavigatorIOS: Expose interactivePopGestureEnabled property
Summary:
Previously, the back swipe navigation gesture would be enabled when the navigation bar is shown and disabled when the navigation bar is hidden.

This change enables developers to control the back swipe gesture independently of the visibility of the navigation bar. An example use case would be that an app wants to render a custom navigation bar so it sets `navigationBarHidden` to true and it wants to enable the back swipe gesture so it sets `interactivePopGestureEnabled` to true.

**Test plan (required)**

- Created a test app to verify setting `interactivePopGestureEnabled` to `true` and `false` with the navigation bar both hidden and shown.
- Verified prop works in a larger app.

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

Differential Revision: D3269304

Pulled By: javache

fb-gh-sync-id: ec4324f6517cec4b4fc4f62c4394dc9208a8af6a
fbshipit-source-id: ec4324f6517cec4b4fc4f62c4394dc9208a8af6a
2016-05-06 03:18:20 -07:00
Jimmy Mayoukou dd8caf4cf2 Implement returnKeyType/returnKeyLabel on Android
Summary:
This PR implements [`returnKeyType`](http://facebook.github.io/react-native/docs/textinput.html#returnkeytype) on Android.

It is implemented with [`EditText.setImeOptions()`](http://developer.android.com/reference/android/widget/TextView.html#setImeOptions(int)) that allows us to specify options on an input, in this case change the return button icon. To be noted that it is also possible to specify a string instead of an icon with [`EditText.setImeActionLabel()`](http://developer.android.com/reference/android/widget/TextView.html#setImeActionLabel(java.lang.CharSequence, int)) while being 2 different things I added both of these behaviors in this PR since it was mostly at the same place/component.

**Problems encountered :**

- All the `ReactEditText`s were set to `IME_ACTION_DONE` by default ([reference](a2157dbbe0/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java (L78))). I'm not sure
Closes https://github.com/facebook/react-native/pull/6905

Differential Revision: D3264755

Pulled By: dmmiller

fb-gh-sync-id: 4a090e31b620a245847c06ba1895cfea02e88d0f
fbshipit-source-id: 4a090e31b620a245847c06ba1895cfea02e88d0f
2016-05-05 10:22:19 -07:00
Dave Miller a3146e41a2 Add pagingEnabled to HorizontalScrollView
Summary:
This adds support for pagingEnabled to the HorizontalScrollView.

This is an initial implementation.

Because Android doesn't provide great details about what is happening with a scroll view after you are done touching it, we have some post touch handling.  This is kicked off either by touch up or a fling call.
Once we are doing that handling, we start a runnable that basically checks if we are still scrolling.  If we are, we just schedule that runnable again and check a frame later.  If we are done scrolling (no onScrollChanged since we last fired), we could be in one of two states, the fling is done or we are done snapping to the page boundary.  If we are in the fling done case, we then check if we need to scroll to a page boundary.  If so, we call smoothScrollTo and schedule ourself to check onScroll events again until done with that scroll.  If we are done with both (either we only did momentum scroll or we did that and then snapped to page), we can then fire the final event and stop checking.  This logic is all in handlePostTouchScrolling.

Because of the decision to only do page scrolling after momentum ends, we do allow you to scroll through with momentum a number of pages and the transition can be a little strange where it stops a sec and then slides to be page aligned.  As a follow up, we can probably smooth that up by changing the value we pass to super.fling() that would adjust it to be let momentum carry it to the page boundary.

Reviewed By: weicool

Differential Revision: D3207608

fb-gh-sync-id: 02f62970ed9a5e3a5f9c0d959402756bc4b3699e
fbshipit-source-id: 02f62970ed9a5e3a5f9c0d959402756bc4b3699e
2016-05-05 04:14:22 -07:00
Urban Cvek 50c2467905 Enable setting color of text and images on unselected tabs
Summary:
Hi,
This PR Solves this issue #3083.
This PR solves the problem of default color on TabBar being always grey. Which looks great if the barTintColor is unchanged. However if we set the barTintColor to something else (like blue in example) text and icons become quite unreadable.
![simulator screen shot 27 apr 2016 21 58 40](https://cloud.githubusercontent.com/assets/12081272/14866402/e51c7120-0cc3-11e6-9570-097b686c160f.png)

Commit (c206417) - Enable setting color of unselected tabs
Solves this issue with a prop (unselectedTintColor) on TabBarIOS to which you just pass a color like you can for barTintColor and tintColor.
This leaves us with a result that is on second picture. Notice the color of text on tabs.
![simulator screen shot 27 apr 2016 21 59 06](https://cloud.githubusercontent.com/assets/12081272/14866419/f77aa7e2-0cc3-11e6-8c90-33209009bc09.png)

Or change it to yellow for demonstrating purposes
![simulator screen shot 27 apr 2016 21 59 13](https://cloud.githubusercontent.com/assets/1208
Closes https://github.com/facebook/react-native/pull/7264

Differential Revision: D3240924

Pulled By: nicklockwood

fb-gh-sync-id: 14a0de28abd064756320b7a74f128c255caa6b12
fbshipit-source-id: 14a0de28abd064756320b7a74f128c255caa6b12
2016-05-03 05:40:29 -07:00
Joshua Pinter 449a81264b Add keys to hash as you need them.
Summary:
Just showing a hash of values is misleading. Makes the user think you can just pass in the values without the keys.
Closes https://github.com/facebook/react-native/pull/7310

Differential Revision: D3245834

fb-gh-sync-id: 39220ed7720e3ff402f2c2ba8bebdefb96bfa203
fbshipit-source-id: 39220ed7720e3ff402f2c2ba8bebdefb96bfa203
2016-04-30 20:40:28 -07:00
Joshua Pinter 4bbd64931b Indicate width and height params are being passed to onContentSizeChange.
Summary:
I had to do a little trial and error to find this out. Would be helpful to have it in the docs.

I'm not sure if there's a standard wording or format you prefer for indicating handler function params.
Closes https://github.com/facebook/react-native/pull/7312

Differential Revision: D3245838

fb-gh-sync-id: 89433c036f7287d9efb69605180734dbc4df4df3
fbshipit-source-id: 89433c036f7287d9efb69605180734dbc4df4df3
2016-04-30 18:28:22 -07:00
Dave Miller 850befa3cd Remove unused code
Reviewed By: davidaurelio

Differential Revision: D3240927

fb-gh-sync-id: b9ecb5269026314905a22eae3b32fd546574c5ef
fbshipit-source-id: b9ecb5269026314905a22eae3b32fd546574c5ef
2016-04-29 08:48:19 -07:00
Joshua Pinter 5e5cbda682 Show default `activeOpacity` value in docs.
Summary:
Useful to know what the default value without having to dig into the library code.
Closes https://github.com/facebook/react-native/pull/7247

Differential Revision: D3228728

Pulled By: mkonicek

fb-gh-sync-id: 433ca41d5395bbfb0c4887641a9e8b99c87b5e2b
fbshipit-source-id: 433ca41d5395bbfb0c4887641a9e8b99c87b5e2b
2016-04-29 03:45:26 -07:00
Nick Lockwood 8cfa6b6ea6 Deprecated customDirectEventTypes, and removed from RCTScrollViewManager
Summary: Using customDirectEventTypes or customBubblingEventTypes causes a viewmanager to be initialized at app start. This diff deprecates those methods and removes their usage from RCTScrollViewManager.

Reviewed By: majak

Differential Revision: D3218973

fb-gh-sync-id: 295bef3be9623b49b0cdcbf8a56e10d9b28126d9
fbshipit-source-id: 295bef3be9623b49b0cdcbf8a56e10d9b28126d9
2016-04-28 07:44:19 -07:00
Nick Lockwood c1aff6b116 Removed exported constants for fixed-size views
Summary: Creating a view instance just to get the default view size is quite expensive, and affects startup time for the bridge as it must be done on the main thread. I've removed these cases and simply hard-coded the sizes in the JS file. This will need to be updated if the view sizes ever change, but in practice that's very unlikely.

Reviewed By: javache

Differential Revision: D3218917

fb-gh-sync-id: 91a21dabb6046c5d4d5d0bec0845415cb3628ec3
fbshipit-source-id: 91a21dabb6046c5d4d5d0bec0845415cb3628ec3
2016-04-26 04:21:39 -07:00
Jeff Chien 475f1b5796 Reverted commit D3126513
Summary:Using TouchableNativeFeedback has been a problem for me because the ripples it makes don't follow the child view's border radii so the ripples stick out of the child view's rounded corners. This PR should fix this problem with a minor caveat: this only works for TouchableNativeFeedback.Ripple and not TouchableNativeFeedback.SelectableBackground. I searched how I could apply corner radius to selectableItemBackground and it doesn't seem to be possible (the prevalent advice is to create the ripple manually which is equivalent to using TNF.Ripple in our case), though I could be wrong.

I added [an example to UIExplorer (TouchableExample)](http://i.imgur.com/CHY9xjW.png). This is my first PR to this repo so let me know if something's wrong. Cheers!
Closes https://github.com/facebook/react-native/pull/6515

Differential Revision: D3126513

Pulled By: AaaChiuuu

fb-gh-sync-id: 4a00e7177ee4ffd8dffeca143f4f43f08c99b5a1
fbshipit-source-id: 4a00e7177ee4ffd8dffeca143f4f43f08c99b5a1
2016-04-24 15:45:19 -07:00
Spencer Ahrens 09a34f4d0f Integrate RelayConnection with RNFeed
Reviewed By: ericvicenti

Differential Revision: D2750242

fb-gh-sync-id: fa72d67f554823128bf62786b34e5b9592dc7c89
fbshipit-source-id: fa72d67f554823128bf62786b34e5b9592dc7c89
2016-04-22 22:48:18 -07:00
Jeff Chien e438954938 Modify TouchableNativeFeedback (Ripple) to follow borderRadius
Summary:Using TouchableNativeFeedback has been a problem for me because the ripples it makes don't follow the child view's border radii so the ripples stick out of the child view's rounded corners. This PR should fix this problem with a minor caveat: this only works for TouchableNativeFeedback.Ripple and not TouchableNativeFeedback.SelectableBackground. I searched how I could apply corner radius to selectableItemBackground and it doesn't seem to be possible (the prevalent advice is to create the ripple manually which is equivalent to using TNF.Ripple in our case), though I could be wrong.

I added [an example to UIExplorer (TouchableExample)](http://i.imgur.com/CHY9xjW.png). This is my first PR to this repo so let me know if something's wrong. Cheers!
Closes https://github.com/facebook/react-native/pull/6515

Differential Revision: D3126513

Pulled By: mkonicek

fb-gh-sync-id: 1d3e92243abf9706132ae47c485d9e04a9b47d81
fbshipit-source-id: 1d3e92243abf9706132ae47c485d9e04a9b47d81
2016-04-22 09:07:50 -07:00
Andrew Gray 774296b263 Implemented stopLoading
Summary:**Motivation:** In my app, I'm using a WebView that loads content from my mobile site.  What I want to do is when a user presses a link on the loaded page, I want to stop the WebView's request, hijack the URL and open the URL in a new WebView, pushed to the top of the navigator stack.  To me, this gives the overall app a more native feel, instead of implementing a rudimentary navbar on the main WebView to go back.

**Attempted Workarounds:** I've attempted to get similar functionality by capturing the onNavigationStateChange event in the WebView, and then within calling goBack + pushing the new view to the navigator stack.  From a functionality standpoint, this works.  However, from a UI standpoint, the user can clearly see the webview change states to a new page + go back before having the new view pushed on top of their nav stack.
Closes https://github.com/facebook/react-native/pull/6886

Differential Revision: D3212447

Pulled By: mkonicek

fb-gh-sync-id: 05911e583d9ba54ddbd54a772153c80ed227731e
fbshipit-source-id: 05911e583d9ba54ddbd54a772153c80ed227731e
2016-04-22 08:15:25 -07:00
glevi@fb.com 91d4a093ea Fix or suppress errors in react-native
Reviewed By: jeffmo

Differential Revision: D3209973

fb-gh-sync-id: bdc9b4afc0b187b1b16fa6bfb1c34adb4089ab81
fbshipit-source-id: bdc9b4afc0b187b1b16fa6bfb1c34adb4089ab81
2016-04-21 19:47:24 -07:00
Angela Hess 5a93877673 Add ability to disable scroll on android ViewPager
Summary: Similar to ScrollView, adds ability to set scrollEnabled={false}, which prevents dragging. Paging is still possible by updating initialPage.

Reviewed By: AaaChiuuu

Differential Revision: D3209743

fb-gh-sync-id: ce4140323a03f2257a9bb310c7285418b01abae7
fbshipit-source-id: ce4140323a03f2257a9bb310c7285418b01abae7
2016-04-21 19:43:27 -07:00
Ben Nham 91dcc9ac8e Fix autocomplete in rich-text editing mode for CJK text input
Summary:This fixes autocomplete for CJK text input by making sure that the `<Text>` nodes that JS controls to produce attributed text matches the text view's attributed text as much as possible. This is done by giving the disconnected `<Text>` child the same style as the `<TextInput>` parent.

This works because `-[RKTextView performPendingTextUpdate]` avoids setting the attributedText property on textView if the JS attributedText and textView attributedText are equal. This is important because setting attributedText on a text view clears the autocomplete state (markedText property) on a text view, breaking autocomplete for multistage input styles like CJK with a phonetic keyboard.

Reviewed By: nicklockwood

Differential Revision: D3207513

fb-gh-sync-id: 02e582ea5f15191974f15a65ebc1820401715f8d
fbshipit-source-id: 02e582ea5f15191974f15a65ebc1820401715f8d
2016-04-21 12:10:25 -07:00
Sebastian Markbage 47a470a97c Move React Core Integration to a Dependency
Summary:Adding the react native renderer dependency and various fixes to support React 15.

Don't use dispatchID for touchableHandleResponderGrant

This callback argument was removed because "IDs" no longer exist. Instead, we'll
use the tag from the event target.

The corresponding PR on React Core is: https://github.com/facebook/react/pull/6338

Reviewed By: spicyj

Differential Revision: D3159788

fb-gh-sync-id: 60e5cd2aa0af69d83fcdac3dfde0a85a748cb7b9
fbshipit-source-id: 60e5cd2aa0af69d83fcdac3dfde0a85a748cb7b9
2016-04-21 09:28:23 -07:00
Spencer Ahrens 99705440a0 Fix some warnings.
Reviewed By: AaaChiuuu

Differential Revision: D3206005

fb-gh-sync-id: 88c0cec6b88479fac747a7ef6a677df30c282089
fbshipit-source-id: 88c0cec6b88479fac747a7ef6a677df30c282089
2016-04-20 20:45:22 -07:00
Dan Nolan c342d3d75d Update Switch.js
Summary:Hi there,

This PR reorganises the flow for updating native props so that if you have a switch that's replaced with a spinner to handle a network action, you don't get a crash trying to update native props when an item may be moved out from underneath you. This was previously accepted but I had to rebase it so I just recreated it given it was a two line fix
Closes https://github.com/facebook/react-native/pull/6989

Differential Revision: D3190326

fb-gh-sync-id: 357ffb36bb31bd23970e4ab396fc29a49ec18e1c
fbshipit-source-id: 357ffb36bb31bd23970e4ab396fc29a49ec18e1c
2016-04-17 21:01:29 -07:00
Olivier Notteghem b505fdb57d Decrease TTRR (time to relay request) by lazy rendering fake group header
Reviewed By: astreet

Differential Revision: D3155945

fb-gh-sync-id: b8ab8934555428aef98901288edc66d9ef251d96
fbshipit-source-id: b8ab8934555428aef98901288edc66d9ef251d96
2016-04-17 15:04:19 -07:00
Jia Rong Lim 7851572b40 Fix DrawerLayoutAndroid not able to set opacity
Summary:I'm just cleaning up my branch, but please refer to https://github.com/facebook/react-native/pull/6948.
Closes https://github.com/facebook/react-native/pull/7012

Differential Revision: D3189533

fb-gh-sync-id: 3953b1373ddcfd0fe29c0011c943855b55e1f181
fbshipit-source-id: 3953b1373ddcfd0fe29c0011c943855b55e1f181
2016-04-16 22:45:22 -07:00
Sokovikov 849a0f31ac Allow to set refresh control title color
Summary:Closes #6812

![simulator screen shot 14 apr 2016 12 13 36](https://cloud.githubusercontent.com/assets/1488195/14521441/0abccf5c-0232-11e6-94dc-0ebdbfac4b3f.png)
Closes https://github.com/facebook/react-native/pull/6970

Differential Revision: D3189244

fb-gh-sync-id: 7625b6ab5859aaa20bc0cb379855c5daeb584abf
fbshipit-source-id: 7625b6ab5859aaa20bc0cb379855c5daeb584abf
2016-04-16 15:15:25 -07:00
Spencer Ahrens d5c1de7708 Hook up touchable debugging to Inspector button
Reviewed By: vjeux

Differential Revision: D3188719

fb-gh-sync-id: 271e902399900242f577a77807868bd2a28add37
fbshipit-source-id: 271e902399900242f577a77807868bd2a28add37
2016-04-16 11:57:22 -07:00
Spencer Ahrens 0e719bd5ca UNBREAK open source and prod apps
Reviewed By: bestander

Differential Revision: D3182004

fb-gh-sync-id: 7346e3fd85eeed8ba103ccc1fd60c86c8a656712
fbshipit-source-id: 7346e3fd85eeed8ba103ccc1fd60c86c8a656712
2016-04-14 15:47:17 -07:00
Spencer Ahrens 5c9b46c15e Improve touchable debugging
Summary:Set `Touchable.TOUCH_TARGET_DEBUG` to see colored borders/text to all touchables.

Different touchable types are color-coded differently.

If there is `hitSlop`, it will be rendered with an extra view with a dashed border of the same color (not visible on
Android because `overflow: 'hidden'`).

`Text` with `onPress` directly set is just colored.

Added some extra checks to `TouchableWithoutFeedback` since it could silently break if the child is not a native
component.

Also added better error output for `ensureComponentIsNative` so it's easier to track down issues. I really wish there
was a cleaner way to get the component and owner names consistently, it would help make good debug messages way easier
to write.

Reviewed By: ericvicenti

Differential Revision: D3149865

fb-gh-sync-id: 602fc3474ae7636e32af529eb7ac52ac5b858030
fbshipit-source-id: 602fc3474ae7636e32af529eb7ac52ac5b858030
2016-04-14 14:28:31 -07:00
Janic Duplessis eac617d6ee Add null check before accessing the refresh control ref
Summary:Unmounting the RefreshControl during onRefresh callback causes the native ref to become null, this simply adds a null check to prevent the crash.
Closes https://github.com/facebook/react-native/pull/6931

Differential Revision: D3167637

fb-gh-sync-id: c2420b7a3b672d62dd349a6d35bb05399a00620c
fbshipit-source-id: c2420b7a3b672d62dd349a6d35bb05399a00620c
2016-04-12 01:27:18 -07:00
Janic Duplessis d66b944727 Fix DrawerLayoutAndroid method parameter
Summary:Oups, forgot to remove a test in #6890 :)
Closes https://github.com/facebook/react-native/pull/6898

Differential Revision: D3161421

Pulled By: mkonicek

fb-gh-sync-id: a7e6b4f31822e67dcf1d898306851a112160d20f
fbshipit-source-id: a7e6b4f31822e67dcf1d898306851a112160d20f
2016-04-11 04:27:27 -07:00
Janic Duplessis 49fdd99633 Display component methods on the website and tweak the documentation
Summary:The website now displays public methods on components. This was implemented mostly in react-docgen via #66. This adds a <Method> component that is used by the component and API doc pages to display documentation for a method.

It also adds some missing documentation and tweak some existing one to integrate with this feature. I also prefixed some component methods with an '_' so they don't show up in the doc.

**Test plan (required)**

Tested every component page locally to make sure the methods doc was displayed properly.
Tested an API page to make sure it still worked properly.
Closes https://github.com/facebook/react-native/pull/6890

Differential Revision: D3159911

Pulled By: vjeux

fb-gh-sync-id: 1e6a4640cda6794496d9844c1af6a1451c017dcc
fbshipit-source-id: 1e6a4640cda6794496d9844c1af6a1451c017dcc
2016-04-09 11:13:28 -07:00
Sebastian Markbage 613ca14612 React.findNodeHandle -> ReactNative.findNodeHandle
Summary:Since the React 0.14 split of modules, the findNodeHandle feature is part of the
renderer and not the generic React API.

This just greps for React.findNodeHandle and replace them with ReactNative.findNodeHandle. I fixed up the imports manually.

I also found two callers each of ReactNative.createClass and React.render with the exception of downstream and examples will fix them separately.

I'll need to find more things like `var { PropTypes } = ReactNative;` separately. I think this is a good start though.

Reviewed By: vjeux

Differential Revision: D3149356

fb-gh-sync-id: 50ed60bc67270b16f561d4c641f2f19e85724d3b
fbshipit-source-id: 50ed60bc67270b16f561d4c641f2f19e85724d3b
2016-04-07 19:44:31 -07:00
Felix Oghina 6038040f8e expose pageMargin prop on ViewPagerAndroid
Reviewed By: sahrens

Differential Revision: D3145366

fb-gh-sync-id: 6412d51a698b2c932c915e405e4bbc35e96060dc
fbshipit-source-id: 6412d51a698b2c932c915e405e4bbc35e96060dc
2016-04-07 18:09:29 -07:00
Martin Konicek 5f77f15bac Remove confusing warning from ScrollResponder
Summary:I get this warning in cases when nothing went wrong.

Not sure what I can do about the warning. I placed a few sliders in a ScrollView and everything works as expected, so the warning is very confusing.

Lots of people have been hitting the warning and getting confused by it as well:
- https://github.com/facebook/react-native/issues/1501
- https://productpains.com/post/react-native/scrollview-warning-scrollview-doesnt-take-rejection-well-scrolls-anyway (it's one of the [highest rated](https://productpains.com/product/react-native?tab=top) issues).

Reviewed By: sahrens

Differential Revision: D3138736

fb-gh-sync-id: 601b8dfc275a14dff6f17a7903c65bd8347a73e9
fbshipit-source-id: 601b8dfc275a14dff6f17a7903c65bd8347a73e9
2016-04-07 10:15:25 -07:00
Nick 2a03182b1c CHORE - Remove Trailing Spaces
Summary:Remove Trailing Spaces.

Why:
Sometimes there are conflicts with trailing spaces
Saves space
Those whose tools automatically delete them will have their pr watered down with trailing space removal
Closes https://github.com/facebook/react-native/pull/6787

Differential Revision: D3144704

fb-gh-sync-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
fbshipit-source-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
2016-04-06 09:21:53 -07:00
kapil verma 97696b61c8 Fixed typo in docs
Summary: Closes https://github.com/facebook/react-native/pull/6772

Differential Revision: D3144702

fb-gh-sync-id: f7e6743bc361652f16f50af19305822d05a047fa
fbshipit-source-id: f7e6743bc361652f16f50af19305822d05a047fa
2016-04-06 08:55:20 -07:00
Martin Konicek 9adef91333 Fix website after open sourcing Slider
Reviewed By: bestander

Differential Revision: D3144673

fb-gh-sync-id: bdfc35606c29b227228474e5e6a9c0087898783d
fbshipit-source-id: bdfc35606c29b227228474e5e6a9c0087898783d
2016-04-06 08:51:23 -07:00
Martin Konicek a461d25601 Open source Android slider
Reviewed By: bestander

Differential Revision: D3127200

fb-gh-sync-id: d3d51b312c2e32cc7a0f4c0bc084139343e97c3e
fbshipit-source-id: d3d51b312c2e32cc7a0f4c0bc084139343e97c3e
2016-04-06 04:50:57 -07:00
Martin Konicek 52ddfd9b51 Bugfix: Make iOS Slider it the responder
Summary:This fixes issues with other view (like the Navigator) stealing the responder and becoming interactive while the user is dragging the slider.

From [documentation](https://facebook.github.io/react-native/docs/gesture-responder-system.html):
- `onStartShouldSetResponder`: Does this view want to become responder on the start of a touch? -> Yes.
- `onResponderTerminationRequest`: Something else wants to become responder. Should this view release the responder? -> No.

Reviewed By: ericvicenti

Differential Revision: D3133337

fb-gh-sync-id: 3d7e1e6a2ed6fa605857cfb0549ffa71df85fd22
fbshipit-source-id: 3d7e1e6a2ed6fa605857cfb0549ffa71df85fd22
2016-04-04 08:24:18 -07:00
Nicolas Charpentier a74d05be62 Add default render loading on Android WebView
Summary:I just noticed that Android WebView do not have a render loading default like iOS, so I added one.

**Test plan**

I used WebView without renderLoading on Android.

![image](https://cloud.githubusercontent.com/assets/7189823/14028408/bd94c83e-f1d2-11e5-8791-3372684b429e.png)
Closes https://github.com/facebook/react-native/pull/6635

Differential Revision: D3126416

Pulled By: andreicoman11

fb-gh-sync-id: 422966ba3dd6912cbcb0b540e26a3ec48c85daea
fbshipit-source-id: 422966ba3dd6912cbcb0b540e26a3ec48c85daea
2016-04-01 08:05:21 -07:00
Dmitry Gladkov b5106a8fca Implement TextInput.selectTextOnFocus for Android
Summary:Uses native Android `TextView.setSelectAllOnFocus` method. Triggers TextInput's `onSelectionChanged` event on focus as expected.
Closes https://github.com/facebook/react-native/pull/6654

Differential Revision: D3126354

Pulled By: mkonicek

fb-gh-sync-id: faa64314c0ddc87296277ccd707f18effef8f407
fbshipit-source-id: faa64314c0ddc87296277ccd707f18effef8f407
2016-04-01 07:16:20 -07:00
Nathan Spaun 4498bc8197 Add prop to FbReactScrollView to fill the rest of the background to avoid overdraw
Reviewed By: foghina

Differential Revision: D3079290

fb-gh-sync-id: b824d235ca34f8e0408f5f40e6b73e028006ac9f
fbshipit-source-id: b824d235ca34f8e0408f5f40e6b73e028006ac9f
2016-03-30 18:06:19 -07:00
Janic Duplessis 039924ec70 Add statusBarBackgroundColor to DrawerLayoutAndroid to allow it to open over the status bar
Summary:The navigation drawer of most apps on android opens over the status bar, this adds an option to do so. It implements a similar API to the native DrawerLayout by adding a statusBarBackgroundColor to DrawerLayoutAndroid.

Without statusBarBackgroundColor:
![image](https://cloud.githubusercontent.com/assets/2677334/13414490/50ebcdf4-df21-11e5-974f-c6a1343c2a4e.png)

With statusBarBackgroundColor:
![image](https://cloud.githubusercontent.com/assets/2677334/13414459/1fdc4086-df21-11e5-9658-bd47bfdb925f.png)

This PR depends on the changes in #6195 to add the `StatusBar.HEIGHT` constant I just want to put it out there now to see if this looks good. To test without the other PR just change `StatusBar.HEIGHT` for `25`.

It is implemented by making the native status bar translucent and making its background color transparent so we can draw a view of the same height as the status bar under it as a child of the DrawerLayoutAndroid. Then we can draw a semi-transparent gray View inside the drawer view to make it
Closes https://github.com/facebook/react-native/pull/6218

Differential Revision: D3017444

Pulled By: bestander

fb-gh-sync-id: ca48a47a20a2feecae360a76f3e2c9bbe6a37700
fbshipit-source-id: ca48a47a20a2feecae360a76f3e2c9bbe6a37700
2016-03-30 05:30:22 -07:00
Quinten Powell 258b43948f Fix minor typo in Imperative API notes
Summary:Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

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).
Closes https://github.com/facebook/react-native/pull/6706

Differential Revision: D3109403

fb-gh-sync-id: 4c92b4dc7950377f9efad6129a49c594bcd9a68a
fbshipit-source-id: 4c92b4dc7950377f9efad6129a49c594bcd9a68a
2016-03-29 09:18:26 -07:00
Tim Yung 235b16d932 RN: Improve <Switch> Documentation
Summary: Minor improvements to the <Switch> docblock, including adding some keywords to make it easier to find. Also, I updated documentation for the deprecated platform-specific versions of the component.

Reviewed By: jingc

Differential Revision: D3098626

fb-gh-sync-id: 86d0f1a45eb8ac1bd9e58ac4ba9c73a4a3dfa846
fbshipit-source-id: 86d0f1a45eb8ac1bd9e58ac4ba9c73a4a3dfa846
2016-03-25 15:17:20 -07:00
Janic Duplessis 56c40baa06 Fix bad wording in pointer events doc
Summary:Fix bad wording in the docs change I did in #6534

cc mkonicek
Closes https://github.com/facebook/react-native/pull/6598

Differential Revision: D3085957

Pulled By: vjeux

fb-gh-sync-id: 2b45ac72acf089be6cf8e815aac430a2ce9d08ed
shipit-source-id: 2b45ac72acf089be6cf8e815aac430a2ce9d08ed
2016-03-24 19:53:26 -07:00
Dave Miller bd8007300f Remove sendMomentumEvents property from public ScrollView properties
Summary: This property is only used by the native code as an optimization to not send events that no one is listening to.  We don't need to expose it externally on the js api.  Set sendMomentumEvent to be a native only property.

Reviewed By: bestander

Differential Revision: D3092650

fb-gh-sync-id: 95f5f0ae4cd04a7d1cbc9cf17c93647d3c644878
shipit-source-id: 95f5f0ae4cd04a7d1cbc9cf17c93647d3c644878
2016-03-24 05:43:25 -07:00
Dave Miller ad41a0b326 Clean up dead code in ScrollView
Summary: I see dead code

Reviewed By: bestander

Differential Revision: D3092668

fb-gh-sync-id: d80a0267aafd856b63e1d2ff1ae8b8e9f6deb8ce
shipit-source-id: d80a0267aafd856b63e1d2ff1ae8b8e9f6deb8ce
2016-03-24 05:29:20 -07:00
Janic Duplessis 61483aa15d Add support for elevation in DrawerLayoutAndroid
Summary:It didn't work for a few reason. First, the drawer view NEEDS to have a background color or no shadow will ever render. Second, we need to use the `setDrawerElevation` method instead of `setElevation` for DrawerLayout. Finally we need to actually pass the style value (maybe we could just pass elevation but I don't really think it can cause any issues) down to the native component as it is not the case at the moment.

I also added a default style to elevation of 16 which is the standard for material design according to https://www.google.com/design/spec/patterns/navigation-drawer.html#navigation-drawer-specs. I could also default it to 0 so it keeps the same appearance as before but I think it looks better this way.

Closes #6022
**Test plan**
Tested using the DrawerLayout in the UIExplorer app.

Before, elevation 0
<img width="420" alt="screen shot 2016-02-23 at 1 55 42 am" src="https://cloud.githubusercontent.com/assets/2677334/13244000/008afdb2-d9d1-11e5-95b8-9c345ea0ea8d.png">

After, elevation
Closes https://github.com/facebook/react-native/pull/6100

Reviewed By: bestander

Differential Revision: D3012242

Pulled By: lexs

fb-gh-sync-id: 4967d7ec920f0229d823032ba95c8a3cace329c6
shipit-source-id: 4967d7ec920f0229d823032ba95c8a3cace329c6
2016-03-21 06:24:33 -07:00
pedramsaleh b85f0ac74f Update SegmentedControlIOS.ios.js
Summary:Updating the comments to clarify that the selectedIndex prop is not just for pre-selecting an index, but that it can also be used to programmatically change the value of the selected index.
Closes https://github.com/facebook/react-native/pull/6519

Differential Revision: D3075199

Pulled By: mkonicek

fb-gh-sync-id: 8ce336ad491bb2fed13df15ebddb1b24535c50ff
shipit-source-id: 8ce336ad491bb2fed13df15ebddb1b24535c50ff
2016-03-20 18:07:23 -07:00
Janic Duplessis f1a0695c7d Improve pointerEvents doc
Summary:The docs for touchEvents was really unclear and assumed that you know what `pointer-events` does in CSS. This is confusing especially for native developers, see [this issue](http://stackoverflow.com/questions/36068392/set-userinteractionenabled-false-in-react-native/36096413) on stack overflow.

I added a short description to the prop and all the possible enum values and made it so the comment that explain why it is a prop and not a style doesn't appear on the website as it is not really relevant there.

**Test plan (required)**
Tested by running the website locally.
Closes https://github.com/facebook/react-native/pull/6534

Differential Revision: D3075198

Pulled By: mkonicek

fb-gh-sync-id: 57c8444fc83a31599dc872c361b142531cdd4885
shipit-source-id: 57c8444fc83a31599dc872c361b142531cdd4885
2016-03-20 18:02:18 -07:00
Nick Hudkins a3ba25ed90 Correct scrollEventThrottle docs
Summary:The docs indicated that a higher number was more accurate, however based on the implementation:

```
  /**
   * TODO: this logic looks wrong, and it may be because it is. Currently, if _scrollEventThrottle
   * is set to zero (the default), the "didScroll" event is only sent once per scroll, instead of repeatedly
   * while scrolling as expected. However, if you "fix" that bug, ScrollView will generate repeated
   * warnings, and behave strangely (ListView works fine however), so don't fix it unless you fix that too!
   */
  if (_allowNextScrollNoMatterWhat ||
      (_scrollEventThrottle > 0 && _scrollEventThrottle < (now - _lastScrollDispatchTime)))
```
https://github.com/facebook/react-native/blob/master/React/Views/RCTScrollView.m#L564

It appears that only 0 is a special case here, and perhaps a known issue ;)
Closes https://github.com/facebook/react-native/pull/3729

Differential Revision: D3074801

Pulled By: mkonicek

fb-gh-sync-id: f63b00755f7565165cc628085efa5ed96badcfe1
shipit-source-id: f63b00755f7565165cc628085efa5ed96badcfe1
2016-03-20 09:52:22 -07:00
Dave Miller a6ada1e946 Remove DEV warning about ScrollEventThrottle on Android where it is not supported
Reviewed By: bestander

Differential Revision: D3069574

fb-gh-sync-id: f0d9aca754e45a34836d26febdabacb6424ca371
shipit-source-id: f0d9aca754e45a34836d26febdabacb6424ca371
2016-03-18 09:05:22 -07:00
Janic Duplessis 18f38ecdc0 Add StatusBar height constant and improve implementation
Summary:This adds a `HEIGHT` constant on `StatusBar` on Android. I needed only this for now but I will work on a better status bar dimensions API later (see TODO).

It also improves the implementation to fix a bug that happened when multiple `StatusBar` components get updated in the same frame as well as remove useless calls to the `StatusBarModule` when values did not change.

Instead of calling the `StatusBarManager` immediately when the component gets updated and relying on the order of the calls that get dispatched to native we now wait at the end of the frame to send the calls to the `StatusBarManager` using `setImmediate`. To make this work properly we need to change the data structure of the props stack a little bit to store the desired transition/animation too for each value.

Finally this updates the example to only show the ones that work for the current platform.

**Test plan**
In the UIExplorer Example, in the 'StatusBar dimensions' section it should show 25 for the height of the status bar.
A
Closes https://github.com/facebook/react-native/pull/6195

Differential Revision: D3017559

fb-gh-sync-id: d6f4c6a72a2dfde83496ecc0f56dca4abaf3055e
shipit-source-id: d6f4c6a72a2dfde83496ecc0f56dca4abaf3055e
2016-03-17 16:54:26 -07:00
Thomas Beverley 0be6031bc6 Added mediaPlaybackRequiresUserAction to WebView
Summary:Just added a pass through to the `WebView` for `mediaPlaybackRequiresUserAction` and `setMediaPlaybackRequiresUserGesture` to allow auto-playing audio and video elements
Closes https://github.com/facebook/react-native/pull/5956

Differential Revision: D3053554

Pulled By: mkonicek

fb-gh-sync-id: a1f362c1551de1a0218f5d23c70668e4c8078993
shipit-source-id: a1f362c1551de1a0218f5d23c70668e4c8078993
2016-03-16 10:03:26 -07:00
Eaden d63762194d Fix bug #5604 - Unrecognised signal for touchable no longer on the screen
Summary:Fixes bug https://github.com/facebook/react-native/issues/5604 ("Redscreen error when TouchRelease triggered on a component no longer in the tree")

( maybe not ideally )

This issue is triggered by the following:

A Touch event on a component ( Keep Pressing )
A state/props update removes the component from the tree and render is performed
A Touch Release event. ( When you release the press on the component no longer there )

This fix adds an early return to the signal handling code if a RESPONDER_RELEASE signal happens when the responder has disappeared
Closes https://github.com/facebook/react-native/pull/5637

Differential Revision: D3053729

Pulled By: sahrens

fb-gh-sync-id: 21a2a303d8921654607eaab824ef28fc16df9500
shipit-source-id: 21a2a303d8921654607eaab824ef28fc16df9500
2016-03-15 12:23:32 -07:00
Szabó Krisztián 265b63866a Fix typo in ScrollView childLayoutProps error message
Summary:Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

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

Example: When "Adding a function to do X", explain why it is necessary to have a way to do X.

**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**

See the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).
Closes https://github.com/facebook/react-native/pull/6454

Differential Revision: D3049074

Pulled By: sahrens

fb-gh-sync-id: 61d085bb5c7bedf80204cdfb94e5c23542e15333
shipit-source-id: 61d085bb5c7bedf80204cdfb94e5c23542e15333
2016-03-14 14:35:27 -07:00
Janic Duplessis 88ebdb2a65 RefreshControl refreshing prop and doc improvements
Summary:This makes the `refreshing` prop more 'controlled'. Before forgetting to set the refreshing prop in the onRefresh callback would make the js and native `refreshing` prop get out of sync and make the RefreshControl stop refreshing properly (see #5839).

I also added a simple usage example and a note about the refreshing prop in the doc.

There was also a small bug in the doc generation code that made the array of color show as [[object Object]] instead of [color] so I fixed that too.

** Test plan**
Tested using the UIExplorer example on iOS and Android. Not setting the `refreshing` prop to true in the `onRefresh` function should cause the RefreshControl to stop refreshing immediately and continue working properly after.

Closes #5839
Closes https://github.com/facebook/react-native/pull/6434

Differential Revision: D3046279

Pulled By: nicklockwood

fb-gh-sync-id: ebda04c659a10f0b9d468473c8d5c659256ca1b5
shipit-source-id: ebda04c659a10f0b9d468473c8d5c659256ca1b5
2016-03-13 03:04:24 -07:00
Charles Pletcher f5a1600a20 Fixes #1509 -- Add note about side-specific properties on TextInput
Summary:Add note about side-specific properties not being applied to `TextInput`s if `multiline=false`.

Fix formatting of docs describing other `multiline={true/false}` quirks.
Closes https://github.com/facebook/react-native/pull/2240

Differential Revision: D3037154

Pulled By: andreicoman11

fb-gh-sync-id: d64db906c2ab0054f2357b8e218725414d9868d6
shipit-source-id: d64db906c2ab0054f2357b8e218725414d9868d6
2016-03-10 13:44:23 -08:00
Nick Lockwood 520ad05ba0 Removed unnecessary exportedConstants
Summary: The exportedConstants method incurrs a penalty at bridge startup time for every module that implements it. This diff removes exportedConstants from a few modules that don't really need to use it.

Reviewed By: majak

Differential Revision: D2982341

fb-gh-sync-id: be016187d7b731a073311daacfcf88a0402e1688
shipit-source-id: be016187d7b731a073311daacfcf88a0402e1688
2016-03-10 10:21:34 -08:00
sunnylqm 20cd7ac339 add hyphen on drawerLockMode values
Summary: Closes https://github.com/facebook/react-native/pull/6396

Differential Revision: D3034612

Pulled By: nicklockwood

fb-gh-sync-id: cd20d405b7064e167b895411decedfae215f3b8b
shipit-source-id: cd20d405b7064e167b895411decedfae215f3b8b
2016-03-10 08:24:23 -08:00
mangogogos 06a41c3785 Forward touchable events to TouchableNativeFeedback
Summary:Fixes #6256
Closes https://github.com/facebook/react-native/pull/6344

Differential Revision: D3021478

Pulled By: mkonicek

fb-gh-sync-id: 350cf72ad73d06d97cc1663e0d69c0c97977689e
shipit-source-id: 350cf72ad73d06d97cc1663e0d69c0c97977689e
2016-03-08 12:12:39 -08:00
AbilashK ab12189f87 Enable blurOnSubmit for text input in android
Summary:PR for https://github.com/facebook/react-native/issues/6098, Added tests to UIExplorer based on existing iOS example.

Before:
![blur_true](https://cloud.githubusercontent.com/assets/11550281/13401854/cd66117a-df33-11e5-875d-e1f132e2fc82.gif)

After:
![blur_false](https://cloud.githubusercontent.com/assets/11550281/13401874/de1dd1ce-df33-11e5-8210-e6bee80240fb.gif)
Closes https://github.com/facebook/react-native/pull/6215

Differential Revision: D3000042

Pulled By: mkonicek

fb-gh-sync-id: 7f01270580b198498505d92e38a456c0b3a01488
shipit-source-id: 7f01270580b198498505d92e38a456c0b3a01488
2016-03-02 07:07:32 -08:00
David Aurelio ad8a335864 Remove knowledge of fbjs from the packager
Summary:Follow-up to https://github.com/facebook/react-native/pull/5084

This…
- changes all requires within RN to `require('fbjs/lib/…')`
- updates `.flowconfig`
- updates `packager/blacklist.js`
- adapts tests
- removes things from `Libraries/vendor/{core,emitter}` that are also in fbjs
- removes knowledge of `fbjs` from the packager

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

Reviewed By: bestander

Differential Revision: D2926835

fb-gh-sync-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
shipit-source-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
2016-03-02 04:28:38 -08:00
PJ Cabrera 3ed66ee7b5 Fix scrollResponderScrollTo deprecated warning
Summary:Fix the warning generated when some ScrollResponder methods call the deprecated form of scrollResponderScrollTo.
Closes https://github.com/facebook/react-native/pull/6138

Differential Revision: D2976681

fb-gh-sync-id: 3f5195aeebbffeccadb4bbffc55d52d7f89a9b2d
shipit-source-id: 3f5195aeebbffeccadb4bbffc55d52d7f89a9b2d
2016-02-25 06:26:34 -08:00
Andreas Drivenes ec173b1a17 Add drawerLockMode prop to DrawerLayoutAndroid
Summary:Closes #5270.
Closes https://github.com/facebook/react-native/pull/5534

Differential Revision: D2970771

fb-gh-sync-id: 36a814032283df7d4c469964f803b8d20d1b0c93
shipit-source-id: 36a814032283df7d4c469964f803b8d20d1b0c93
2016-02-24 03:25:30 -08:00
Kureev Alexey 9951e1ab04 Introduce disabling for Touchable* elements
Summary:Introduce a `disabled` property for Touchable* components.

Fix https://github.com/facebook/react-native/issues/2103
Closes https://github.com/facebook/react-native/pull/5931

Differential Revision: D2969790

Pulled By: mkonicek

fb-gh-sync-id: 570a4ff882219f52f2d2ebef3eb73b1df50a0877
shipit-source-id: 570a4ff882219f52f2d2ebef3eb73b1df50a0877
2016-02-23 19:39:33 -08:00
Janic Duplessis 91788d2bbd Deprecate PullToRefreshViewAndroid and remove it from the website
Summary:I forgot to add a deprecation warning to PullToRefreshViewAndroid when I worked on RefreshControl. This adds one as well as remove it from the website and remove the UIExplorer example. Now that we have versioned doc I think it is fine to remove deprecated stuff from the website so it is easier for users to know what component they should use. Last thing, I enabled flow in RefreshControl and fixed the one warning.
Closes https://github.com/facebook/react-native/pull/6055

Differential Revision: D2959502

Pulled By: mkonicek

fb-gh-sync-id: 9b23f84ea35c770bfe2a83d0fd3ec7e439669c33
shipit-source-id: 9b23f84ea35c770bfe2a83d0fd3ec7e439669c33
2016-02-21 16:17:36 -08:00
Jimmy Mayoukou b454d31ab8 Add position to Picker onValueChange's call
Summary:According to the [docs](http://facebook.github.io/react-native/releases/0.20/docs/picker.html#onvaluechange), `Picker`'s `onValueChange` should be called with `itemValue` and `itemPosition` but currently only `itemValue` is passed. This PR fixes that.
The position is passed as the 2nd parameter to not introduce any breaking change, and also to respect the current documentation.
The documentation doesn't need to be changed as it will be correct with this PR, but maybe it needs to be updated until this is merged?
Closes https://github.com/facebook/react-native/pull/5874

Differential Revision: D2953936

Pulled By: nicklockwood

fb-gh-sync-id: b8c1283013d4c7ed315066d8750f601f76f6bbb2
shipit-source-id: b8c1283013d4c7ed315066d8750f601f76f6bbb2
2016-02-19 06:50:33 -08:00
AbilashK 4b97137eee Enable scalesPageToFit on Android
Summary:PR for https://github.com/facebook/react-native/issues/5958. The viewport meta tags if present, are overridden from the page and it is rendered according to the screen size. An example has been added in the Web View section of UIExplorer demo app.
Closes https://github.com/facebook/react-native/pull/6013

Differential Revision: D2953940

Pulled By: nicklockwood

fb-gh-sync-id: 012769f3a2a3f7dc942b60de02a9d1b80a27236e
shipit-source-id: 012769f3a2a3f7dc942b60de02a9d1b80a27236e
2016-02-19 06:28:34 -08:00
Jack Wink 78a9125de8 Update `ScrollResponder.js` to use new `scrollTo` API
Summary:`scrollResponderInputMeasureAndScrollToKeyboard` is the only non-deprecated method in `ScrollResponder.js` that doesn't use the [new `scrollTo` API](6941c4e027). The other method that uses the deprecated API (`scrollResponderScrollWithoutAnimationTo`) is also deprecated, so it has been left unaltered.
Closes https://github.com/facebook/react-native/pull/5990

Differential Revision: D2953916

Pulled By: nicklockwood

fb-gh-sync-id: d692c598e6b85d1050e58b87146d01b031653a49
shipit-source-id: d692c598e6b85d1050e58b87146d01b031653a49
2016-02-19 05:08:30 -08:00
Dave Miller d0f1466cdd Default javaScriptEnabled to true
Summary:public
Default javaScriptEnabled to true on Android WebView
Also remove an old (about 6 weeks old) warning about a back compat supported property

Reviewed By: nicklockwood

Differential Revision: D2939482

fb-gh-sync-id: 2d476c3365f657da27ea370a033b23154750c2ea
shipit-source-id: 2d476c3365f657da27ea370a033b23154750c2ea
2016-02-17 04:05:29 -08:00
Jesse Ruder 0176ac488e Add hitSlop prop on iOS and Android
Summary:New prop `hitSlop` allows extending the touch area of Touchable components. This makes it easier to touch small buttons without needing to change your styles.

It takes `top`, `bottom`, `left`, and `right` same as the `pressRetentionOffset` prop. When a touch is moved, `hitSlop` is combined with `pressRetentionOffset` to determine how far the touch can move off the button before deactivating the button.

On Android I had to add a new file `ids.xml` to generate a unique ID to use for the tag where I store the `hitSlop` state. The iOS side is more straightforward.

terribleben worked on the iOS and JS parts of this diff.

Fixes #110
Closes https://github.com/facebook/react-native/pull/5720

Differential Revision: D2941671

Pulled By: androidtrunkagent

fb-gh-sync-id: 07e3eb8b6a36eebf76968fdaac3c6ac335603194
shipit-source-id: 07e3eb8b6a36eebf76968fdaac3c6ac335603194
2016-02-16 16:51:39 -08:00
Janic Duplessis edbe6a2b24 Add imperative API to StatusBar
Reviewed By: svcscm

Differential Revision: D2938743

fb-gh-sync-id: 30af304efd5b089854d9a8defc1b77fd8e817d13
shipit-source-id: 30af304efd5b089854d9a8defc1b77fd8e817d13
2016-02-16 03:04:49 -08:00
trave7er 4237a27ec9 pick up some easy-to-fix lint warnings
Reviewed By: svcscm

Differential Revision: D2938097

fb-gh-sync-id: e3373bd44267251d8351d5203be1c88676aa8685
shipit-source-id: e3373bd44267251d8351d5203be1c88676aa8685
2016-02-16 02:00:57 -08:00
Satyajit Sahoo 46a8f1d8e0 Annotate Clipboard module
Reviewed By: svcscm

Differential Revision: D2866837

fb-gh-sync-id: 0f7da139e1296aec6a518d52056a6d0a1b9c07ca
shipit-source-id: 0f7da139e1296aec6a518d52056a6d0a1b9c07ca
2016-02-15 10:05:34 -08:00
Emily Janzer e93afad284 Don't show underlay if no press handlers
Reviewed By: sahrens

Differential Revision: D2915003

fb-gh-sync-id: 56ba942ed464e393ea43229b1fa9ef6936a24ecc
shipit-source-id: 56ba942ed464e393ea43229b1fa9ef6936a24ecc
2016-02-12 11:32:30 -08:00
Konstantin Raev 6f1417c849 CI now builds docs website and deploys it to /%version% path
Summary:
Copy of #5760 reverted merge.

We need to preserve history of docs changes on the webserver.
The goal is to allow users to browse outdated versions of docs.
To make things simple all websites will be released to https://facebook.github.io/react-native/releases/version/XX folder when there is a branch cut.

I switched from Travis CI to Cirle CI because it works faster and I am more familiar with it.

How it works:

1. If code is pushed to `master` branch then CI will build a fresh version of docs and put it in https://github.com/facebook/react-native/tree/gh-pages/releases/next folder.
Github will serve this website from https://facebook.github.io/react-native/releases/version/next URL.
All relative URLs will work within that website

2. If code is pushed to `0.20-stable` branch then CI will build a fresh version of docs and put it in https://github.com/facebook/react-native/tree/gh-pages/releases/0.20 folder.
Github will serve this website from https://facebook.github.io/react-native/releases/v
Closes https://github.com/facebook/react-native/pull/5873

Reviewed By: svcscm

Differential Revision: D2926901

Pulled By: androidtrunkagent

fb-gh-sync-id: 16aea430bac815933d9c603f03921cc6353906f1
shipit-source-id: 16aea430bac815933d9c603f03921cc6353906f1
2016-02-11 06:17:42 -08:00
Austin Kuo 1e58a4287c Emend the comment
Summary:
Emend the comment error
Closes https://github.com/facebook/react-native/pull/5795

Reviewed By: svcscm

Differential Revision: D2910532

Pulled By: vjeux

fb-gh-sync-id: 9f8fe026e57e049db5a0f6d4e3ee4a752457c4a5
2016-02-07 07:13:32 -08:00
Keith Norman 98797177ab fix issue that breaks scroll views w/ RefreshControl on Android
Summary:
Fixes the issue I mentioned here https://github.com/facebook/react-native/pull/5623#issuecomment-180583142
Closes https://github.com/facebook/react-native/pull/5784

Reviewed By: svcscm

Differential Revision: D2908112

Pulled By: nicklockwood

fb-gh-sync-id: 8a2f053de3f7dc19807ee21dd969c53a57b71345
2016-02-05 16:25:35 -08:00
fangmobile 33d8db599e added accessibility props for touchables
Summary:
accessibilityLabels are missing in these touchable*.js files.
for #5322
ide This is not tested yet. I will update with test.
Closes https://github.com/facebook/react-native/pull/5346

Reviewed By: svcscm

Differential Revision: D2882061

Pulled By: gkassabli

fb-gh-sync-id: dff0ef373e5f5895027cb1cc08c8887a6ace8eee
2016-02-04 05:13:32 -08:00
Nick Lockwood 81fb985335 Support non-image assets in packager
Summary:
public
The packager currently assumes that all assets that are not JSON or JS files must be images. Although it is possible to add other extension types, they crash the packager if you try to require them, because it attempts to get their dimensions, assuming that they are an image.

This is a crude workaround for that problem, which skips the image-specific processing for non-image assets, but really it would be better if the packager was properly aware of different asset types and treated them differently (e.g. for sounds it could include the duration, for HTML pages it could parse and include linked CSS files, etc).

I've also added an example of using `require('...')` to load a packager-managed HTML page in the UIExplorer WebView example. In future I anticipate that all static asset types (sounds, fonts, etc.) could be handled in this way, which allows them to be edited or added/removed on the fly instead of needing to restart the app.

Reviewed By: martinbigio

Differential Revision: D2895619

fb-gh-sync-id: cd93794ca66bad838621cd7df3ff3c62b5645e85
2016-02-03 17:30:39 -08:00
Brent Vatne 82b0df9d2a Add scrollEnabled prop to Android ScrollView
Summary:
Perhaps there is a better way to do this, curious to hear it!

- If momentum scroll is active when `scrollEnabled` is toggled, the momentum scroll continues and the onMomentumScrollEnd event fires, which is the same as on iOS.
Closes https://github.com/facebook/react-native/pull/5656

Reviewed By: svcscm

Differential Revision: D2889897

Pulled By: dmmiller

fb-gh-sync-id: b2f44d2bcb48373f9945f6afd966447a118df717
2016-02-03 13:39:33 -08:00
Janic Duplessis db74e713fe Fix scrollTo when using RefreshControl on Android
Summary:
The issue is that the ScrollResponder mixin assumes that the native scrollable node is the top level element and gets it using `React.findNodeHandle(this)` but since Android wraps the native `ScrollView` component with the `RefreshControl`, it finds the native `RefreshControl` node instead and the scroll command gets ignored because it doesn't exists.

This adds a hook to ScrollResponder mixin to allow specifying what is the native scrollable node.

The bug can be reproduced using this https://gist.github.com/janicduplessis/871c0b6d3ad0acaacba9 in UIExplorer.

Fixes #5725
Closes https://github.com/facebook/react-native/pull/5736

Reviewed By: svcscm

Differential Revision: D2896125

Pulled By: nicklockwood

fb-gh-sync-id: 0a00a20551421982c5bc519c542774877ba15c9b
2016-02-03 11:13:33 -08:00
Janic Duplessis b979128c54 Cross platform status bar API
Summary:
I started working on improving the `StatusBar` API and make it work on Android. I added support for `setColor`, `setTranslucent` (the status bar is still visible but the app can draw under) and `setHidden` on Android. Looking for feedback on how to improve the API before I put more time on this :).

Right now I went for a cross platform API and functions that don't exist on a platform are just a no-op but I'm not sure it is the best choice since at the moment what is supported is very different between both platforms. I was wondering what you guys think and if it would be better off as 2 different modules.

It is also possible to port some of the features I added for Android to iOS even if there is no 'standard' way to do it. Like `setColor` could be implemented by drawing a colored view under the status bar and translucent by adding/removing some padding.
Closes https://github.com/facebook/react-native/pull/5360

Reviewed By: svcscm

Differential Revision: D2840417

Pulled By: nicklockwood

fb-gh-sync-id: 5c8d988bccf8035341f0efe27e54dd8402c18d24
2016-02-03 06:41:35 -08:00
Dave Miller 0c91931adf Add support for selectionColor on Android TextInput
Summary:
public
This adds support to set the highlight color on TextInput on Android.  See https://github.com/facebook/react-native/pull/5678 for the iOS implementation.

Note : We will merge these two properties with one name 'selectionColor' in a follow on diff, and may move it to a style.

Reviewed By: nicklockwood

Differential Revision: D2895253

fb-gh-sync-id: 6f2c08c812ff0028973185356a8af285f7dd7969
2016-02-03 05:49:32 -08:00
Nick Lockwood 6941c4e027 Replace `ScrollView.scrollTo()` API with something less ambiguous.
Summary:
public
The current `ScrollView.scrollTo()` API is confusing due to the `(y, x)` parameter order, and the boolean `animated` argument. E.g.

    ScrollView.scrollTo(5, 0, true) // what do these arguments mean?

This diff replaces the API with a configuration object, so the arguments are all explicit:

    ScrollView.scrollTo({x: 0, y: 5, animated: true}) // much better

The `scrollTo()` method checks the argument types, and provides backwards compatibility with the old argument format for now. Using the old API will generate a warning, and this will eventually be upgraded to an error.

Reviewed By: davidaurelio

Differential Revision: D2892287

fb-gh-sync-id: cec4d504242391267c6e863816b6180ced7a7d5e
2016-02-03 04:00:40 -08:00
joranz c2233ef7e6 Add iOS tintColor prop to TextInput
Summary:
In response to https://github.com/facebook/react-native/issues/5595

Adds tintColor property to TextInput component for iOS:

<img width="375" alt="screen shot 2016-01-28 at 1 39 35 pm" src="https://cloud.githubusercontent.com/assets/3868826/12730689/eae58a36-c8e1-11e5-9453-70716617bfab.png">

Usage:

<img width="454" alt="screen shot 2016-01-28 at 1 42 37 pm" src="https://cloud.githubusercontent.com/assets/3868826/12730711/fedeed8e-c8e1-11e5-87d0-1621d19a0418.png">
Closes https://github.com/facebook/react-native/pull/5678

Reviewed By: svcscm

Differential Revision: D2895115

Pulled By: nicklockwood

fb-gh-sync-id: bfb52b992d5e02754fe47f409f6e8df426514718
2016-02-03 00:22:34 -08:00
Kudo Chien 6d65a90017 Allow customized refreshControl in ScrollView for Android
Summary:
Original Android's refreshControl in ScrollView is tightly coupled with AndroidSwipeRefreshLayout. If someone use `ref=` for RefreshControl in ScrollView, it does nothing since RefreshControl in Android return null.

This change allows customized  RefreshControl especially for `ref=` as well as making ScrollView's code clearer.
Closes https://github.com/facebook/react-native/pull/5623

Reviewed By: svcscm

Differential Revision: D2890072

Pulled By: nicklockwood

fb-gh-sync-id: a8fc7746bcc050a6e46fedf3583979f4cb9021b6
2016-02-02 07:12:32 -08:00
Aleksei Androsov 65b0913210 TextInput should call blur and focus methods of selectionState
Summary:
DocumentSelectionState returns anchor and focus offsets only in focused state. So TextInput should set proper state to selectionState when blur and focus.
Closes https://github.com/facebook/react-native/pull/5354

Reviewed By: svcscm

Differential Revision: D2890277

Pulled By: andreicoman11

fb-gh-sync-id: 84f96504e218cf7c70d7e24865ab074d882f3bea
2016-02-02 05:22:08 -08:00
Andrei-Ovidiu Coman 729c04b58b Revert "TextInput should call blur and focus methods of selectionState" 2016-02-02 13:19:58 +00:00
Andrei-Ovidiu Coman f3ffafb756 Merge pull request #5354 from doochik/textinput-selectionstate-focus-blur
TextInput should call blur and focus methods of selectionState
2016-02-02 10:39:56 +00:00
Nick Lockwood 46106f756a Ported `source` prop over to iOS WebView
Summary:
public
https://github.com/facebook/react-native/pull/5494 added a new `source` property to WebView on Android that provides a better API, as well as allowing for request headers to be set.

This diff ports that functionality over to iOS, so we can have a consistent API cross-platform.

I've also extended the API to include `method` (GET or POST) and `body` when setting the WebView content with a URI, and `baseUrl` when setting static HTML.

Reviewed By: javache

Differential Revision: D2884643

fb-gh-sync-id: 83f24494bdbb4e1408aa8f3b7428fee33888ae3a
2016-02-01 18:01:35 -08:00
glevi@fb.com 5ec1d354c2 Deploy v0.21.0
Reviewed By: jeffmo

Differential Revision: D2888689

fb-gh-sync-id: fe94e50c7872b9a1344a054acccab365d385f6ed
2016-02-01 17:13:35 -08:00
Michael Tostenson 80a2f5d50f Add headers prop to Android WebViews
Summary:
Related to [issue #5418](https://github.com/facebook/react-native/issues/5418)

This is a follow-up to [this previous pull request.](https://github.com/facebook/react-native/pull/5419)

~~Adds a new ReactProp 'urlWithHeaders' to Android WebViews that takes an object with a 'url' string and a 'headers' map.~~

[Update] Adds a new prop 'source' to Android WebViews
```
{
   html: string,
   url: string,
   headers: map<string, string>,
}
```

Update: resolves TODO 8495359
Closes https://github.com/facebook/react-native/pull/5494

Reviewed By: svcscm

Differential Revision: D2881313

Pulled By: nicklockwood

fb-gh-sync-id: 7cad8490d4932d0a7ef559165f3ec279d873c537
2016-02-01 10:06:35 -08:00
Nick Lockwood ee30433b76 Update Android's ScrollView.scrollTo API to match JS/iOS
Summary:
public
We recently updated the `ScrollResponder.scrollResponderScrollTo` method to accept an `animated` argument, and deprecated the `scrollResponderScrollWithoutAnimationTo` method. This change was reflected in the native iOS implementation, but not on Android.

This diff updates the Android ScrollViewManager implementation to match the JS API, and removes the platform-specific fork in the JS code.

Reviewed By: dmmiller

Differential Revision: D2883515

fb-gh-sync-id: e5a0e1cf470e21af837b2311cf1048162ac3aff5
2016-02-01 04:04:35 -08:00
Dotan J. Nahum 5712e0c3eb Typo: Change WebWiew to WebView
Summary: Closes https://github.com/facebook/react-native/pull/5648

Reviewed By: svcscm

Differential Revision: D2884296

Pulled By: androidtrunkagent

fb-gh-sync-id: 50340c0fc06926fbb3dc41c3078aa985ff48ccd3
2016-01-31 08:41:33 -08:00
Martin Konicek 679beb2a3a Tweak docs before releasing 0.19
Reviewed By: mkonicek

Differential Revision:D2883844
Ninja: Only docs and React Native website, doesn't affect any fb apps

fb-gh-sync-id: 4bf56dc695224f172832ca5381cebceab9e5fe4f
2016-01-30 17:11:28 -08:00
Nick Lockwood 9d0242fdc3 Replace direct access of NativeModules.UIManager with require('UIManager')
Summary:
public
Due to the cross-platform polyfills we have added (and will add in future) to `UIManager.js`, accessing UIManager directly via NativeModules instead of importing the wrapper is discouraged.

This diff fixes a few places where we were doing this inside our own modules.

Note: As a general policy, we should avoid accessing modules via NativeModules anyway. Using wrapper classes allows us to provide static declarations for all the native methods and properties, which can be checked at build time by flow. If we access the modules directly, those interfaces are only known at runtime.

Reviewed By: vjeux

Differential Revision: D2881300

fb-gh-sync-id: 6737358ea8ea6d722cc1941a4b9fa0123a87fc29
2016-01-30 07:36:34 -08:00
Christoph Jerolimov cb874a55aa Add MapView annotation callback when it gets / lost the focus
Summary:
For my project it was required to receive a notification when the MapView annotation was deselected.

So I renamed `onAnnotationPress` to `onAnnotationSelected` and added a new method `onAnnotationDeselected`, this names was "inspired" by the underlaying iOS API. The old API was still called and marked as deprecated.

But maybe you have an idea for a better naming (onAnnotationFocus/-Blur?) -- or should a deselected call the press method again without an annotation (undefined)?
Closes https://github.com/facebook/react-native/pull/5167

Reviewed By: svcscm

Differential Revision: D2869695

Pulled By: nicklockwood

fb-gh-sync-id: 91795ac3f1e4533b250af8901534d8870729d9db
2016-01-29 06:26:30 -08:00
Martin Konicek 1dd5ba7021 Add a cross-platform Picker
Summary:
The basic API is consistent with iOS; there are several platform-specific props.

Also fixed the flickering when a value is selected.

public

Reviewed By: bestander

Differential Revision: D2871092

fb-gh-sync-id: f5cdf6858cb7344b28ee46954cb6b0a3b144b646
2016-01-29 03:59:54 -08:00
Janic Duplessis 1c6e837504 Add a deprecatedPropType module to show deprecation warnings
Summary:
To allow smoother API changes for users we often deprecate props and keep them around for a while before removing them. Right now it is all done manually, this adds a consistent way to show a warning when using a deprecated prop.

This also adds a deprecation warning of the website generated from the deprecatedPropType.

<img width="643" alt="screen shot 2016-01-26 at 7 43 08 pm" src="https://cloud.githubusercontent.com/assets/2677334/12600172/7af28fb0-c465-11e5-85e5-3786852bf522.png">

It also changes places where we added the warnings manually to use deprecatedPropType instead.
Closes https://github.com/facebook/react-native/pull/5566

Reviewed By: svcscm

Differential Revision: D2874629

Pulled By: nicklockwood

fb-gh-sync-id: c3c63bae7bbec26cc146029abd9aa5efbe73f795
2016-01-29 02:05:38 -08:00
Kudo Chien 8de86a0d65 Add onPageScrollStateChanged for ViewPagerAndroid
Summary:
I have an issue when combining `PullToRefreshViewAndroid` and `ViewPagerAndroid`.
`ViewPagerAndroid` will not able to scroll that gesture handler is being taken by `PullToRefreshViewAndroid`
One solution is to disable `PullToRefreshViewAndroid` if `ViewPagerAndroid` is scrolling (i.e. not idle).
[Reference solution here](http://stackoverflow.com/a/29946734/2590265)

So here need to expose the `onPageScrollStateChanged` event.
Some code referenced from  DrawerLayoutAndroid, especially the `VIEWPAGER_PAGE_SCROLL_STATES` array.
Please feel free give me comments.
Thanks.
Closes https://github.com/facebook/react-native/pull/5026

Reviewed By: svcscm

Differential Revision: D2830623

Pulled By: andreicoman11

fb-gh-sync-id: c2a6920c6f4c7daab0115f13864db83b93b31abf
2016-01-29 01:17:35 -08:00
August Flanagan 0f7477f9f9 add flag to enable momentum scrolling on iOS
Summary:
Expose a `decelerationNormalEnabled` flag on WebView, which, when enabled, will WebView's ScrollView's `decelerationRate` to `UIScrollViewDecelerationRateNormal`. This gives the WebView the same "momentum" style scrolling as other iOS views.

This was discussed with ide in #5447. Please let me know if there's anything I'm missing, or anything else you'd like to see in this pull request.
Closes https://github.com/facebook/react-native/pull/5527

Reviewed By: svcscm

Differential Revision: D2870312

Pulled By: nicklockwood

fb-gh-sync-id: 7dbfd06a349e3365a5df40c3bacf25a4fdb306cf
2016-01-28 05:36:33 -08:00
Jean Regisser b84f5fb6c9 Added iOS indicatorStyle prop to ScrollView
Summary:
Hi,

The doc wording was adapted from https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIScrollView_Class/#//apple_ref/doc/c_ref/UIScrollViewIndicatorStyle

Note that the iOS doc is misleading, and `UIScrollViewIndicatorStyleDefault` is the same as `UIScrollViewIndicatorStyleBlack` (since iOS 7 I think).

Let me know what you think.
Closes https://github.com/facebook/react-native/pull/5583

Reviewed By: svcscm

Differential Revision: D2870011

Pulled By: nicklockwood

fb-gh-sync-id: d28a96e1a2d4610cbeaee0ae70108ab9d9f05fdb
2016-01-27 10:16:33 -08:00
Nick Lockwood f685878938 Improved 3D touch implementation, and added example
Summary:
public
This diff improves the implementation of 3D touch by adding a `forceTouchAvailable` constant to View that can be used to check if the feature is supported.

I've also added an example of how you can use the `force` property of the touch event to measure touch pressure in React Native.

Reviewed By: vjeux

Differential Revision: D2864926

fb-gh-sync-id: 754c54989212ce4e4863716ceaba59673f0bb29d
2016-01-27 09:05:36 -08:00
Satyajit Sahoo e33e6ab1f0 Add cross-platform Linking module
Summary:
A promise based API for handling Link for Android and iOS. Refer #4971

The iOS part doesn't handle errors. Will need someone with iOS knowledge to do that.

cc skevy ide brentvatne mkonicek vjeux nicklockwood
Closes https://github.com/facebook/react-native/pull/5336

Reviewed By: svcscm

Differential Revision: D2866664

Pulled By: androidtrunkagent

fb-gh-sync-id: 67e68a827e6b85886bfa84e79b897f079e78b1b5
2016-01-26 14:34:31 -08:00
Jed Lau affd6230fe self -> this in ScrollResponder
Summary:
I *think* this is causing a crash for me in a release build (curiously, not a debug build):
```
ReferenceError: Can't find variable: self
```

I saw this in 0.18.1, which I assume was renamed to v0.19.0-rc.
Closes https://github.com/facebook/react-native/pull/5562

Reviewed By: svcscm

Differential Revision: D2866491

Pulled By: androidtrunkagent

fb-gh-sync-id: 196f718bf807c5eef676f66f1e15d7bde9475d5b
2016-01-26 14:23:32 -08:00
Martin Konicek 9a0539d2c4 Open source Android date and time pickers
Reviewed By: bestander

Differential Revision: D2856486

fb-gh-sync-id: 0bb81136289e2f121387649765ba682103e4701b
2016-01-26 10:31:17 -08:00
Noam Bartov f68281a0d8 added support for overlayColor property for image
Summary:
In Android, Fresco's default rounding corners support mode is BITMAP_ONLY which doesn't work in all cases (such as animated GIF's, some scale types, etc.).
Specifying the new "overlayColor" property on an Image will cause Fresco to switch to the other rounding corners mode, OVERLAY_COLOR, and will draw rounded corners by overlaying the solid color specified.

Fresco's behaviour is explained here: http://frescolib.org/docs/rounded-corners-and-circles.html
Closes https://github.com/facebook/react-native/pull/5366

Reviewed By: svcscm

Differential Revision: D2854696

Pulled By: mkonicek

fb-gh-sync-id: 251701ee8a64acbfc22694e9d4661c40eef75725
2016-01-24 14:00:39 -08:00
Christopher Dro 2b309a426a Updates to Text & IntentAndroid
Summary: Closes https://github.com/facebook/react-native/pull/5496

Reviewed By: svcscm

Differential Revision: D2858772

Pulled By: androidtrunkagent

fb-gh-sync-id: 5edf52af256efe6bb7ae1f8bcc2622d7e6a1298c
2016-01-23 11:01:33 -08:00
Elliot Hesp f644af34ef Correctly bind Touchable.js setTimeout
Summary:
Fixes https://github.com/facebook/react-native/issues/5337

`this.setTimeout` is undefined and the scope wasn't being passed through causing a RedBox error.
Closes https://github.com/facebook/react-native/pull/5376

Reviewed By: svcscm

Differential Revision: D2838623

Pulled By: androidtrunkagent

fb-gh-sync-id: 513210298b6c39d812047a03d8f2edd5c11e46f6
2016-01-22 14:45:35 -08:00
Huang Yu f453e14c8f Fix StyleSheet 'textAlign' for AndroidTextInput. Closes #2702
Summary:
change `setTextAlign` and `setTextAlignVertical` to receive argument of type `String` (the same as in `StyleSheet`), so that native props and stylesheet props are calling the same ReactMethod

- add demo (may not be necessary)
Closes https://github.com/facebook/react-native/pull/4481

Reviewed By: svcscm

Differential Revision: D2823456

Pulled By: mkonicek

fb-gh-sync-id: 349d17549f419b5bdc001d70b583423ade06bfe8
2016-01-21 11:08:34 -08:00
Dave Miller 747be0bf5c Change the js signature to be Promise based and dynamically detect it used as a callback
Summary:
Making the default people see when they look at the module the Promise based version

public

Reviewed By: davidaurelio

Differential Revision: D2850048

fb-gh-sync-id: e0815983ed798c202047cb071e65ce63a52fd1af
2016-01-21 09:49:34 -08:00
Jeff Berg 48117ce6c4 Fix TouchNativeFeedback so that the ripple starts from where a person touches
Summary:
It needs the touch coordinates for with-in the element, not for on the page.
Closes https://github.com/facebook/react-native/pull/5400

Reviewed By: svcscm

Differential Revision: D2848834

Pulled By: androidtrunkagent

fb-gh-sync-id: 88cf0fd7bd2332eb3db835b26438064412c8358c
2016-01-20 20:36:38 -08:00
tantan 15f806957f Return a Promise for `Clipboard.getString()`
Summary:
For clipboard, add error callback in Android. Code like
```javascript
Clipboard.getString((content)=>{
    //do something
},(error)=>{
   //do something for error
})
```
Closes https://github.com/facebook/react-native/pull/4792

Reviewed By: svcscm

Differential Revision: D2844937

Pulled By: nicklockwood

fb-gh-sync-id: 19953807ff07238e6a6ef5aedf1a3fcbca7e62a1
2016-01-20 10:54:32 -08:00