Commit Graph

2873 Commits

Author SHA1 Message Date
Martin Konicek ad8cbb6dea Support ScrollView.scrollToEnd on Android natively
Summary:
This is a followup for https://github.com/facebook/react-native/pull/12088 and implements the scrolling to end on Android natively rather than sending a large scroll offset from JS.

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

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

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

An alternative is:

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

Differential Revision: D4481523

Pulled By: mkonicek

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

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

Differential Revision: D4443707

Pulled By: hramos

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

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

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

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

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

Differential Revision: D4474974

Pulled By: mkonicek

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

Reviewed By: ericvicenti, dwwoelfel

Differential Revision: D4471681

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

Differential Revision: D4379031

Pulled By: ericvicenti

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

Differential Revision: D4472405

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

Differential Revision: D4466121

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

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

Differential Revision: D4445304

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

Reviewed By: jeanlauliac, astreet

Differential Revision: D4462471

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

Differential Revision: D4444428

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

Differential Revision: D4443718

Pulled By: hramos

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

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

Differential Revision: D4450924

Pulled By: hramos

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

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

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

Differential Revision: D4443891

Pulled By: hramos

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

Differential Revision: D4438390

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

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

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

Differential Revision: D4446219

Pulled By: bvaughn

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

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

Differential Revision: D4425551

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

Differential Revision: D4420532

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

Differential Revision: D4338782

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

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

**Test plan (required)**

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

Differential Revision: D4438057

Pulled By: hramos

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

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

Differential Revision: D4437900

Pulled By: hramos

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

Reviewed By: mmmulani

Differential Revision: D4429662

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

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

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

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

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

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

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

Differential Revision: D4436470

Pulled By: vjeux

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

Differential Revision: D4435640

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

Differential Revision: D4435405

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

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

**Test plan (required)**

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

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

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

Differential Revision: D4430265

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

Reviewed By: fkgozali

Differential Revision: D4423661

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

Differential Revision: D4428858

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

Reviewed By: andreicoman11

Differential Revision: D4421542

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

return button which shows stacktrace in yellow box.

**Test plan (required)**

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

Differential Revision: D4424824

Pulled By: mmmulani

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

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

Differential Revision: D4425959

Pulled By: lacker

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

Differential Revision: D4411870

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

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

Differential Revision: D4397188

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

Differential Revision: D4394074

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

Depends on D4395091

Reviewed By: achen1

Differential Revision: D4395552

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

thanks to #11192 for making gestures work on VerticalUpSwipeJumps

Reviewed By: ericvicenti, shergin

Differential Revision: D4412129

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

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

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

Differential Revision: D4408497

Pulled By: sahrens

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

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

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

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

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

Differential Revision: D4403483

Pulled By: davidaurelio

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

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

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

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

Reviewed By: astreet

Differential Revision: D4376549

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

Differential Revision: D4394773

Pulled By: lacker

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

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

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

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

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

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

Differential Revision: D4380916

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

Differential Revision: D4392137

Pulled By: ericvicenti

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

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

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

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

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

Differential Revision: D4392103

Pulled By: ericvicenti

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

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

Differential Revision: D4392031

Pulled By: ericvicenti

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

Differential Revision: D4392027

Pulled By: ericvicenti

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

{F65372439}

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

Reviewed By: javache

Differential Revision: D4385099

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

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

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

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

Differential Revision: D4390425

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

Reviewed By: javache

Differential Revision: D4385443

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

**Test plan (required)**

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

Differential Revision: D4386449

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

Differential Revision: D4380482

Pulled By: JoelMarcey

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

Reviewed By: fkgozali

Differential Revision: D4374819

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

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

I did some benchmarks:

```
Without Percentage Feature - Release x86:

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

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

With Percentage Feature - Release x86:

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

Reviewed By: dshahidehpour

Differential Revision: D4361945

Pulled By: emilsjolander

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

Differential Revision: D4374415

Pulled By: mkonicek

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

Reviewed By: fkgozali

Differential Revision: D4363398

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

Differential Revision: D4366925

Pulled By: mkonicek

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

Differential Revision: D4364354

Pulled By: hramos

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

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

Differential Revision: D4329147

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

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

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

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

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

Differential Revision: D4362540

Pulled By: ericvicenti

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

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

Reviewed By: cpojer

Differential Revision: D4318207

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

Differential Revision: D4348825

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

Differential Revision: D4342295

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

Differential Revision: D4333546

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

Differential Revision: D4344961

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

Differential Revision: D4342707

Pulled By: lacker

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

Differential Revision: D4339957

Pulled By: lacker

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

potential reviewers mkonicek and kmagiera

**Motivation for making this change.**

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

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

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

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

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

**Test plan**

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

**Code formatting**

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

Differential Revision: D4340640

Pulled By: mkonicek

fbshipit-source-id: 64c5cf060f2eb035d4d6199b30f0e73afc520180
2016-12-16 12:28:36 -08:00
pedramsaleh 20938ae88c Fixed typo in docs.
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**

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

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

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see
Closes https://github.com/facebook/react-native/pull/11459

Differential Revision: D4339946

Pulled By: lacker

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

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

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

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

Differential Revision: D4227495

Pulled By: lacker

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

Differential Revision: D4335305

Pulled By: lacker

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

Differential Revision: D4338083

Pulled By: lacker

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

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

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

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

https://youtu.be/1jTlZhPdj9Y

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

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

Differential Revision: D4335190

Pulled By: lacker

fbshipit-source-id: 0480809c44983644ff2abfcaf4887569b2bfede5
2016-12-15 17:43:35 -08:00
Eric Vicenti cbc413ba87 Revert D4321763: Use native driver even if gestures are enabled
Differential Revision: D4321763

fbshipit-source-id: b43a733ea2234dd46add817bb83cca366ef83093
2016-12-14 15:28:32 -08:00
Üstün Ergenoglu 3785db2fb1 Add property to force HW acceleration on Android for modal windows
Summary:
When using React Native on Android on top of a game as an overlay, dialog windows sometimes get created with hardware acceleration disabled. This causes the UI to be unresponsive and anything that uses a TextureView stops working. Added a property for the modal view to make sure hardware acceleration flag is enabled when it's set to true.

**Test plan (required)**

set `hardwareAccelerated` property for Modal to force hardware acceleration on dialog windows on Android. Does nothing on iOS.
Closes https://github.com/facebook/react-native/pull/11421

Differential Revision: D4312912

Pulled By: andreicoman11

fbshipit-source-id: 9db6b2eca361421b92b24234b3501b5de0eecea7
2016-12-14 10:28:33 -08:00
unordered 8ec774396c fix ios formdata boundary include slash
Summary:
some server not work when upload a file with FromData in ios.
the reason is that there is a slash in boundary, like:
```
multipart/form-data; boundary=b/QeEbFgqK9PCZo4T/eXv7f.T74SHd5MxCZ846AsTz-yNV0xrRR_Zks4fkNMCzJck9ZE8o

// koa request.js (line 548)
  is(types) {
    if (!types) return typeis(this.req);
    if (!Array.isArray(types)) types = [].slice.call(arguments);
    return typeis(this.req, types);
  }

// type-is index.js (line 237)
function normalizeType (value) {
  // parse the type
  var type = typer.parse(value)

  // remove the parameters
  type.parameters = undefined

  // reformat it
  return typer.format(type)
}

// media-typer
var paramRegExp = /; *([!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) *= *("(?:[ !\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u0020-\u007e])*"|[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) */g;
```

thanks for dougwilson 's [answer](https://github.com/jshttp/media-typer/issues/5).
> The / is an illegal character for Content-Type, which is what this module parses
Closes https://github.com/facebook/react-native/pull/11342

Differential Revision: D4326750

Pulled By: javache

fbshipit-source-id: b1c78a335c95a5c223537545d87beaffe15d673d
2016-12-14 08:28:42 -08:00
Neo f8f70d2275 fix ListView to work with Native Animated.event
Summary:
suggested by janicduplessis in https://github.com/facebook/react-native/pull/9253#issuecomment-247862707
I'm using this in my own apps
Closes https://github.com/facebook/react-native/pull/11339

Differential Revision: D4325343

fbshipit-source-id: f1da26a2107093865f04e1d81245b33482776001
2016-12-13 20:43:53 -08:00
Jeff Morrison d926aecd77 fbsource
Reviewed By: samwgoldman

Differential Revision: D4314897

fbshipit-source-id: fbe11da4c63bf34d010220d74177cb3ca4cbee6d
2016-12-13 18:58:34 -08:00
Janic Duplessis 4220063f84 Use native driver even if gestures are enabled
Summary:
Gestures now work with native animations so we can enable it, it is also not needed anymore to check if the native module exists since we print a warning in the Animated module now.

**Test plan**
Tested that animations and gesture work properly in the UIExplorer example. Also been using native animations with NavigationExperimental (ex-nav) in an app for a while.
Closes https://github.com/facebook/react-native/pull/11234

Differential Revision: D4321763

Pulled By: ericvicenti

fbshipit-source-id: 255bed5bfed3b93bdc10939b5a03d4d8b00ceade
2016-12-13 13:43: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
Anton Karpov 4252ac75ea fix babel 'strict mode' error
Summary:
need to remove function declaration in a lexically nested statement
because babel uses 'use strict' by default now
Closes https://github.com/facebook/react-native/pull/11390

Differential Revision: D4308275

fbshipit-source-id: 0d073361d25b23fb67f001225feb72532af38683
2016-12-11 00:43:30 -08:00
Adam Ernst 587606987f Rename and merge files for RCTWebSocketObserver protocol
Summary: No need to have two files; merge it into one and give it an appropriate name.

Reviewed By: javache

Differential Revision: D4296716

fbshipit-source-id: 904d13c23bb8d403b8efcb60f9a4aa5df5b08972
2016-12-08 07:44:37 -08:00
Adam Ernst 2b0c4591e2 Rename RCTWebSocketManager file to reflect its new contents
Reviewed By: javache

Differential Revision: D4296615

fbshipit-source-id: a48da3f0550398cb59478c7405fe971f9246910f
2016-12-08 07:44:37 -08:00
Adam Ernst d0c3e98d1d Eliminate RCTWebSocketManager
Summary: This singleton was unnecessary and can be implemented with a single `static` in `RCTDevMenu`. In another diff, I will rename `RCTWebSocketManager.{h,m}` to reflect the only class that remains.

Reviewed By: javache

Differential Revision: D4296551

fbshipit-source-id: 653971dfb31de5b0a161b531eed82a067f536ce3
2016-12-08 07:44:37 -08:00
Adam Ernst 2ca6138852 Start exposing RCTWebSocketObserver using a protocol
Reviewed By: javache

Differential Revision: D4296387

fbshipit-source-id: 33f92c36168dcb18356d0ccdaf902a84634d94b7
2016-12-08 07:44:37 -08:00
Adam Ernst 574e3daf9f Clean up RCTWebSocketObserver
Summary: Avoid using properties where unnecessary; stick to only one way to modify the delegate.

Reviewed By: javache

Differential Revision: D4296351

fbshipit-source-id: 94d0e3c90904ed584f691a3f28a15a7ac450c3e1
2016-12-08 07:44:37 -08:00
Adam Ernst 28e2f64d07 Remove unused queue ivar from RCTWebSocketManager
Reviewed By: javache

Differential Revision: D4296309

fbshipit-source-id: feee004e24abdb4b3626c5304f662ec3d71118b5
2016-12-08 07:44:37 -08:00
Adam Ernst ac489858f8 Clean up RCTWebSocketProxyDelegate a bit
Reviewed By: javache

Differential Revision: D4296294

fbshipit-source-id: b31e522c21ec490fdf98711655e5e8df22b32a12
2016-12-08 07:44:37 -08:00
Travis Stanley b203343b81 update comment to reflect change in function name to renderQuickActions
Summary:
Minor error in commen
Closes https://github.com/facebook/react-native/pull/11351

Differential Revision: D4293263

Pulled By: ericnakagawa

fbshipit-source-id: 19559b210336bfd05794a7585c0133a075e06398
2016-12-07 23:58:25 -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
Eming Kwok 40b84fa5f8 fix memory leak in Chrome debugging
Summary:
`RCTWebSocketExecutor` saves every WebSocket callback when sending message to chrome, but does not clear them in a debug session until the JS bridge is reloaded, and there may be thousands of blocks saved in the callback table. This PR removes them after they are called.
Closes https://github.com/facebook/react-native/pull/11341

Differential Revision: D4295710

Pulled By: javache

fbshipit-source-id: 29a02d1aba320115bbb97aee8981e34b89303c91
2016-12-07 17:13:42 -08:00
Mike Grabowski 6feffe1de0 Better error for ART <Group />
Summary: Fixes #3815

Differential Revision: D4295976

Pulled By: javache

fbshipit-source-id: 034690d3bee75217d820d3361136a410a812cd2c
2016-12-07 17:13:42 -08:00
Pieter De Baets 59407f3660 Redo exported headers and include paths for opensource
Summary:
Xcode really sucks, per some discussion on e1577df1fd and https://developer.apple.com/library/content/technotes/tn2215/_index.html, if you use the headers phase, and mark headers in your static library as public, they will actually end up in the final package that's built and you can't submit to the app store! This changes our xcode setup to use a copy files phase instead.

I've also changed the header include path to be $(BUILT_PRODUCTS_DIR)/include, which is added to the include path by Xcode by default, so 3rd party libraries should not be impacted by these changes anymore.

Reviewed By: mkonicek

Differential Revision: D4291607

fbshipit-source-id: 969b9ebcbeb8161f85427f8c429e198d9d0fae30
2016-12-07 15:28:29 -08:00
Michał Gregorczyk d72c6fd500 Do not call `toString` on functions in buildStyleInterpolator
Reviewed By: vjeux

Differential Revision: D4292618

fbshipit-source-id: cd7cd1a88aeb2c800f2c2941c79855992613ec84
2016-12-07 11:58:28 -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
Emil Sjolander 7f8c2985a8 Rename directories
Reviewed By: gkassabli

Differential Revision: D4284681

fbshipit-source-id: f0c6855c2c6e4389b7867f48f72cbb697830fc5a
2016-12-07 05:14:12 -08:00
David Aurelio d482743f91 Remove hmr require from initialization code
Reviewed By: cpojer

Differential Revision: D4265897

fbshipit-source-id: c39caeae875e6f5f5322542601e97cdf78f90dc6
2016-12-05 16:13:29 -08:00
Pieter De Baets 5ee8b41d56 Remove REACT_HEADERS from RN BUCK file
Reviewed By: emilsjolander

Differential Revision: D4231819

fbshipit-source-id: 78c1316d8e2bd8d9c0947b1c1c4dc857b74824ae
2016-12-05 10:43:33 -08:00
Adam Comella 2aca021504 iOS: Fix dequeueTasks crash in image loader
Summary:
This fixes a crash occurring [on this line](f9f32eb426/Libraries/Image/RCTImageLoader.m (L253)). It was reported in a comment in #10433.

The problem is that `task` is deallocated at this point and is unsafe to use. Removing it from `_pendingTasks` dropped its ref count to 0. [The ARC docs](http://clang.llvm.org/docs/AutomaticReferenceCounting.html#fast-enumeration-iteration-variables) state that, by default, loop variables in fast enumeration loops are not retained. That's why `task`'s ref count is 0.

It's likely we ran into this bug because the code disobeyed the [reverseObjectEnumerator docs](https://developer.apple.com/reference/foundation/nsarray/1415734-reverseobjectenumerator) which state that "you must not modify the array during enumeration". The default retention policy for fast enumeration seems to assume you follow this.

To fix this bug and avoid other potential pitfalls, the code now follows the docs and `_pendingTa
Closes https://github.com/facebook/react-native/pull/11296

Differential Revision: D4277167

Pulled By: javache

fbshipit-source-id: 1211b32935bab7f4080dc00b88d85348786e859a
2016-12-05 10:13:29 -08:00
gl8997@gmail.com 03fd91063b Update type check for NavigationCardStack
Summary:
The typecheck inside of NavigationCard is PropTypes.any while in NavigationCardStack it is  View.propTypes.style.

let's make them consistent to avoid unnecessary warnings. (e.g. trying to pass a animationStyle as cardStyle)
Closes https://github.com/facebook/react-native/pull/9808

Differential Revision: D4277323

Pulled By: ericvicenti

fbshipit-source-id: c30b4a21675cad98c19f5c6522e286d776bfa20d
2016-12-05 09:58:35 -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
Emil Sjolander 85ac5fc354 Rename C api
Differential Revision: D4259190

fbshipit-source-id: 26c8b356ca464d4304f5f9dc4192bff10cea2dc9
2016-12-03 04:44:10 -08:00
Sagiv Ofek f9ab788c6b Add more info link for warnedMissingNativeAnimated
Summary:
Add link with more details of how to resolve warnedMissingNativeAnimated warning.
Closes https://github.com/facebook/react-native/pull/11224

Differential Revision: D4268352

fbshipit-source-id: 679574570aea2f4ec7083247d5b6dcba378e8560
2016-12-02 15:28:31 -08:00
Damien Varron e9d459275a Add missing closing brace in docs
Summary:
This is a minor documentation fix

fixes #11150
Closes https://github.com/facebook/react-native/pull/11253

Differential Revision: D4268276

fbshipit-source-id: 67c8f9b4c77a2c781c09376bf4fc15a61b3db490
2016-12-02 15:28:31 -08:00
Ben Kalman fb4f71f4ac Add missing backtick in PanResponder.js docs
Summary: Closes https://github.com/facebook/react-native/pull/11274

Differential Revision: D4268360

fbshipit-source-id: 8d92300830e4568de14350a539c11b8773c425c0
2016-12-02 15:13:34 -08:00
Ben Clayton 833961e05d <Text> Expose Android's includeFontPadding property to JavaScript.
Summary:
By default Android will put extra space above text to allow for upper-case accents or other ascenders. With some fonts, this can make text look slightly misaligned when centered vertically.

We have found that the effect is very noticeable with certain custom fonts on Android. On iOS the font aligns vertically as expected.

Android exposes a property `includeFontPadding` that will remove this extra padding if set to false. This PR exposes that to JS, and adds it to the documentation and UIExplorer.
Closes https://github.com/facebook/react-native/pull/9323

Differential Revision: D4266713

Pulled By: lacker

fbshipit-source-id: f9711254bc26c09b4586a865f0e95ef4bf77cf3f
2016-12-02 12:58:36 -08:00
Emil Sjolander 779508c0ba Rename enums
Differential Revision: D4244360

fbshipit-source-id: c9fcbdd231098c9ff230a6055676bbc7cbd11001
2016-12-02 05:58:45 -08:00
Adam Comella 23423774ba iOS: Fix an image loader crash
Summary:
Fixes #10433

The code didn't account for the fact that cancelLoad is set by two different threads. It gets set on the URL request queue when the request completes successfully and it gets set on the UI queue during cancelation. This oversight lead to a couple of different kinds of crashes.

1. Attempt to invoke a nil function -- We check that cancelLoad is non-nil and on the next line we call it. However, cancelLoad could have been set to nil by the other thread between the time it was verified to be non-nil and the time it was called. Consequently, the program will attempt to call nil and crash.

2. Block deallocated while it's executing -- Suppose cancelLoad points to a block, it is verified to be non-nil, and it is successfully invoked. In the middle of executing the block, cancelLoad, the last reference to the block, is set to nil. This causes the block to be deallocated and its captured values to be freed. However, the block continues executing and the next time it attempts to use a captured value
Closes https://github.com/facebook/react-native/pull/11145

Differential Revision: D4261499

Pulled By: javache

fbshipit-source-id: 46424c6dd8cfa085cef32d945308de07798040bc
2016-12-01 21:28:33 -08:00
Brent Vatne 346858a552 Add StyleSheet.setStyleAttributePreprocessor
Summary:
**Motivation**

On Exponent we load fonts dynamically and assign their native names by appending a session id, so that fonts from one Exponent "experience" do not clash with each other. So, before sending the `fontFamily` to native, we want to change it to the Exponent-scoped `fontFamily`.

Example:

```js
// Before rendering your app
StyleSheet.setStyleAttributePreprocessor('fontFamily', _processFontFamily);

function _processFontFamily(name) {
  // Pass system fonts through
  if (!name || Constants.systemFonts.indexOf(name) >= 0) {
    return name;
  }

  if (!Font.isLoaded(name)) {
    if (__DEV__) {
      console.error(`${name} is not a system font and has not been loaded through Exponent.Font.loadAsync. If you intended to use a system font, make sure you typed the name correctly and that it is supported by the current operating system. If this is a custom font, be sure to load it with Exponent.Font.loadAsync`);
    } else {
      return 'system';
    }
  }

  return `ExponentFont-
Closes https://github.com/facebook/react-native/pull/11138

Differential Revision: D4245518

Pulled By: mkonicek

fbshipit-source-id: bd2452b1129d6675aa7b88e41351f8bb61fa20a3
2016-11-29 15:28:32 -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
Alex Kotliarskyi 1fe0f4d8ec Add `deprecated` flag for nativeImageSource
Summary:
Looks like the native Image implementation used to treat old `image!` images slightly differently. This diff restores that behavior for `nativeImageSource`.

{F65080365}

Reviewed By: mmmulani

Differential Revision: D4240506

fbshipit-source-id: d8d39216f86df32e0614d7cdc95df2148c85077a
2016-11-28 15:58:36 -08:00
Ryan Gomba c858420b2d Fix NativeAnimation invalidation & races on iOS
Summary:
This diff attempts to fix a number of iOS native animation bugs related to improper node invalidation and a race with view creation. The major issues were presented in #9120 as problems 3 and 3b, but I'll recap here:

The invalidation model we use is overly complicated and incomplete. The proper combination of `_needsUpdate` and `_hasUpdated` will result in nodes values being recomputed. However, we do not invalidate nodes in all the places we should, e.g. if we create a new view and attach it to an existing value node (see example in #9120). This diff chooses to remove the `_hasUpdated` flag, and simply relies on the `_needsUpdate` flag to mark a node as dirty.

We mark nodes as dirty when they are:
- created
- updated
- attached to new parents
- detached from old parents
- attached to a view

Calling `updateNodeIfNecessary` will, if necessary, compute all invalidated parent values before recomputing the node value. It will then apply the update, and mark the no
Closes https://github.com/facebook/react-native/pull/10663

Differential Revision: D4120301

Pulled By: mkonicek

fbshipit-source-id: e247afcb5d8c15999b8328c664b9f7e764d76a75
2016-11-28 11:13:31 -08:00
Gabe Levi bf901d926e Deploy v0.36.0
Reviewed By: zertosh

Differential Revision: D4237912

fbshipit-source-id: cc251884350ffa3c8715a4920f90bd301e8a9b7f
2016-11-28 10:13:31 -08:00
Seph Soliman fde4fb1485 Typo
Summary:
> Explain the **motivation** for making this change. What existing problem does the pull request solve?

Just fixed a typo.

Feel free to make the change directly in the repo without my credit if the process is easier than accepting this PR.
Closes https://github.com/facebook/react-native/pull/11164

Differential Revision: D4236963

Pulled By: mkonicek

fbshipit-source-id: 72c059596216602f9ab30dea6eb5f9cdbf89d31b
2016-11-28 03:43:32 -08:00
Janic Duplessis 49311a5d75 Mention that LayoutAnimation has to be explicitly enabled on A…
Summary:
This is mentioned in a different document but we forgot to mention it in JS docs:
- Mentioned here: http://facebook.github.io/react-native/docs/animations.html#layoutanimation
- Missing here: http://facebook.github.io/react-native/docs/layoutanimation.html

**Test plan**

    cd website
    npm install
    npm start

<img width="925" alt="screenshot 2016-11-25 21 48 36" src="https://cloud.githubusercontent.com/assets/346214/20635747/68fe5f6c-b359-11e6-8e72-8f7ca04f79bd.png">
Closes https://github.com/facebook/react-native/pull/11137

Differential Revision: D4233542

fbshipit-source-id: c22b0a05011d4c1c043abee34cd3e9b2369e8772
2016-11-25 15:28:28 -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
Wojciech Ogrodowczyk 9c7952d9e1 Remove deprecated push notification method info
Summary:
This PR seeks to improve the documentation of PushNotificationIOS.

The method didReceiveRemoteNotification without a fetch completion handler is deprecated by Apple and they [discourage using it](https://developer.apple.com/reference/uikit/uiapplicationdelegate/1623117-application) in favor of the [version with the handler](https://developer.apple.com/reference/uikit/uiapplicationdelegate/1623013-application).

Reasons for this change:

1. Our docs say that this method is required for remote notifications, but it's not. (It's one of possibilities with a recommendation not to use it.)
2. The method is deprecated by Apple and people shouldn't use it.
3. If you use the deprecated method, in 99% of the cases it will behave in a different way from what you'd expect. In particular, you won't get remote notifications when your app is in the background.

As there's no benefit (as far as I know) of using the method, I don't think we should even mention it to the users.

This is a re-opened PR that was mis
Closes https://github.com/facebook/react-native/pull/11109

Differential Revision: D4232800

Pulled By: javache

fbshipit-source-id: d3b509db41a549aa7fbc41753c648085df43d8ee
2016-11-25 03:58:32 -08:00
Connor McEwen 51efaab120 Handle "Never Ask Again" in permissions and add requestMultiplePermissions
Summary:
In order to get featured in the Google Play Store, we had to handle a few specific cases with permissions based on feedback from the editorial team.

First, which was previously possible with this permissions module was bumping the sdk to version 23.

The second is requesting multiple permissions at one time. In order for the camera + upload to work, we needed to request both camera permissions + media storage in one flow.

The last is handling the case where the user checks the "Never Ask Again" box. This will only appear after a user denies a permission once and is then prompted again. The logic for handling this case is taken from here: http://stackoverflow.com/questions/31928868/how-do-we-distinguish-never-asked-from-stop-asking-in-android-ms-runtime-permis/35495372#35495372

We were also seeing a few crashes similar to #10009 due to `onRequestPermissionsResult` being called before `onResume` (http://stackoverflow.com/questions/35205643/why-is-onresume-called-after-onrequestpermissionsresult), so I delaye
Closes https://github.com/facebook/react-native/pull/10221

Differential Revision: D4232551

fbshipit-source-id: fee698d1c48a2d86623cb87996f3d17f4c10a62e
2016-11-24 22:43:28 -08:00
Pieter De Baets 439092742a Fix imports in UIExplorerUnitTests
Reviewed By: bestander

Differential Revision: D4231271

fbshipit-source-id: 84f903f6b14256ed1958ad1800f128133590a3dc
2016-11-24 09:58:31 -08:00
David Aurelio ca58e0af82 BREAKING kill deprecated asset support
Summary:
This removes support for `require('image!…')`, which has been deprecated for a long time.

It is still possible to use images that are already bundled by the native app using the `nativeImageSource` module.
Check http://facebook.github.io/react-native/docs/images.html for detailed documentation.

Reviewed By: matryoshcow

Differential Revision: D4231208

fbshipit-source-id: 05ec4c1ca0fabdc3fbb652f8ad1acdf240a67955
2016-11-24 05:43:38 -08:00
Pieter De Baets f2a46b17d4 Replace RCTJSCWrapper with JSCWrapper from ReactCommon
Reviewed By: mhorowitz

Differential Revision: D4204516

fbshipit-source-id: 6bcb122daf2848035dfae404ee7a2e9aca0f8087
2016-11-23 11:43:48 -08:00
Martin Konicek fc23101b43 Update Share.js. Fixed bad grammar
Summary:
Fix a typo in Share.js.
Closes https://github.com/facebook/react-native/pull/11033

Differential Revision: D4211724

Pulled By: ericvicenti

fbshipit-source-id: 6f0383568af474b21dfae5b208d21f6fd28ba7d4
2016-11-23 11:28:29 -08:00
Timur Gibadullin df43cc7f6b Fix animation in fast navigation between scenes
Summary:
There is a bug in navigation animation:
![-05-2016 16-04-23](https://cloud.githubusercontent.com/assets/3778452/20030228/8d93bc3e-a371-11e6-87d6-2c5c994733b5.gif)
navigation animation from route-2 was awful, route-3 scene appeared without any animation, I pushed above example to 46dd8c93b4.

This bug can be reproduced when user navigates to the next scene immediately after navigation to the current one or when navigating between scenes programmatically (e.g. between loading scene and whatever next scene). I made some investigation and It looks like that `progress` should be reseted before building the new _transitionProps.

The above example after applying this patch:
![-05-2016 16-12-16](https://cloud.githubusercontent.com/assets/3778452/20030259/a800681e-a372-11e6-847a-991d355a5940.gif)
Closes https://github.com/facebook/react-native/pull/10761

Differential Revision: D4226864

Pulled By: mkonicek

fbshipit-source-id: 31dceb6c8e497b2cbd891bbda4cb3add01cbcca0
2016-11-23 09:58:42 -08:00
Pieter De Baets e1577df1fd Move all header imports to "<React/..>"
Summary:
To make React Native play nicely with our internal build infrastructure we need to properly namespace all of our header includes.

Where previously you could do `#import "RCTBridge.h"`, you must now write this as `#import <React/RCTBridge.h>`. If your xcode project still has a custom header include path, both variants will likely continue to work, but for new projects, we're defaulting the header include path to `$(BUILT_PRODUCTS_DIR)/usr/local/include`, where the React and CSSLayout targets will copy a subset of headers too. To make Xcode copy headers phase work properly, you may need to add React as an explicit dependency to your app's scheme and disable "parallelize build".

Reviewed By: mmmulani

Differential Revision: D4213120

fbshipit-source-id: 84a32a4b250c27699e6795f43584f13d594a9a82
2016-11-23 07:58:39 -08:00
Emil Sjolander 5850165795 Add support for aspectRatio style prop
Summary:
Expose aspectRatio style prop from css-layout to React Native.

This means the following will now work:

    <View style={{backgroundColor: 'blue', aspectRatio: 1}}/>

Reviewed By: javache

Differential Revision: D4226472

fbshipit-source-id: c8709a7c0abbf77089a4e867879b42dcd9116f65
2016-11-23 07:43: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
Adam Comella 8016d838be iOS: Fix autoCorrect doesn't revert to initial state
Summary:
There's an inconsistency in autoCorrect's default state:
  - If you don't specify a value for autoCorrect, it defaults to on.
  - If you specify true/false for autoCorrect and later specify null, autoCorrect turns off. It should have reverted to its initial state of on.

The reason for this discrepancy is that autoCorrect is exposed to JS as a boolean but it is actually an enum with three states in native:
  - UITextAutocorrectionTypeDefault (the default value)
  - UITextAutocorrectionTypeYes
  - UITextAutocorrectionTypeNo

This is fixed by explicitly mapping JS null to UITextAutocorrectionTypeDefault.

**Test plan (required)**

Verified that switching `autoCorrect` between `true`, `false`, and `null` all work correctly in single line and multiline `TextInputs`.

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

Differential Revision: D4226419

Pulled By: javache

fbshipit-source-id: e3e5769a3aa537f00fb56ca4ae622ff4213481c5
2016-11-23 05:43:35 -08:00
Janic Duplessis b49e7afe47 Dispatch native handled events to JS
Summary:
When native events where handled they were not sent to JS as an optimization but this caused some issues. One of the major one is touches are not handled properly inside a ScrollView with an Animated.event because it doesn't receive scroll events so it can't cancel the touch if the user scrolled.
Closes https://github.com/facebook/react-native/pull/10981

Differential Revision: D4226403

Pulled By: astreet

fbshipit-source-id: 41278d3ed4b684af142d9e273b11b974eb679879
2016-11-23 05:43:35 -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
Jennifer Wang be5868dddb Workaround native module dependency in Jest environment
Reviewed By: josephsavona

Differential Revision: D4225750

fbshipit-source-id: 6ac5a5cc1869232861977ea214970804acd7e39d
2016-11-22 23:58:30 -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
Daniel Dimitrov ad36c1af71 Cannot assign to read only property 'product' of object '#<WorkerNavi…
Summary:
When running in strict mode we run into the following error:
“Cannot assign to read only property 'product' of object '#<WorkerNavigator>’”

Moreover navigator.product = ‘ReactNative’; didn’t actually change the product value. Without strict mode this was silently ignored.

By using our defineProperty function we are able to run in strict mode and now navigator.product is really ReactNative.

See https://github.com/facebook/react-native/issues/10881 for more information

---------------

Long story short - if we run in strict mode, the current code throws an error :
`Cannot assign to read only property 'product' of object '#<WorkerNavigator>' initializeCore.js`
(the current version of initializeCore.js doesn't have 'use strict'; on top, but if you are unfortunate enough to have a babel module that ads this for you, you are guaranteed to run into this. Moreover our contributing guidelines say that we should have 'use strict'; https://github.com/facebook/react-native/blob/master/CONTRIB
Closes https://github.com/facebook/react-native/pull/11057

Differential Revision: D4219958

Pulled By: javache

fbshipit-source-id: 35568b2ce4b87fff1aa8248f067d49e5f9f9e9a2
2016-11-22 07:28:34 -08:00
Pieter De Baets 7c91f894ba Fix CSSLayout import hack, update podspec
Summary: Correct header import paths, update podspec so we point at the copy in ReactCommon (and can eventually remove the copy under React)

Reviewed By: astreet

Differential Revision: D4204501

fbshipit-source-id: e979a010092f025b2cdc289e1e5f22fc7b65a8d1
2016-11-21 09:13:36 -08:00
Pieter De Baets f255bda51f Fix loop when websocket executor is used without packager present
Reviewed By: mhorowitz

Differential Revision: D4159911

fbshipit-source-id: db913704641daf055060f5fe4561479daf76cd5a
2016-11-21 07:13:28 -08:00
Alex Kotliarskyi d117f550a5 Provide more info when image fails to load
Reviewed By: javache

Differential Revision: D4209311

fbshipit-source-id: 6ad8ea6b8e236ec5ad2a2313a69b8985f9a06c74
2016-11-21 04:58:30 -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
Adam Comella 54e947152f Navigator: null check on gesture.overswipe to prevent crash
Summary:
Sometimes, `gesture.overswipe` can be `null`/`undefined` in `_moveAttachedGesture` resulting in a crash. This change adds a null check to avoid the crash. `_matchGestureAction` has a similar check so it looks like this case was overlooked in `_moveAttachedGesture`.

**Test plan (required)**

My team's app is using this change.

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

Differential Revision: D4207277

Pulled By: ericvicenti

fbshipit-source-id: a22817c2ebec1c996583269a59d6767f5713771b
2016-11-20 15:28:31 -08:00
Alex Kotliarskyi dcbcda75ec Introduce nativeImageSource API
Summary: The goal is to replace `require('image!...')` with an API that communicates better of what's going on under the hood.

Reviewed By: yungsters, fkgozali

Differential Revision: D4186241

fbshipit-source-id: b764588dbbd9494dd6905b2346e3274b575a9644
2016-11-20 12:28:28 -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
Kevin Gozali 4530da87e2 make Modal pass rootTag to AppContainer
Summary:
Following up on fb7fe2d4e8: when <Modal> is used in dev mode, it renders `<AppContainer>` to wrap the children so that the element inspector can show up correctly. In that scenario, we need pass the `rootTag` over the `<AppContainer>` so that the children can read the rootTag correctly. Otherwise, the children of <Modal> will see it as undefined.

With this, AppContainer can then declare `rootTag` as a required prop, as it should have been.

Note that this only affects DEV build because there's no AppContainer wrapping otherwise.

Reviewed By: jingc

Differential Revision: D4204011

fbshipit-source-id: 80edbc8d351d983786e6fc3c68dfa65a71b1ed3c
2016-11-18 01:43:26 -08:00
Valentin Shergin 5d03ff8035 Added support of `<Text>`'s `selectable` attribute on iOS
Reviewed By: mmmulani

Differential Revision: D4187562

fbshipit-source-id: 131ece141fe8b895914043a7a01c6e042e858331
2016-11-17 16:13:28 -08:00
AgtLucas 84553ebf06 Improve doc code consistency
Summary:
For the sake of consistency. 😃
Closes https://github.com/facebook/react-native/pull/10978

Differential Revision: D4193554

Pulled By: JoelMarcey

fbshipit-source-id: c79de8192ecdd0a38c9693a996de84cf63cc89b1
2016-11-16 18:13:26 -08:00
Saleeh 27ae04cabd Fixed #7564
Summary:
Fix for some firewall with ModSecurity
 rules for MULTIPART_STRICT_ERROR, namely MULTIPART_BOUNDARY_QUOTED.
Closes https://github.com/facebook/react-native/pull/10876

Reviewed By: javache

Differential Revision: D4176229

Pulled By: ericvicenti

fbshipit-source-id: 8db819bd3e9b23fa3c1802c48091bb4c44358381
2016-11-15 08:44:30 -08:00
Adam Comella fde7c35449 Make resolveAssetSource public
Summary:
When building a native component which takes an image reference as a prop, `resolveAssetSource` needs to be called on the image reference. If this isn't done, the native component may receive the opaque type returned by `require` (e.g. `require('./foo.png')`) which is useless to the native component. `resolveAssetSource` is used by builtin components that take image references such as `Image`, `WebView` and `MapView`.

This change makes `resolveAssetSource` public so that third-party native components can correctly handle image references.

**Test plan (required)**

Verified that `Image.resolveAssetSource` works in a test app. Also, my team is using this change in our app.

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

Differential Revision: D4177803

Pulled By: ericvicenti

fbshipit-source-id: ffc511b9340325f7d1111002309cd8558ab8e6b0
2016-11-14 21:14:10 -08:00
Joel Arvidsson 31b7819b02 Unbreak custom animated components
Summary:
Commit c9960817ee broke `Animated.createAnimatedComponent()` for most components outside of the standard ones. This is because it will throw an exception for any component without a `viewConfig` defined, which basically no composition style component has AFAIK.

Related issues: https://github.com/facebook/react-native/issues/10825, https://github.com/oblador/react-native-vector-icons/issues/337, https://github.com/oblador/react-native-animatable/issues/70

This PR removes the check which is more treating the symptoms really – but shouldn't `setNativeProps` duck typing be enough?
Closes https://github.com/facebook/react-native/pull/10827

Differential Revision: D4178183

Pulled By: ericvicenti

fbshipit-source-id: b85cc78ed6d84dada4d476caa243332eaadb003f
2016-11-14 20:58:56 -08:00
Gabe Levi 61d1a4fb39 Deploy v0.35.0
Reviewed By: davidaurelio

Differential Revision: D4177391

fbshipit-source-id: c02cf98ed275b7032103b11eab6d0e189f8d8f24
2016-11-14 20:45:17 -08:00
Adam Comella e87e181998 Android: Expose Image's onError event to JavaScript
Summary:
iOS supports an Image onError event. Android was firing the event but it was never reaching JavaScript because Android didn't include this event in `getExportedCustomDirectEventTypeConstants`.

**Test plan (required)**

Verified that the `onError` event now fires in a test app.

My team uses this change in our app.

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

Differential Revision: D4180149

Pulled By: ericvicenti

fbshipit-source-id: 4bf0b9aa7dc221d838d7b6b3e88bb47196dcadef
2016-11-14 19:43:58 -08:00