Commit Graph

2145 Commits

Author SHA1 Message Date
James Ide 1343248bbe Set statics on the NavigationCard container
Summary:
NavigationCard is wrapped in a container, which breaks statics so apply the statics to the wrapped class instead.
Closes https://github.com/facebook/react-native/pull/7483

Differential Revision: D3336226

Pulled By: ericvicenti

fbshipit-source-id: ae28e7be7a6227700c2c11081c5605f3667d1494
2016-05-23 20:43:28 -07:00
Fred Liu ca71143ff4 Faster animation
Summary: Reduce auto-swipe animation duration to 200 ms to increase swipe speed.

Reviewed By: zjj010104

Differential Revision: D3333942

fbshipit-source-id: a9e0b15926ef854adcd9e1d2c1e67fd080139d84
2016-05-23 10:28:34 -07:00
Nick Lockwood d9737571c4 Updated AppState module to use new emitter system
Summary: AppState now subclasses NativeEventEmitter instead of using global RCTDeviceEventEmitter.

Reviewed By: javache

Differential Revision: D3310488

fbshipit-source-id: f0116599223f4411307385c0dab683659d8d63b6
2016-05-23 09:13:37 -07:00
Pieter De Baets 4880309e72 Prevent Systrace from including React in the preloaded modules section
Reviewed By: tadeuzagallo

Differential Revision: D3304923

fbshipit-source-id: 25dea5b57002578ccb3e38e8946c6b73db008ed0
2016-05-23 04:58:24 -07:00
Nathan Azaria 913b4ccee4 Changed RUNNING_ON_CI to CI_USE_PACKAGER environment variable.
Reviewed By: javache

Differential Revision: D3327726

fbshipit-source-id: 6293b71a2ca7783b089f16fe2089c8893e93a621
2016-05-23 04:44:11 -07:00
Nick Lockwood c8f39c3d2c Added small decoded image cache to prevent images flashing when component is reloaded
Summary:
In RN we cache image data after loading/downloading an image, however the data we store is the compressed image data, and we decode this asynchronously each time it is displayed.

This can lead to a slight flicker when reloading image components because the decoded image is discarded and then re-decoded.

This diff adds a small (5MB) cache for decoded images so that images that are currently on screen shouldn't flicker any more if the component is reloaded.

Reviewed By: bnham

Differential Revision: D3305161

fbshipit-source-id: 9969012f576784dd6f37d9386cbced2df00c3e07
2016-05-23 03:43:30 -07:00
Hedger Wang 1e626027f5 Rename `navigationState.children` to `navigationState.routes`.
Summary:
[Experimental API breaking changes]

The notion of `parent` or `children` in navigaton is misleading. We have no intention to maintain or
build the nested or hierarchical navigation states. To be clear, rename `navigationState.children` to
`navigationState.route`.

Reviewed By: ericvicenti

Differential Revision: D3332115

fbshipit-source-id: c72ed08acaf030fb9c60abf22fb15cc0f44b3485
2016-05-22 16:28:27 -07:00
Corné Dorrestijn c1558bc7db Add Image#getSize for Android
Summary:
I've implemented the getSize method on Image for Android.

**Test plan (required)**

The result in the UIExample app can be seen here:

![android-getsize](https://cloud.githubusercontent.com/assets/570297/15442613/a29c9178-1ee2-11e6-97df-adc20aad0c32.jpg)
Closes https://github.com/facebook/react-native/pull/7664

Differential Revision: D3331704

fbshipit-source-id: d784c861cbc653cd6b49310f4b5516c6583486ca
2016-05-20 18:43:38 -07:00
Hedger Wang fb5d0ff587 D3321403 [NavigationExperimental][CleanUp]: Rename `scene.navigationState` to `scene.route`.
Summary:
[public / experimental API breaking change]

The data type of  `scene.navigationState` is `NavigationRoute`. Rename  `scene.navigationState` to
`scene.route` to avoid confusion such as treating `scene.navigationState` as the actual global navigation
state (type: NavigationState).

Reviewed By: ericvicenti

Differential Revision: D3331076

fbshipit-source-id: 3ed989cc8492d398cbeb1b12186459deb261d1fb
2016-05-20 18:13:30 -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
Mike Grabowski 4446e31b5d ActionSheetIOS - support share sheet on modals
Summary:
Fixes #6913 - follow up to this commit 43dcdaffe2 to support this in the 2nd method as well.
Closes https://github.com/facebook/react-native/pull/7244

Differential Revision: D3330843

fbshipit-source-id: 0923440550a7635202158b4afaba87e12f1c1d54
2016-05-20 17:13:21 -07:00
Hedger Wang 807726bcb4 Rename `NavigationState` to `NavigationRoute`, rename `NavigationParentState` to `NavigationState`.
Summary:
This is the first step to clarify and simplify the type definations about navigation state.
For now,  `NavigationParentState` is actually used as the real navigation state and `NavigationState` is used
as a route in navigation, which has been confusion among the APIs.

To be clear, our APIs has no intention and interest in dealing with nested or hierarchical navigation states,
and we should avoid have the name like `ParentState` or `children`.

To fully migrate the types, theer will be a lot of code changes and this is just the first step to rename.

= What's Next?

1. rename `navigationState.children` to `navigationState.routes` (breaking change!)
2. remove `navigationState.key` from its type defination.

Reviewed By: ericvicenti

Differential Revision: D3321403

fbshipit-source-id: 3e39b60f736c1135bc85d8bf2b89027d665e28d4
2016-05-20 14:28:35 -07:00
Alex Kotliarskyi 946ec48a07 Use RN Packager to symbolicate stack in redbox
Summary:
See "D3291793 Symbolicate JS stacktrace using RN Packager" for the background
of why this matters. TLDR - saving tons of memory by moving symbolication from
JSC into server and cleaning up old hacks.

Before this change: a redbox causes +73MB JSC size
{F60869250}
{F60869249}

After this change: a redbox causes +1MB JSC size
{F61005061}
{F61005062}

Next step – replace JS implementation by native to show better progress and
clean up even more old APIs (ExceptionsManager.updateExceptionMessage).

Reviewed By: davidaurelio

Differential Revision: D3319151

fbshipit-source-id: 48ff4df27642ea4e1bc2414f48a8dd4d32adee50
2016-05-20 12:13:49 -07:00
Alex Kotliarskyi e4753867ea Fix internal fields access for inspector
Reviewed By: sebmarkbage

Differential Revision: D3325549

fbshipit-source-id: d6cf89f5dbbe9db5bec37632e6976c6e537575fb
2016-05-20 12:13:48 -07:00
dmueller39 0aea74ebea Fixed incorrect rows reported in onChangeVisibleRows
Summary:
There is a bug in onChangeVisibleRows when the renderSeparator is not null. The _updateVisibleRows function does not account for the presence of separator frames in the  _childFrames array.

When renderSeparator is not null, increment the totalIndex an additional
time for each row that isn't the last in its section, or the last in the entire
list.

This continues a slightly brittle precedent of having a set of parallel conditions in render and _updateVisibleRows. (i.e. renderSectionHeader is used in both functions, in render as a condition to create a sectionHeader, and in _updateVisibleRows as a condition to increment the totalIndex.

Before change:
![yeeqnmvmif](https://cloud.githubusercontent.com/assets/9422359/14515342/38543952-01c7-11e6-984c-7c1a3fc3d820.gif)

After change:
![gzbrljclzm](https://cloud.githubusercontent.com/assets/9422359/14515340/3296e294-01c7-11e6-8ae9-1ad313600956.gif)

Built using https://gist.github.com/dmueller39/f95028f6fe8bd251944bb604e51f18b2
Closes https://github.com/facebook/react-native/pull/6965

Differential Revision: D3328001

Pulled By: vjeux

fbshipit-source-id: 977e54382ee07be7a432a54febafcae6acaae905
2016-05-20 08:13:23 -07:00
Fred Liu 3ccfb58701 Simplify SwipeableRow styling
Summary: - Removed some styling from `SwipeableRow` that wasn't doing much and made slide out view full height

Reviewed By: fkgozali

Differential Revision: D3322849

fbshipit-source-id: 811eee9032c142c61d303ae7e966d8ef7903adaf
2016-05-19 21:43:42 -07:00
Fred Liu 62e588bece Fix Android flash and iOS juttering
Summary:
Before:
- Android had the slideout row flash upon render due to it being rendered first
- iOS had the left side of each row load first, then rerender to show entire row when `scrollViewWidth` is available

Reason:
- Android was loading the slideout view first without an opacity check
- iOS was loading the swipeable view with width 0 first then stretching to `scrollViewWidth` when it was available via `onLayout`

Fix:
Render swipeable view with `flex: 1` then render slideout view

Reviewed By: fkgozali

Differential Revision: D3321466

fbshipit-source-id: 92a3b5e22034e06d05986ddb8c348796bafbbf34
2016-05-19 21:43:42 -07:00
Spencer Ahrens 5e91a2a312 Fix 95% of WindowedListView jumpiness
Summary:
- Replace some fixes that were accidentally lost in local rebase that prevent jumpiness when incremental is disabled.
- Require each row to have a key specified by the caller to prevent jumping because of accidental duplicates or unneeded/problematic row re-rendering because of legit re-ordering.

Reviewed By: steveluscher

Differential Revision: D3322006

fbshipit-source-id: 0019aab07cb1fe2b148a14b5818de53aa373eb50
2016-05-19 14:58:26 -07:00
Alexander Blom 942b9332b2 Make BugReporting not pull in native module on require
Reviewed By: astreet

Differential Revision: D3322838

fbshipit-source-id: 4f12fda213b6a4ab7b19d3dafad7f31eb627f85a
2016-05-19 12:58:21 -07:00
Spencer Ahrens 838d8d4094 adaptive render window throughput
Summary:
Incremental rendering is a tradeoff between throughput and responsiveness because it yields. When we have plenty of
buffer (say 50% of the target), we render incrementally to keep the app responsive. If we are dangerously low on buffer
(say below 25%) we always disable incremental to try to catch up as fast as possible. In between, we only disable
incremental while actively scrolling since it's unlikely the user will try to press a button while scrolling.

This also optimizes some things then incremental is switching back and forth.

I played around with making the render window itself adaptive, but it seems pretty futile to predict - once the user
decides to scroll quickly in some direction, it's pretty much too late and increasing the render window size won't help
because we're already limited by the render throughput at that point.

Reviewed By: ericvicenti

Differential Revision: D3250916

fbshipit-source-id: 930d418522a3bf3e20083e60f6eb6f891497a2b8
2016-05-18 17:13:23 -07:00
Fred Liu 514677525a Prevent `SwipeableRow` bleed
Summary: Default image icon size for Quick Actions could cause slideout view to bleed over the slideable view. All styling has been removed and must now be passed in, thus allowing every caller to control size for best fit.

Reviewed By: furdei

Differential Revision: D3315696

fbshipit-source-id: 8f8b3d2cf7a005d42a18d434d9e0080c64597be0
2016-05-18 16:43:20 -07:00
Alexander Blom dc6a44713d Refactor BugReporing to avoid multiple registers
Reviewed By: sahrens

Differential Revision: D3316146

fbshipit-source-id: 80df4ea73150ba6920a03fe336b3ddb207ba535a
2016-05-18 14:28:26 -07:00
Hedger Wang 7db7f78dc7 Fork NavigationAnimatedView to NavigationTransitioner
Summary:
- Fork NavigationAnimatedView to NavigationTransitioner
- NavigationAnimatedView will soon be deprecated and we'd ask people to use NavigationTransitioner instead.

Difference between  NavigationTransitioner and NavigationAnimatedView

- prop `applyAnimation` is removed.
- new prop `configureTransition`, `onTransitionStart`, and `onTransitionEnd` are added.

tl;dr;

In NavigationAnimatedView, we `position` (an Animated.Value object) as a proxy of the
transtion which happens whenever the index of navigation state changes.

Because `position` does not change unless navigation index changes, it won't
be possible to build animations for actions that changes the  navigation state
without changing the index.

Also, we believe that the name `Transitioner` is a better name for this core component
that focuses on transitioning. Note that the actual animation work is done via
`<Animated.View />` returnd from the `renderScene` prop.

Reviewed By: ericvicenti

Differential Revision: D3302688

fbshipit-source-id: 720c3a4d3ccf97eb05b038baa44c9e780aad120b
2016-05-18 13:43:31 -07:00
Joe Noon 0e997c6eab fixes a bug where NavigationPropTypes.SceneRenderer was a plain object
Summary:
... used as both a shape and plain object.

this splits them out so both parts can be used as needed.

NavigationPropTypes.SceneRenderer is a PropTypes shape
NavigationPropTypes.SceneRendererProps is the plain object that makes up the shape.
Closes https://github.com/facebook/react-native/pull/7518

Differential Revision: D3317322

Pulled By: ericvicenti

fbshipit-source-id: e8a31e05130e6647b63f68dbef31bc874550948c
2016-05-18 13:13:29 -07:00
Fred Liu 7f1346bfdd Top align quick action buttons
Summary: Top align the button icons

Reviewed By: fkgozali

Differential Revision: D3317805

fbshipit-source-id: b385f9f4e41db1253bb4d523cb07093c63e39da0
2016-05-18 12:43:24 -07:00
Alex Kotliarskyi f203c5d78c Add "Open file" button to elements inspector
Summary:
Depends on #6351

Now you can open file directly from Elements Inspector!

Credit for the original implementation goes to jaredly

![zcichu7kem](https://cloud.githubusercontent.com/assets/192222/14573876/cb100f6e-030c-11e6-925f-6a6dff510145.gif)

**Test plan**

Made sure it doesn't crash the app with or without #6351 (i.e. can be merged safely before #6351 gets in).
Closes https://github.com/facebook/react-native/pull/7005

Differential Revision: D3313714

Pulled By: frantic

fbshipit-source-id: 3b80abd3e81a0db5ca5136e2d2c94c775fa04f3a
2016-05-17 20:58:25 -07:00
Alexander Blom 0694a2991c Use infoLog instead of console.log
Reviewed By: sahrens

Differential Revision: D3304886

fbshipit-source-id: 79d3fd2b833380a18dfbee666f9bd5eaf25b0744
2016-05-17 12:43:40 -07:00
Alexander Blom 2a67f9b249 Move infoLog to OSS
Reviewed By: sahrens

Differential Revision: D3310270

fbshipit-source-id: 93261e6083a35e6869b384c8c230c861427e4060
2016-05-17 12:43:40 -07:00
Ben Nham 5bb5ea7135 Reload image without dispatch_async if completion handler is already on main thread
Summary:
This works with D3305161 to minimize image flashing. After D3305161, the completion handler passed to `-[RCTImageLoader loadImageWithoutClipping:size:scale:resizeMode:progressBlock:completionBlock:]` may be called back on the main queue in the case of a cached image. In this case, we want to set the image view's image property synchronously rather than on the next runloop iteration via dispatch_async. This minimizes the amount of image flashing the user sees when displaying a cached image.

The exception to this case is for blurred images. A blur can be an expensive (taking multiple ms on the CPU), so we always make sure to perform the blur off the main queue even if the image is cached and the callback came back on the main queue.

Reviewed By: nicklockwood

Differential Revision: D3310176

fbshipit-source-id: 6820782527b65e4956879cf06e8ed2c09c622a58
2016-05-17 10:43:30 -07:00
Adam Comella fe5c0d2d06 iOS: Enable views to be nested within <Text>
Summary:
Previously, only Text and Image could be nested within Text. Now, any
view can be nested within Text. One restriction of this feature is
that developers must give inline views a width and a height via
the style prop.

Previously, inline Images were supported by using iOS's built-in support
for rendering images with an NSAttributedString via NSTextAttachment.
However, NSAttributedString doesn't support rendering arbitrary views.

This change adds support for nesting views within Text by creating one
NSTextAttachment per inline view. The NSTextAttachments act as placeholders.
They are set to be the size of the corresponding view. After the text is
laid out, we query the text system to find out where it has positioned each
NSTextAttachment. We then position the views to be at those locations.

This commit also contains a change in `RCTShadowText.m`
`_setParagraphStyleOnAttributedString:heightOfTallestSubview:`. It now only sets
`lineHeight`, `textAlign`, and `writingDirection` when they've actua
Closes https://github.com/facebook/react-native/pull/7304

Differential Revision: D3269333

Pulled By: nicklockwood

fbshipit-source-id: 2b59f1c5445a4012f9c29df9f10f5010060ea517
2016-05-17 10:43:30 -07:00
Sean Kelley 908041b80b Round alpha channel when interpolating colors to the nearest thousandth.
Summary:
This fixes an issue where animations for values near zero could end up formatted
with exponents (e.g. `1.452e-10`), which is not valid for an `rgba` color spec.
This commit arbitrarily rounds it to the nearest thousandth to prevent this type
of formatting while still maintaining high-enough resolution in the alpha channel.

One way this could bubble up to the user is as PropType validation failures:

```
Failed propType: Invalid prop `backgroundColor` supplied to `RCTView`: rgba(0, 0, 0, 9.838983123336224e-7)
```
Closes https://github.com/facebook/react-native/pull/7597

Differential Revision: D3310941

Pulled By: vjeux

fbshipit-source-id: 0c95facaef5b69c021662af9fb6f268d890ecc3e
2016-05-17 10:13:29 -07:00
Alexander Blom f71329946c Don't barf if property throws
Reviewed By: davidaurelio

Differential Revision: D3305125

fbshipit-source-id: 48143195cd1d48a9f99f4d93dfdf62b51ba6b4c1
2016-05-17 05:13:24 -07:00
Fred Liu 12fcacb58f Full width styling for quick actions
Summary: - Used absolute positioning to render full-width quick actions

Reviewed By: fkgozali

Differential Revision: D3302467

fbshipit-source-id: cdcac88b20eff7a71be1ab8bb39e6888216dad84
2016-05-17 01:43:27 -07:00
Fred Liu c779e233b6 Improve SwipeableListView performance
Summary:
- Removed unnecessary rerending of `SwipeableListView` by properly managing `SwipeableListViewDataSource`
- Simplified `SwipeableRow` logic and improved swiping performance
- Added bounce effect
- Locked `ListView` from being scrollable when `SwipeableRow` is being swiped; behaviour mirrors that of Android on iOS and significantly improves framerates

Reviewed By: fkgozali

Differential Revision: D3307599

fbshipit-source-id: 168b6b72ef1f9e47d0145cf9e1baecbab3564b84
2016-05-16 20:28:27 -07:00
Yu Huang 34907c3810 Fix List View _updateVisibleRows firing for all row component at view loading time issue
Summary:
Sometimes list view row components(even the ones unseen) have a frame but its x and y is 0 or uninitialized at view loading time, which will lead to _updateVisibleRows firing for all the row components incorrectly at loading time.
This is to make the code more defensive.

Reviewed By: sahrens

Differential Revision: D3308515

fbshipit-source-id: 0e30fdf10345629bfd9de3fe0ad641bb1903fe00
2016-05-16 18:28:21 -07:00
Tore Hanssen df40f482b0 Callback with image height and width from IOSImagePicker
Reviewed By: javache

Differential Revision: D3301645

fbshipit-source-id: c771d491447f8ed9dc6c8685e273b99656336b0a
2016-05-16 11:13:23 -07:00
Naman Goel 1673e00e2b correct flow types
Summary:
The function should have optional arguments, but not nullable types.
Closes https://github.com/facebook/react-native/pull/7580

Differential Revision: D3304994

Pulled By: davidaurelio

fbshipit-source-id: 9918817429126ea16dd3076b61a3493c3a3a8388
2016-05-16 07:58:26 -07:00
Alexander Blom f13322c820 Add support for dumping current React hierarchy
Reviewed By: sebmarkbage

Differential Revision: D3287391

fbshipit-source-id: 0ef1cd25a910dcc0a50ed52a2cc0ae702a9654f4
2016-05-16 07:28:29 -07:00
Alexander Blom 610cfdc819 Add support for custom files in BugReporting
Reviewed By: astreet

Differential Revision: D3287186

fbshipit-source-id: ce7000ac110b78a4fb94c66229046617c292675f
2016-05-16 07:28:29 -07:00
Nick Lockwood 516bf7bd94 Fixed NativeEventListener deregistration
Summary:
The `EmitterSubscription.remove()` method was previously calling `this.subscriber.removeSubscription(this)` directly, bypassing the mechanism in `NativeEventEmitter` that keeps track of the number of subscriptions.

This meant that native event modules (subclasses of `RCTEventEmitter`) would keep sending events even after all the listeners had been removed. This wasn't a huge overhead, since these modules are singletons and only send one message over the bridge per event, regardless of the number of listeners, but it's still undesirable.

This fixes the problem by routing the `EmitterSubscription.remove()` method through the `EventEmitter` so that `NativeEventEmitter` can apply the additional native calls.

I've also improved the architecture so that each `NativeEventEmitter` uses its own `EventEmitter`, but they currently all still share the same `EventSubscriptionVendor` so that legacy code which registers events via `RCTDeviceEventEmitter` still works.

Reviewed By: vjeux

Differential Revision: D3292361

fbshipit-source-id: d60e881d50351523d2112473703bea826641cdef
2016-05-16 04:13:56 -07:00
Alexander Blom 9a899bed65 Memoize lazy module configs
Reviewed By: javache

Differential Revision: D3293010

fbshipit-source-id: feab7bb0a1f8990baea9c0aca8c9c3cccbcb04e8
2016-05-16 03:58:23 -07:00
Yao Bin Then 433c0e8021 Add comments on NetInfo.js
Summary:
Further describe the methods available on NetInfo.

Question: How do I update the docs on the website?
Closes https://github.com/facebook/react-native/pull/7375

Differential Revision: D3303300

fbshipit-source-id: 4343d490f65e4e47b93f2c98a645cb675d2cf708
2016-05-14 21:50:24 -07:00
Spencer Ahrens c2a8e52d72 Fix source map utils
Reviewed By: javache

Differential Revision: D3302496

fbshipit-source-id: de15a289497119c7f600b8796452fc9573ea7394
2016-05-14 10:43:30 -07:00
Hedger Wang 8975bb8e70 `didFocus` event should fired after transition finishes.
Summary:
For now, we emit `didFocus` event before fully resetting the transition and
hiding the stale scenes, so handler for `didFocus` event does not get the right
scenes in place. We should emit the didFocus event after resetting the transition and
hiding the stale scenes.

Reviewed By: ericvicenti

Differential Revision: D3299002

fbshipit-source-id: 6a79528097aabc4f61d4dba322820c228c889a84
2016-05-13 12:58:24 -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
Olivier Notteghem 99b106658f Reverted commit D3278698
Summary:
= Breaking Change (for experimental features) =

Major API changes in  NavigationAnimatedView

= New prop `transition` for scene renderer

In NavigationAnimatedView, we should not use `position` as a proxy of the
transtion which happens whenever navigation state changes.

Because `position` does not change unless navigation index changes, it won't
be possible to build animations for actions that replace navigation state
without changing the index.

This diff introduces an abstract prop `transition` that is exposed to the scene
renderers.

= Replace `applyAnimation` with `configureTransition`.

Expose a new optional prop  `configureTransition` that allows people to configure
transitions easily.

For instance, to configure the transition, do this:

```
function configureTransition() {
  return {
    dutation: 123,
    easing: Easing.easeInOut,
  };
}

```
<NavigationAnimatedView configureTransition={configureTransition) />

```

Reviewed By: ericvicenti

Differential Revision: D3278698

fbshipit-source-id: b790b92e0fabb42488ff1135b1c37a3f0e9420f7
2016-05-12 18:58:45 -07:00
Fred Liu 3f1cd5aa4e Center align text on Android
Summary: Center align text on Android

Reviewed By: fkgozali

Differential Revision: D3295222

fbshipit-source-id: c707d1102c8aa86aa04dc9b34a4746b1ff1543bc
2016-05-12 16:09:30 -07:00
Fred Liu 853074d1ee Pass along scrollResponder()
Summary: Allows calls to `scrollResponder()` without crashing

Reviewed By: fkgozali

Differential Revision: D3293272

fbshipit-source-id: c46d99c0d7430a37fc364fa3aaf77dd192d7ab37
2016-05-12 11:49:24 -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
Pieter De Baets 1b5b5d9c5b Improve error handling in route generation script
Reviewed By: sam-swarr

Differential Revision: D3282748

fbshipit-source-id: 17301c6639a7517d1171a67567f220471020b78d
2016-05-12 04:29:24 -07:00
Hedger Wang 55c308615a Expose a new prop `transition` for scene renderer.
Summary:
= Breaking Change (for experimental features) =

Major API changes in  NavigationAnimatedView

= New prop `transition` for scene renderer

In NavigationAnimatedView, we should not use `position` as a proxy of the
transtion which happens whenever navigation state changes.

Because `position` does not change unless navigation index changes, it won't
be possible to build animations for actions that replace navigation state
without changing the index.

This diff introduces an abstract prop `transition` that is exposed to the scene
renderers.

= Replace `applyAnimation` with `configureTransition`.

Expose a new optional prop  `configureTransition` that allows people to configure
transitions easily.

For instance, to configure the transition, do this:

```
function configureTransition() {
  return {
    dutation: 123,
    easing: Easing.easeInOut,
  };
}

```
<NavigationAnimatedView configureTransition={configureTransition) />

```

Reviewed By: ericvicenti

Differential Revision: D3278698

fbshipit-source-id: 25ebad286d8b41f46c35c0f32d6023ebd01f19e7
2016-05-11 18:45:31 -07:00
Fred Liu 763e9cce27 SwipeableListView quick actions
Summary:
- Implemented a quick actions template to allow children buttons to be rendered in the slideout of `SwipeableListView`
- Implemented `QuickActionsButton` to allow buttons to be used in the slideout view

Reviewed By: fkgozali

Differential Revision: D3271946

fbshipit-source-id: b7c7412f44be64dea7084ca36c4b0f4f3842b008
2016-05-11 18:02:20 -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
Hedger Wang c3714d7ed7 Kill <NavigationView />
Summary:
= Breaking Change (for experimental features) =

<NavigationView /> serves no obvious benefit and it's costly to maintain it.

- its features could be completely replaced by NavigationAnimatedView without
  enabling the transtion animation.

- it could also be replaced with a simple view and normal scene renderer.

Reviewed By: ericvicenti

Differential Revision: D3280547

fbshipit-source-id: 4ac3dbe92ceb9107a1f6e77a78bd6021485e78a9
2016-05-11 16:23:26 -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
Fred Liu 052cd7eb8a SwipeableListView
Summary:
- Updated SwipeableListView to be much more performant by checking `rowHasChanged` more vigorously
- New `SwipeableListViewDataSource` used to mask implementation details from caller

Reviewed By: fkgozali

Differential Revision: D3272172

fbshipit-source-id: 02f66ed7fce7d587118ad7d82b20f8e78db44b7b
2016-05-11 00:25:20 -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
Ben Alpert a95405f419 Update to React 15.1.0-alpha.1
Reviewed By: zpao

Differential Revision: D3283057

fbshipit-source-id: c37ea3818597e5c0f37ed3c7502c791c02183ea8
2016-05-10 15:58:24 -07:00
Jimmy Mayoukou d3e5a96b15 Fix tintColor prop platform in Image
Summary:
`tintColor`, even in style, works on Android; this must be some old comment but that confused me when reading the docs.

**Test plan:**
- Launched website locally
Closes https://github.com/facebook/react-native/pull/7465

Differential Revision: D3278166

fbshipit-source-id: 4e986e0f2a9ba05de4404b93d28687596fbb4fad
2016-05-09 15:29:24 -07:00
Nick Lockwood 963a53b1a7 Fixed XHR tests
Summary:
The XMLHttpRequest jest tests were attempting to call a private method in XMLHttpRequestBase.js (denoted by an _ prefix).

JS doesn't actually have any language-level support for private methods, the use of _ prefix is just a convention. But to prevent casually calling private methods externally, we have a transform that mangles the names of prefixed methods so that that attempting to call them will fail.

Using a double _ bypasses this name-mangling mechanism, while still making it clear that the method is intended to be private.

Reviewed By: javache

Differential Revision: D3276261

fb-gh-sync-id: e0c17e1003d2df09d1a16f78ae9d95bef923d74e
fbshipit-source-id: e0c17e1003d2df09d1a16f78ae9d95bef923d74e
2016-05-09 10:36:24 -07:00
Eric Vicenti b24d471fb2 Backed out D3033933
Reviewed By: hedgerwang

Differential Revision: D3273603

fb-gh-sync-id: e013fd3efd793960d076d2a01447b2a11f483ede
fbshipit-source-id: e013fd3efd793960d076d2a01447b2a11f483ede
2016-05-09 08:33:18 -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
Nick Lockwood ed1ee9bc0f Fixed crash due to inserting a nil object into an array
Summary: Fixed a crash where making a network request with unrecognized/unsupported scheme would crash by attempting to insert a nil RCTNetworkTask into an array.

Reviewed By: javache

Differential Revision: D3275810

fb-gh-sync-id: be208c6bf87d882209901b850dcc25da4ba79a08
fbshipit-source-id: be208c6bf87d882209901b850dcc25da4ba79a08
2016-05-09 08:18:47 -07:00
Jesse Sessler 191d278fda Modal Status Bar Translucent
Summary:
Currently the Modal component on Android is rendered below the Status Bar, which changes it's color to grey, and in the UIExplorer example the backdrop is just formatted to look the same color. In some scenarios users may want to preserve the color of their status bar and make it look as though the modal is appearing on top. This PR allows for that.

This GIF shows current behavior and new behavior with the translucentStatusBar prop set to true.

![](http://g.recordit.co/BSX5g9obRC.gif)

I've updated the UIExplorer app to demonstrate and the docs as shown below

![image](https://cloud.githubusercontent.com/assets/4265163/14742854/500e1292-086c-11e6-9275-71808b0cbed7.png)

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

Differential Revision: D3264497

Pulled By: dmmiller

fb-gh-sync-id: 61346d99414d331d3420f44a4c5f6341b0973be6
fbshipit-source-id: 61346d99414d331d3420f44a4c5f6341b0973be6
2016-05-09 07:08:22 -07:00
Alexander Blom abca466037 Remove name property from native modules
Reviewed By: javache

Differential Revision: D3275674

fb-gh-sync-id: 7c100c78576b48f3163c37b93499dd54da73b96c
fbshipit-source-id: 7c100c78576b48f3163c37b93499dd54da73b96c
2016-05-09 05:46:23 -07:00
Pieter De Baets d7de68241f Index UIManager.Commands correctly
Reviewed By: nicklockwood

Differential Revision: D3275652

fb-gh-sync-id: a38e9cf6a46f2aa373b4948aa419b42af402c784
fbshipit-source-id: a38e9cf6a46f2aa373b4948aa419b42af402c784
2016-05-09 05:25:23 -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
wusuopu 17f08070e8 Animated: Implement toJSON method of Animated
Summary:
Fix issue https://github.com/facebook/react-native/issues/7441
Closes https://github.com/facebook/react-native/pull/7442

Differential Revision: D3274594

fb-gh-sync-id: 720d7dcdaa97a2ee5235547bad6ba020398b57d2
fbshipit-source-id: 720d7dcdaa97a2ee5235547bad6ba020398b57d2
2016-05-08 01:09:21 -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
Alexander Blom 097f59112f Make MessageQueue.RemoteModules lazy
Reviewed By: javache

Differential Revision: D3252400

fb-gh-sync-id: 11a31fd2e1e41c6a3ad538b08ef177207780bd88
fbshipit-source-id: 11a31fd2e1e41c6a3ad538b08ef177207780bd88
2016-05-06 04:14:23 -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
Fred Liu 2132ad1441 Swipeable list view enhancements
Summary:
- Removes "flickering" on first load
- Takes in Map<rowID, slideoutView> to display customs slideout view in `SwipeableRowListView`

Reviewed By: furdei

Differential Revision: D3267262

fb-gh-sync-id: a89806138b9172b3c184cc117504e205632a36d0
fbshipit-source-id: a89806138b9172b3c184cc117504e205632a36d0
2016-05-05 20:45:24 -07:00
Eric Vicenti 14eb427a80 Kill NavigationExperimental Containers
Summary:
The containers in NavigationExperimental are not appropraite because the state should be held by the app's architecture, be it redux, flux, or simple component state.

This diff moves the examples over to simple component state, but there are several other examples of how to use NavigationAnimatedView and the navigation reducers with redux:

- https://github.com/jlyman/RN-NavigationExperimental-Redux-Example
- Switching the f8 app with redux to navigation experimental: https://github.com/fbsamples/f8app/pull/14

Reviewed By: hedgerwang

Differential Revision: D3219911

fb-gh-sync-id: eb0b323e2c165c32027fbd00dc6197ad441d6552
fbshipit-source-id: eb0b323e2c165c32027fbd00dc6197ad441d6552
2016-05-05 16:52:19 -07:00
Sebastian Gronewold 07767e86a3 Navigator - velocity override
Summary:
This code change allows changing the transition velocity of the navigator
when switching views.

Whats the use case? If you have different types of
animations your animations might also need different transition velocities.
Closes https://github.com/facebook/react-native/pull/5439

Differential Revision: D3264719

Pulled By: ericvicenti

fb-gh-sync-id: 1bc0a1191ed3bd51b624acd161c3ee77fd748d72
fbshipit-source-id: 1bc0a1191ed3bd51b624acd161c3ee77fd748d72
2016-05-05 15:06:47 -07:00
Eric Vicenti 472f815e45 NavigationExperimental: Add key to NavigationSceneRendererProps
Summary:
This should simplify the renderScene usage a bit because the react key is required and this will make sure they are rendered with the right key automatically.

It changes the string to make sure people do not rely on this API for anything else.

Reviewed By: javache

Differential Revision: D3033933

fb-gh-sync-id: 036424af28693be32c3a3290f5c6667a6a6a04ac
fbshipit-source-id: 036424af28693be32c3a3290f5c6667a6a6a04ac
2016-05-05 11:58:26 -07:00
Fred Liu 2a7f6aeda7 Swipeable row container
Reviewed By: hedgerwang

Differential Revision: D3263983

fb-gh-sync-id: f77bb3dd7771c16e1f26398171b7784e3d89cb1d
fbshipit-source-id: f77bb3dd7771c16e1f26398171b7784e3d89cb1d
2016-05-05 11:49:29 -07:00
Hedger Wang b1cd1cba32 Fix propType check for NavigationCard.
Summary:
the prop type check for NavigationCard -> SceneView -> sceneRendererProps is wrong.
Fix it.

Reviewed By: ericvicenti

Differential Revision: D3265049

fb-gh-sync-id: 16e89c932f0f962db4b6a647d62d255ba98f6156
fbshipit-source-id: 16e89c932f0f962db4b6a647d62d255ba98f6156
2016-05-05 11:39:29 -07:00
Hedger Wang ef44781f3d Kill NavigationLegacyNavigator.
Summary:
NavigationLegacyNavigator was originally created to help people to migrate to the new
navigation library without API changes. Therefore we'd have to port all the old APIs that
don't necessarily seem align well with the new navigation library.

Consider the production usage of NavigationLegacyNavigator does not exist, it's better
to kill it and we'd just rename the `Navigator` to `NavigatorDeprecated` later instead.

Reviewed By: ericvicenti

Differential Revision: D3263704

fb-gh-sync-id: a851fda1516d694cb7d119f5a1344f8fc676f7fd
fbshipit-source-id: a851fda1516d694cb7d119f5a1344f8fc676f7fd
2016-05-05 10:56:41 -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
Chris Geirman a26afd2d73 clarify highlightRow usage with UIExplorer example
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

> From the existing documentation, it's not clear how one would make use of the highlightRow attribute of ListView.renderRow. Special thanks to halilb for his assistance.

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.

> Here's a screenshot of the UIExplorer with a row highlighted (using the FB Blue Color)
> <img width="466" alt="2016-03-16_1944" src="https://cloud.githubusercontent.com/assets/1640318/13835020/49b5b38c-ebb1-11e5-98fa-17201fd3db92.png">

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

Differential Revision: D3264092

Pulled By: nicklockwood

fb-gh-sync-id: 9608e8a66387f527b872928a3595ca4d17736b82
fbshipit-source-id: 9608e8a66387f527b872928a3595ca4d17736b82
2016-05-05 03:43:47 -07:00
Fred Liu d037840158 SwipeableRow fix
Reviewed By: fkgozali

Differential Revision: D3261975

fb-gh-sync-id: f0c75aca1b16f810420a78271937777c5068c9d2
fbshipit-source-id: f0c75aca1b16f810420a78271937777c5068c9d2
2016-05-04 19:51:18 -07:00
Fred Liu 9b1a3c79e9 Swipeable row component
Reviewed By: furdei

Differential Revision: D3259527

fb-gh-sync-id: c2503476eb708add8753de8c00d0c3f5f3058474
fbshipit-source-id: c2503476eb708add8753de8c00d0c3f5f3058474
2016-05-04 15:49:20 -07:00
Pieter De Baets 2760df761d Cleanup InitializeJavascriptAppEngine
Reviewed By: davidaurelio

Differential Revision: D3235141

fb-gh-sync-id: 86fc844c5e9d9ea57d504696bac30671c2079e7a
fbshipit-source-id: 86fc844c5e9d9ea57d504696bac30671c2079e7a
2016-05-04 10:50:32 -07:00
Jean-Richard Lai 2310494f32 Fix distanceFilter caching for LocationObserver
Summary:
Allow changing distanceFilter after _locationManager has been initialized.

There is 2 reasons for this PR:
- When calling `getCurrentPosition`, `_observerOptions` is possibly not set properly ( as it is set only in `startObserving`), in this case it would have default values so `distanceFilter` will be 0 in this case ( which can be the right value but we should be more explicit about it, `kCLDistanceFilterNone` or `RCT_DEFAULT_LOCATION_ACCURACY`):
<img width="961" alt="screen shot 2016-04-14 at 8 44 09 pm" src="https://cloud.githubusercontent.com/assets/159813/14551465/6aa8791a-0288-11e6-9c98-1687357f8c2a.png">
- Another issue is that `distanceFilter` is cached so it can't be changed afterwards:

```javascript
let options;
options = {
  enableHighAccuracy: true,
  distanceFilter: 20,
};

this.watchId = this.geolocation.watchPosition(
  () => { },
  () => { },
  options,
);

// => sets distanceFilter to 20

this.geolocation.clearWatch(this.watchId);

options = {
  enableHighAccuracy:
Closes https://github.com/facebook/react-native/pull/6987

Differential Revision: D3258956

fb-gh-sync-id: 00a1d1b29d732a54cdc30e20a7a9a2de3dd9b725
fbshipit-source-id: 00a1d1b29d732a54cdc30e20a7a9a2de3dd9b725
2016-05-04 10:35:30 -07:00
Alexander Blom 041185edfd Let JS modules use strings instead of ids on Android
Reviewed By: nicklockwood

Differential Revision: D3229626

fb-gh-sync-id: f8b2e8c9fc0d25d67f623cdbbe9930a02a40d1de
fbshipit-source-id: f8b2e8c9fc0d25d67f623cdbbe9930a02a40d1de
2016-05-04 10:29:26 -07:00
Nick Lockwood e72163f0f2 Added explicit init to observer modules
Summary:
Modules which call JS methods directly, or use `sendDeviceEventWithName:`, can trigger effects in JS without ever being referenced from the JS code. This breaks some assumptions in my earlier diff about when modules can be lazily loaded.

Pending a better solution, I've put explicit `init` methods in these modules to ensure they are eagerly initialized (the downside to this is that they'll still be initialized even if they are never used).

Reviewed By: javache

Differential Revision: D3258232

fb-gh-sync-id: f925bc2e5339c1fbfcc244d4613062c5ab848fc2
fbshipit-source-id: f925bc2e5339c1fbfcc244d4613062c5ab848fc2
2016-05-04 07:07:24 -07:00
Konstantin Raev ec5016ad8f Fixed path to regenerator-runtime
Summary:
Since 0.8.43 regenerator has regenerator-runtime dependency.
Fixes one js test in trunk
Closes https://github.com/facebook/react-native/pull/7351

Reviewed By: davidaurelio

Differential Revision: D3252699

Pulled By: bestander

fb-gh-sync-id: cedb122eb8e9f3a5e40a5313482bc2282511c71e
fbshipit-source-id: cedb122eb8e9f3a5e40a5313482bc2282511c71e
2016-05-04 05:19:31 -07:00
David Aurelio 46d98e1d68 remove support for `process.platform`
Reviewed By: javache

Differential Revision: D3252666

fb-gh-sync-id: af0e4987c34f43ec2472cbdf52fc112b81050513
fbshipit-source-id: af0e4987c34f43ec2472cbdf52fc112b81050513
2016-05-04 02:51:26 -07:00
Krzysztof Magiera 6c80f886ae Fix setValue to work properly on natively driven nodes
Summary:
This change fixes an issue with calling `setValue` for natively driven nodes. As of now an attempt to call this method from JS would trigger an error "Attempting to run JS driven animation on animated". That is because for natively animated nodes we don't allow for `setNativeProps` to be executed and method `_flush` is now responsible for triggering that call. To fix the issue we add extra flag to `_updateValue` method that indicates if we should be "flushing" updated values using `setNativeProps` and we pass an appropriate value depending on the status of the node (native/non-native). Note that in animation callback we always pass `true` - that is because natively driven animations will never call into that callback.

**Test Plan**
Run JS tests: `npm test Libraries/Animated/src/__tests__/AnimatedNative-test.js`
Closes https://github.com/facebook/react-native/pull/7138

Differential Revision: D3257696

fb-gh-sync-id: 13ec26bc36b56b3208f4279a95532bbe60551087
fbshipit-source-id: 13ec26bc36b56b3208f4279a95532bbe60551087
2016-05-04 02:48:22 -07:00
Griffin Smith 5723915eaa Remove all null values for request headers
Summary:
NSMutableURLRequest appears to be running `[headerValue count]` on every value of the NSDictionary that `allHTTPHeaderFields` is set to, meaning that any `null` values passed to headers in an XHR throw an exception.  This differs from the implementation of XHR in browsers, which just ignore any `null` values for headers.

PR doesn't currently include tests, happy to add those if this is something you'd consider merging
Closes https://github.com/facebook/react-native/pull/6903

Differential Revision: D3256727

fb-gh-sync-id: 58e8db9c86a1fe7fbd95cba7dcf916957d179e0c
fbshipit-source-id: 58e8db9c86a1fe7fbd95cba7dcf916957d179e0c
2016-05-03 23:42:26 -07:00
Spencer Ahrens 1d802da7d2 Fix JSWatchdog reset
Reviewed By: ericvicenti

Differential Revision: D3249690

fb-gh-sync-id: 00221d7b3a669b0feb2061b5f6e703339c147172
fbshipit-source-id: 00221d7b3a669b0feb2061b5f6e703339c147172
2016-05-03 19:20:26 -07:00
Eric Vicenti bb39a2e9da Reduce extra rendering in NavigationCard
Summary: This adds a new SceneView with a shouldComponentUpdate policy of only re-rendering when the scene's state changes. This allows avoidance of extra re-renders. Results in a much smoother back-swipe gesture because we no longer re-render scenes as we transition from gesture to animation.

Reviewed By: hedgerwang

Differential Revision: D3219545

fb-gh-sync-id: 7c04e0e4ebb40d1e57ef7af11e2e54adf4f52aa0
fbshipit-source-id: 7c04e0e4ebb40d1e57ef7af11e2e54adf4f52aa0
2016-05-03 13:31:18 -07:00
Yedidya Kennard 55c8158c44 Corrected bug that put the UTI instead of mimeType in retrieved assets
Summary:
This pull request corrects a bug  found in `RCTAssetsLibraryRequestHandler` which used the asset UTI as the mimeType.

The code for finding the mimeType is based on the implementation used in `RCTImageLoader` and `RCTImageUtils`.
Closes https://github.com/facebook/react-native/pull/7349

Differential Revision: D3252796

Pulled By: nicklockwood

fb-gh-sync-id: b9303a99333e4744dfe23045f4a2755307305772
fbshipit-source-id: b9303a99333e4744dfe23045f4a2755307305772
2016-05-03 08:53:34 -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
Hedger Wang 8ac03077c9 better way to manage pointerEvents for NavigationCard.
Reviewed By: fkgozali

Differential Revision: D3250602

fb-gh-sync-id: 6b20d283f8854d0e137800c37595fc014a78e338
fbshipit-source-id: 6b20d283f8854d0e137800c37595fc014a78e338
2016-05-02 19:17:24 -07:00
Jason Prado 79c5322233 Reverted commit D3205106
Summary:
THis addresses the issue as reported at
https://github.com/facebook/react-native/issues/6732

Use a higher order component `NavigationPointerEventsContainer` to manager the
prop `pointerEvents` for `NavigationCard`.

The idea is that the scene's content should not be interactive while the scene is
transitioning.

Reviewed By: ericvicenti

Differential Revision: D3205106

fb-gh-sync-id: db7172941155f34447495199d2c029f5c7e75f30
fbshipit-source-id: db7172941155f34447495199d2c029f5c7e75f30
2016-05-02 14:22:30 -07:00
Hedger Wang 5966ccbcad better way to manage pointerEvents for NavigationCard.
Summary:
THis addresses the issue as reported at
https://github.com/facebook/react-native/issues/6732

Use a higher order component `NavigationPointerEventsContainer` to manager the
prop `pointerEvents` for `NavigationCard`.

The idea is that the scene's content should not be interactive while the scene is
transitioning.

Reviewed By: ericvicenti

Differential Revision: D3205106

fb-gh-sync-id: c0fd22e8c8b83a5952351c5a3a302b2fca5ba5de
fbshipit-source-id: c0fd22e8c8b83a5952351c5a3a302b2fca5ba5de
2016-05-02 12:57:23 -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
Spencer Ahrens 2c3576a50a Refactor connection/list stuff
Reviewed By: devknoll

Differential Revision: D3233991

fb-gh-sync-id: bd10dd2856da6b8fb3bac7a8ec3a7e34eeb58f80
fbshipit-source-id: bd10dd2856da6b8fb3bac7a8ec3a7e34eeb58f80
2016-04-30 10:28:55 -07:00
Janic Duplessis 169cfb5a52 Remove the need for allowTopLevelThis in transform-es2015-modules-commonjs
Summary:
This make the transform behave closer to the standard for modules.

This removes the few places that a top level this was used to refer to the global space. It also clean up the usage of `GLOBAL` to use `global` instead as this is what is used everywhere else in the code base. We still define `GLOBAL` for compatibility with other modules.

**Test plan**
Clear the packager cache to make sure the transforms run again. (node ./local-cli/cli.js start --reset-cache).
Run the Movies example (UIExplorer is broken atm) and make sure there are no errors.
Closes https://github.com/facebook/react-native/pull/6255

Differential Revision: D3037227

Pulled By: mkonicek

fb-gh-sync-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
fbshipit-source-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
2016-04-29 16:15:34 -07:00
Sebastian Markbage 373537b281 Deprecate transformMatrix and decomposedMatrix
Summary:
transformMatrix only worked on iOS and there is an equivalent API that (mostly)
works cross platform.

decomposedMatrix could technically be passed on Android but it wasn't document and explicitly flagged as not working.

My goal is to deprecate both uses and then the only supported API is the `transform: [{ matrix: ... }]` form.

The only difference is that on Android the matrix gets decomposed.

Currently there is some special cased magic that renames transform -> transformMatrix or decomposedMatrix depending on platform.

https://github.com/facebook/react/blob/master/src/renderers/native/ReactNative/ReactNativeAttributePayload.js#L50

Therefore I'm adding an alias for both native platforms called just "transform".

Next I'll swap over the JS to always target the name "transform". The only difference is how the value is marshalled over the bridge in processTransform.

To do this, I have to clean up a few callers. Mostly that's just swapping to the new API.

For buildInterpolator this is a bit trickier but this fixes it for all our use cases (which is only the Navigator in AdsManager).

Reviewed By: vjeux

Differential Revision: D3239960

fb-gh-sync-id: 838edb6644c6cdd0716834f712042f226ff3136f
fbshipit-source-id: 838edb6644c6cdd0716834f712042f226ff3136f
2016-04-29 14:19:25 -07:00
Spencer Ahrens 6cae8b7c02 Optimize WindowedListView
Summary:
Reduce re-renders by only looking at `props.data` that we're actually going to render and tracking if `this._rowFrames`
is dirty.

Differential Revision: D3195163

fb-gh-sync-id: 1e17ab410a312a37d4a93b84ea51ca32c3ede839
fbshipit-source-id: 1e17ab410a312a37d4a93b84ea51ca32c3ede839
2016-04-29 10:15:29 -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
Charles Dick 24b2990467 Capture heap from the dev menu
Reviewed By: foghina

Differential Revision: D3229856

fb-gh-sync-id: c6321cfb309c93572a51bba625d63246a75f0254
fbshipit-source-id: c6321cfb309c93572a51bba625d63246a75f0254
2016-04-29 07:35:22 -07:00
alvaromb 84e696867b Added badge icon number and alert action
Summary:
Added support for setting an optional badge icon number and alert action when using local notifications.
Closes https://github.com/facebook/react-native/pull/2931

Differential Revision: D3212448

Pulled By: mkonicek

fb-gh-sync-id: 063efcdd259b2a43f39812f57a71e8489ab33653
fbshipit-source-id: 063efcdd259b2a43f39812f57a71e8489ab33653
2016-04-29 05:37:27 -07:00
Dave Miller 3a5457cd7c Add support for setChildren
Summary: This adds support for UIManager.setChildren on Android like D2757388 added for iOS.

Reviewed By: andreicoman11

Differential Revision: D3235369

fb-gh-sync-id: b538556ec4abdb606f9be26d1b74734046bca0cd
fbshipit-source-id: b538556ec4abdb606f9be26d1b74734046bca0cd
2016-04-29 04:03:24 -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
Jesse Sessler 2bb1c263db Modal Animation Types
Summary:
Currently the Modal component uses the slide up / down animation for presenting and hiding the Modal with no options. This PR gives users a choice to use a fade in / out animation or the current slide animation (slide is the default). Android and iOS.

![](http://g.recordit.co/nfJSg487Ox.gif)  ![](http://g.recordit.co/QHGDuUFbPy.gif)

I've updated the UIExplorer and documentation.

![image](https://cloud.githubusercontent.com/assets/4265163/14743130/0bd8282c-086e-11e6-93eb-3d344431337d.png)

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

Differential Revision: D3237809

Pulled By: javache

fb-gh-sync-id: 813e56ada8b19990dc5018527dc3a81b2c8b349a
fbshipit-source-id: 813e56ada8b19990dc5018527dc3a81b2c8b349a
2016-04-28 16:00:32 -07:00
Philipp von Weitershausen b5f14ea8f1 Make XMLHttpRequest and XMLHttpRequest.upload proper EventTargets
Summary:
So far, XHR only supports a few `onfoo` event handlers, not the entier `EventTarget` interface (`addEventListener`, `removeEventListener`). It also doesn't support the `upload` object on Android -- for no good reason. Even if we don't send any events there yet, there's no reason we have to break consuming code that wants to register an event handler there. This PR rectifies all that.

Fortunately, adding proper `EventTarget` support is very easy thanks to `event-target-shim`. We already use it in our WebSocket implementation. It transparently handles the `addEventListener('foo', ...)` as well as `onfoo` APIs, so when you dispatch an event on the event target, the right handlers will be invoked. The event object is wrapped so that `event.target` is set properly. Basically, it's a super easy way to make us conform to the spec.

Also added a bit of polish here and there, using ES2015 class property goodness to consolidate a lot of Flow property definitions with the corresponding property initializers.

**T
Closes https://github.com/facebook/react-native/pull/7017

Reviewed By: fkgozali

Differential Revision: D3202021

Pulled By: martinbigio

fb-gh-sync-id: 2b007682074356c75c774fab337672918b6c4355
fbshipit-source-id: 2b007682074356c75c774fab337672918b6c4355
2016-04-28 15:59:26 -07:00
David Aurelio e6bafca39e Improve constant inlining, add `process.platform`
Reviewed By: bestander

Differential Revision: D3235716

fb-gh-sync-id: f9019ec0042827e409fa84ba74f4c426ccad1519
fbshipit-source-id: f9019ec0042827e409fa84ba74f4c426ccad1519
2016-04-28 11:23:21 -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
Pieter De Baets b2c8281316 Remove ImmediateImplementation, always use globals
Summary: We always define these globals in InitializeJavaScriptAppEngine, so the fallback mechanism here is never required as far as I can tell.

Reviewed By: davidaurelio

Differential Revision: D3235061

fb-gh-sync-id: 92007f87c84073e32bfa946df8ee81083f6842ec
fbshipit-source-id: 92007f87c84073e32bfa946df8ee81083f6842ec
2016-04-28 07:06:20 -07:00
Christoph Pojer d363b1f2e2 Update Jest APIs on fbsource
Reviewed By: javache

Differential Revision: D3229435

fb-gh-sync-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
fbshipit-source-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
2016-04-27 19:16:32 -07:00
Howard Yeh 192ab663b7 Fix 302 ImageLoader caching problem on iOS
Summary:
+ Fixes https://github.com/facebook/react-native/issues/5616
+ Bug RNPlay Demo: https://rnplay.org/apps/Eg2goQ

Test demo loads a Tumblr avatar image using a URL that 301 to a CDN. Try to edit and save the file to trigger image reloads.

The 302 image request succeeds the first time:

<img width="318" alt="screen shot 2016-04-27 at 9 37 03 am" src="https://cloud.githubusercontent.com/assets/50120/14860038/b2c04e8a-0c5b-11e6-9edf-78309048368b.png">

But it fails for subsequent loads. You should see:

<img width="307" alt="screen shot 2016-04-27 at 9 37 22 am" src="https://cloud.githubusercontent.com/assets/50120/14860048/b756e170-0c5b-11e6-9031-8f3cca8f2994.png">

+ The first image is a 302, only succeeds to load the first time.
+ The second image in the column adds a nonce as request parameter to render caching ineffective (but still a 302), and the problem doesn't occur.
+ The last image is the canonical url location (200).

Although NSURLSession hand
Closes https://github.com/facebook/react-native/pull/7262

Differential Revision: D3231702

Pulled By: javache

fb-gh-sync-id: 364fcf9819188c63310768411d49e6431b2a01d3
fbshipit-source-id: 364fcf9819188c63310768411d49e6431b2a01d3
2016-04-27 14:40:30 -07:00
Philipp von Weitershausen 8891f22f88 Fix WebSocket compatibility with event-target-shim ^1.0.5
Summary:
event-target-shim versions before 1.1.0 do not support taking an array for `EventTarget`. react-native requires `^1.0.5`, so this fixes compatibility with those earlier versions.

**Test Plan:** ran WebSocket UIExplorer example with earlier version of event-target-shim.
Closes https://github.com/facebook/react-native/pull/7261

Differential Revision: D3230881

Pulled By: martinbigio

fb-gh-sync-id: 6a22d58841a4b401a200fece64d13a70043fb09a
fbshipit-source-id: 6a22d58841a4b401a200fece64d13a70043fb09a
2016-04-27 12:26:23 -07:00
Alexander Blom 9a3a082225 Make polyfills and globals lazy
Summary:
This avoids requiring things that may never be used at all by the application such as WebSocket or Geolocation. It also stops us from asking for native modules
before we actually start the application enabling us to potentially be more lazy in the future.

Reviewed By: davidaurelio

Differential Revision: D3212802

fb-gh-sync-id: 70cf0d1a85f39fedc47758e5eb5df789a511bc9b
fbshipit-source-id: 70cf0d1a85f39fedc47758e5eb5df789a511bc9b
2016-04-27 09:57:20 -07:00
Andy Street 50d8d46733 Add ability to expose sync hooks from Java to JS
Summary:
This only works for the new cxx bridge (hopefully open sourcing soon!).

This diff allows Java native modules to expose synchronous hooks to JS via the ReactSyncHook annotation. The methods will appear in JS on the native module object (e.g. you would do `require('UIManager').mySyncHook('foo');`) which allows us to enforce that required native modules are installed at build time. In order to support remote debugging, both the args and return type must be JSON serializable (so that we can go back across to the device to resolve synchronous hooks).

Follow ups will be integration tests, adding support for return types besides void, and adding support for remote debugging.

Reviewed By: mhorowitz

Differential Revision: D3218794

fb-gh-sync-id: 7e3366a8254276f5a55eb806287419287ca9182b
fbshipit-source-id: 7e3366a8254276f5a55eb806287419287ca9182b
2016-04-27 07:51:28 -07:00
Spencer Ahrens b5d9bf0fb2 merge InteractionManager stuff back into PanResponder
Reviewed By: bestander

Differential Revision: D3224519

fb-gh-sync-id: d041214b68fedfdd6b01aa2b710b02381c29dcfa
fbshipit-source-id: d041214b68fedfdd6b01aa2b710b02381c29dcfa
2016-04-26 13:19:22 -07:00
Steven Luscher dad39eb502 Move `Number` polyfills into the `/polyfills/` directory
Reviewed By: vjeux

Differential Revision: D3223317

fb-gh-sync-id: a49a14f217b27d6542b65c4780c557e73da2443f
fbshipit-source-id: a49a14f217b27d6542b65c4780c557e73da2443f
2016-04-26 11:24:42 -07:00
Konstantin Raev 2eef115161 Revert "Add subviewStyle prop to NavigationHeader"
Summary:
This reverts commit 1dc82a9e5f.

Breaks OSS tests
Closes https://github.com/facebook/react-native/pull/7232

Differential Revision: D3223972

Pulled By: bestander

fb-gh-sync-id: fea7ec4a1c13d328a7bbda9fcd3f201a7007081e
fbshipit-source-id: fea7ec4a1c13d328a7bbda9fcd3f201a7007081e
2016-04-26 06:10:24 -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
Spencer Ahrens 667d278119 Only grab InteractionManager handle in PanResponder, not all touches
Summary:
Previously, `InteractionManager` was baked in at the lowest level to all touches via `ResponderEventPlugin`,
which meant that any time a finger was touching the screen, `InteractionManager` would be locked. This included while
doing 100% native scrolls, and thus would block progress from Relay, Incremental, or anything else scheduling events
through `InteractionManager`.

This diff switches to only bake it into `PanResponder` (and it remains hooked into `Animated` as before) which are the
main two cases where we need 60fps JS execution and want to queue up slower tasks.

This is done with a reusable higher-order-responder `InteractionManager.createResponderClass`.

Depends on FYI https://github.com/facebook/react/pull/6587, https://github.com/facebook/react/pull/6584

Reviewed By: sebmarkbage

Differential Revision: D3210951

fb-gh-sync-id: 682d21ac5cff704673b63d5942a903a3d8912835
fbshipit-source-id: 682d21ac5cff704673b63d5942a903a3d8912835
2016-04-26 00:23:30 -07:00
Sebastian Markbage 8e43b24a36 Update React to alpha.3
Summary:
Sync new React fixes.

Includes...

https://github.com/facebook/react/pull/6584
https://github.com/facebook/react/pull/6587
https://github.com/facebook/react/pull/6588
https://github.com/facebook/react/pull/6590

Since this require PanResponder to be restored I also included D3210771 here.

Reviewed By: spicyj

Differential Revision: D3221285

fb-gh-sync-id: cbb6b1dd0fd0443d246957ceb94b6a424c09c24e
fbshipit-source-id: cbb6b1dd0fd0443d246957ceb94b6a424c09c24e
2016-04-25 20:38:26 -07:00
Mike Grabowski edf8888fb9 Platform.select method
Summary:
Kudos to frantic for this amazing idea! Works really well (yet so simple!)

Basically we had a discussion with vjeux and frantic and others in the PR #7033 how to handle platform-specific stylesheets in a similar to F8 app way.

There were quite a few nice ideas there, however that one seems to be the smallest yet the most powerful.

Basically there's a `Platform.select` method that given an object, will select a `obj[Platform.OS]` value.

It works with styles:
`Platform.select({ ios: {}, android: {} })`

with messages:
`<Text>{Platform.select({ ios: 'Check the App Store', android: 'Check Google Play' })}</Text>`

and also works well with components (similar to Wallmart idea of <PlatformSwitch />) - relevant example included in diff.
Closes https://github.com/facebook/react-native/pull/7220

Differential Revision: D3221709

Pulled By: vjeux

fb-gh-sync-id: 0a50071f2dcf2273198bc6e2c36e19bca97d7be9
fbshipit-source-id: 0a50071f2dcf2273198bc6e2c36e19bca97d7be9
2016-04-25 16:32:20 -07:00
Hedger Wang 24f44558f6 Fix initial scenes rendering for NavigationPagerStyleInterpolator
Summary:
The initial layout used to render scenes does not contain the actual
width and height measured and causes the issue as described at
https://github.com/ericvicenti/navigation-rfc/issues/61

The fix is to update the layout and re-render scenes once layout
is modified. Also scenes renderer should also consider the case that
when the layout is not measured yet.

Reviewed By: ericvicenti

Differential Revision: D3203245

fb-gh-sync-id: 4de89b9b43bc993d7c970c831458bd31c094073e
fbshipit-source-id: 4de89b9b43bc993d7c970c831458bd31c094073e
2016-04-25 15:37:38 -07:00
Scott Foggo 50d6de9448 Check if either array is null before diffing
Reviewed By: sebmarkbage

Differential Revision: D3219392

fb-gh-sync-id: fd6ef2e2c2d7b661a06c857b25b007701340e20a
fbshipit-source-id: fd6ef2e2c2d7b661a06c857b25b007701340e20a
2016-04-25 13:28:31 -07:00
Christian Meunier 1dc82a9e5f Add subviewStyle prop to NavigationHeader
Summary:
Implements: #7204

Pinging ericvicenti for review.
Closes https://github.com/facebook/react-native/pull/7214

Differential Revision: D3219306

Pulled By: ericvicenti

fb-gh-sync-id: becd1dada2557b7fb2c345bac2098094fa6d2144
fbshipit-source-id: becd1dada2557b7fb2c345bac2098094fa6d2144
2016-04-25 10:12:25 -07:00
Nick Lockwood 37f4ec6e16 Removed placeholder image logic
Summary: To prevent layout popping, when inserting images inside text we would render a blank placeholder image while the real image was loading. It turns out that this isn't necessary, as we can just specify the size of the image without having an actual image to display.

Reviewed By: javache

Differential Revision: D3212766

fb-gh-sync-id: e98851b32a2d0ae809fc0a4be47e6b77f3b17996
fbshipit-source-id: e98851b32a2d0ae809fc0a4be47e6b77f3b17996
2016-04-25 03:31:19 -07:00
Christoph Pojer 0bf737ff0a Update to 11.0.1
Reviewed By: kassens

Differential Revision: D3183738

fb-gh-sync-id: 07be9e1d60413a6d929b15cd72eeba416a6bfc6d
fbshipit-source-id: 07be9e1d60413a6d929b15cd72eeba416a6bfc6d
2016-04-25 01:16:23 -07:00
Janic Duplessis baa3668160 Add support for delete animation in LayoutAnimation on iOS
Summary:This adds support for delete view animations in LayoutAnimation for iOS. It supports the same properties as the create animation (alpha, scale).

This allows making simple animations when removing a view which is normally hard to do in React since we need to not remove the view node immediately.

**Test plan**
Tested add/removing views in the UIExample explorer with and without setting a LayoutAnimation. Also tested that the completion callback still works properly. Tested that user interation during the animation is properly disabled.

![layout-anim2](https://cloud.githubusercontent.com/assets/2677334/14595471/86fb1654-050d-11e6-8b38-fe45cc2dcd71.gif)

I also plan to work on improving the doc for LayoutAnimation as well as making this PR for android too.
Closes https://github.com/facebook/react-native/pull/6779

Differential Revision: D3215525

Pulled By: sahrens

fb-gh-sync-id: 526120acd371c8d1af433e8f199cfed336183775
fbshipit-source-id: 526120acd371c8d1af433e8f199cfed336183775
2016-04-25 00:19:25 -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
Mike Grabowski 02578df4f7 Fallback for textAlign: justify
Summary:Fixes #5408 as per ide and vjeux suggestions here https://github.com/facebook/react-native/issues/529#issuecomment-107328799

Could've been probably done in a single `if` clause, but this is more explicit and leaves potential place for future implementation (if we ever decide to do so)
Closes https://github.com/facebook/react-native/pull/7197

Differential Revision: D3217740

Pulled By: vjeux

fb-gh-sync-id: aa08a5c42e43c1abe17b72a424ee96146f2667f6
fbshipit-source-id: aa08a5c42e43c1abe17b72a424ee96146f2667f6
2016-04-24 11:29:23 -07:00
Mike Grabowski 7102fd079a Document ListView.DataSource #410
Summary:Fixes #410
Closes https://github.com/facebook/react-native/pull/7193

Differential Revision: D3217718

fb-gh-sync-id: c05c9e3d67863c064f8e1102090614c6ba7e3127
fbshipit-source-id: c05c9e3d67863c064f8e1102090614c6ba7e3127
2016-04-24 08:13:21 -07:00
Ian MacLeod 7721a24f38 Expose NavigationPropTypes via NavigationExperimental.PropTypes
Summary:Useful for building components that compose navigation components
Closes https://github.com/facebook/react-native/pull/6644

Differential Revision: D3217681

fb-gh-sync-id: 94907fed1692f2dc6603a5fbdf3a032906e3f74d
fbshipit-source-id: 94907fed1692f2dc6603a5fbdf3a032906e3f74d
2016-04-24 04:46:26 -07:00
Mike Grabowski f022681a1e Implement Text onLongPress
Summary:Fixes #5855

Tested with `UIExplorer`, first <Text> is the `onPress`, second is the `onLongPress`.
Closes https://github.com/facebook/react-native/pull/7099

Differential Revision: D3212436

Pulled By: mkonicek

fb-gh-sync-id: 0a1cbcd4eaf39ad4fe67d861c3be2e042e1acb27
fbshipit-source-id: 0a1cbcd4eaf39ad4fe67d861c3be2e042e1acb27
2016-04-23 18:14:20 -07:00
Krzysztof Magiera dd244f5530 Support for Animated.interpolate
Summary:This change adds native animated support for Animated.interpolate

Animated.interpolate allows for defining nodes that outputs an interpolated value of their input node based on the interpolation node configuration. For now native animated implementation only supports a linear interpolation for a given input and output ranges (ranges can consists of multiple segments). Native interpolation node is compatible with the JS implementation with the exception that not all attributes that can be used in JS are supported. Before we migrate interpolation node from JS->native we verify that only supported props are used.

**Test Plan**
Run JS tests: `npm test Libraries/Animated/src/__tests__/AnimatedNative-test.js`
Run java tests: `buck test ReactAndroid/src/test/java/com/facebook/react/animated`
Closes https://github.com/facebook/react-native/pull/7141

Differential Revision: D3216546

fb-gh-sync-id: 29876e33956615c6370ca4d332abe048f8dba5b8
fbshipit-source-id: 29876e33956615c6370ca4d332abe048f8dba5b8
2016-04-23 02:37:28 -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
Sebastian Markbage 248879f5a3 Fix react-native.js.flow
Summary:We no longer forward React onto this object. We only forward the ReactNative
module onto it.

We also deprecated the addons so they'll all warn. We'll remove it
completely soon.
Closes https://github.com/facebook/react-native/pull/7136

Reviewed By: gabelevi

Differential Revision: D3211809

Pulled By: sebmarkbage

fb-gh-sync-id: 77aaa909dca5e2522cfaa7b4ca361fabc614be58
fbshipit-source-id: 77aaa909dca5e2522cfaa7b4ca361fabc614be58
2016-04-22 18:02:28 -07:00
Felix Oghina 7946160733 refactor BugReporting to use RCTDeviceEventEmitter
Reviewed By: sahrens

Differential Revision: D3212300

fb-gh-sync-id: 3a61d620320dd1c0254bf3b836601d5bbfbc4c0d
fbshipit-source-id: 3a61d620320dd1c0254bf3b836601d5bbfbc4c0d
2016-04-22 11:24:40 -07:00
Pieter De Baets 09f1e8293a Prevent measuring text in RCTShadowText child nodes
Summary: We only measure text at the root node, we shouldn't be trying to build a text storage later on for tree lower in the shadow node tree.

Reviewed By: nicklockwood

Differential Revision: D3212614

fb-gh-sync-id: 574fa7f2c029ca9ad2d5fabe7bbb148157f85ca7
fbshipit-source-id: 574fa7f2c029ca9ad2d5fabe7bbb148157f85ca7
2016-04-22 10:14:29 -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
Krzysztof Magiera cd11738819 Support for stopping animations that run on UI thread.
Summary:This change extends animated native module API with `stopAnimation` method that is responsible for interrupting actively running animation as a reslut of a JS call. In order for the `stopAnimation` to understand `animationId` argument I also had to add `animationId` to `startAnimation` method. As JS thread runs in parallel to the thread which executes the animation there is a chance that JS may call `stopAnimation` after the animation has finished. Because of that we are not doing any checks on the `animationId` parameter passed to `stopAnimation` in native and if the animation does not exists in the registry we ignore that call.

**Test Plan**
Run JS tests: `npm test Libraries/Animated/src/__tests__/AnimatedNative-test.js`
Run java tests: `buck test ReactAndroid/src/test/java/com/facebook/react/animated`
Closes https://github.com/facebook/react-native/pull/7058

Differential Revision: D3211906

fb-gh-sync-id: 3761509651de36a550b00d33e2a631c379d3900f
fbshipit-source-id: 3761509651de36a550b00d33e2a631c379d3900f
2016-04-22 00:02: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
Pieter De Baets 2b69ec2589 Provide initial size to Modal
Reviewed By: majak

Differential Revision: D3202211

fb-gh-sync-id: 83a1d3d52df0dc68483639393ab64fd6f1281cb3
fbshipit-source-id: 83a1d3d52df0dc68483639393ab64fd6f1281cb3
2016-04-21 08:57:19 -07:00
Nick Lockwood 362738a776 Fixed some issues with zero fontSizeMultiplier causing RCTSHadowText measure function to return an infinite height
Summary:The default value for fontSizeMultiplier was zero. Although this was usually overriden with the correct value (typically 1.0), it sometimes wasn't resulting in a divide-by-zero in the text height calculation.

This diff corrects that bug by setting 1.0 as the default, and guarding against zero values being set.

I also fixed some suspicious logic that seemed to assume the result of BOOL && CGFloat would be 0 or the CGFloat value, which is true in JS but not in C (it would always be 0 or 1).

Reviewed By: javache

Differential Revision: D3179196

fb-gh-sync-id: cc09b104c9087fc1a2f45d8d3f70af221c2ad823
fbshipit-source-id: cc09b104c9087fc1a2f45d8d3f70af221c2ad823
2016-04-21 03:57:18 -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
Mike Grabowski 9d7b537dd4 Mention native code in `Linking` docs
Summary:Fixes #5925
Closes https://github.com/facebook/react-native/pull/7101

Differential Revision: D3206134

fb-gh-sync-id: e65ae97c32685d6acc08be2019dd2da902e01bc9
fbshipit-source-id: e65ae97c32685d6acc08be2019dd2da902e01bc9
2016-04-20 19:23:19 -07:00
Philipp von Weitershausen ed930b4710 Add support for sending binary data in websockets
Summary:This is a reprise of #6327, but with iOS 7.0 compatibility and less `package.json` changes.

**Test Plan:** Load WebSocketExample in UIExplorer app and start websocket test server script (both provided in #6889) and test sending binary data on both iOS and Android
Closes https://github.com/facebook/react-native/pull/6961

Differential Revision: D3202022

Pulled By: mkonicek

fb-gh-sync-id: 38843d0a9c0172971c5c70a5139ded04042b280a
fbshipit-source-id: 38843d0a9c0172971c5c70a5139ded04042b280a
2016-04-20 08:53:25 -07:00
Spencer Ahrens ad15b74aae cleanup and open source JS BugReporting module
Summary:This is just the JS part of a bug reporting module that can be used with a pure JS flow or a native reporting
flow. It's handy for grabbing data from a bunch of random components, like the ids of the rows that are visible in a
list view at the time the bug is reported, or a description of the current navigation stack.

It's initialized in `AppRegistry` so it's always ready to go and bug reports will always include the universal
`runApplication` info, but won't actually do anything by default unless `collectExtraData` is called.

Note: some apps may call `runApplication` multiple times if they have multiple react native root views. This will just
overwrite the source so it will just report the most recently mounted one.

Reviewed By: foghina

Differential Revision: D3200203

fb-gh-sync-id: 8ed45fc9b289e8d9c50d3c85926213bd245d3ecc
fbshipit-source-id: 8ed45fc9b289e8d9c50d3c85926213bd245d3ecc
2016-04-20 08:09:07 -07:00
Dave Miller eb21b25e2d Fix Popover.android to bubble events correctly
Reviewed By: andreicoman11, fkgozali

Differential Revision: D3197104

fb-gh-sync-id: 882f85175f87200b7aef1ca4204d6dfb6c4c4c69
fbshipit-source-id: 882f85175f87200b7aef1ca4204d6dfb6c4c4c69
2016-04-20 00:59:27 -07:00
Hedger Wang 6731de7b45 Fix NavigationView.
Reviewed By: ericvicenti

Differential Revision: D3200293

fb-gh-sync-id: 3ffc7053b11f926461c45e19651d07295ca3ae72
fbshipit-source-id: 3ffc7053b11f926461c45e19651d07295ca3ae72
2016-04-19 19:56:21 -07:00
Elliot Lynde 7e515f8d4a Wait longer for debugger proxy
Reviewed By: yuzhi

Differential Revision: D3198412

fb-gh-sync-id: fe11f74b2a019accc24b08162746ce4793a49b90
fbshipit-source-id: fe11f74b2a019accc24b08162746ce4793a49b90
2016-04-19 17:13:25 -07:00
Hedger Wang 81c62c5f41 Fix initial scenes rendering.
Summary:The initial layout used to render scenes does not contain the actual
width and height measured and causes the issue as described at
https://github.com/ericvicenti/navigation-rfc/issues/61

The fix is to update the layout and re-render scenes once layout
is modified. Also scenes renderer should also consider the case that
when the layout is not measured yet.

Reviewed By: ericvicenti

Differential Revision: D3162143

fb-gh-sync-id: 197574329d3849cad2a21e07e1bd5e800f74c3ea
fbshipit-source-id: 197574329d3849cad2a21e07e1bd5e800f74c3ea
2016-04-19 15:57:20 -07:00
Spencer Ahrens ecae44aaae Fix potential "Should never unset includeInLayout" invariant
Reviewed By: devknoll

Differential Revision: D3194174

fb-gh-sync-id: 67d065ea90f8416a5fc7e3651c68350f895f9639
fbshipit-source-id: 67d065ea90f8416a5fc7e3651c68350f895f9639
2016-04-19 13:55:26 -07:00
Krzysztof Magiera ec5dfbf8c7 Support for Animated.multiply node
Summary:This change adds native animated support for Animated.multiply nodes.

Animated.multiply allows for defining nodes that would output a product of values of the input nodes.

**Test Plan**
Run JS tests: `npm test Libraries/Animated/src/__tests__/AnimatedNative-test.js`
Run java tests: `buck test ReactAndroid/src/test/java/com/facebook/react/animated`
Closes https://github.com/facebook/react-native/pull/7071

Differential Revision: D3197663

fb-gh-sync-id: 35f64244a2482c487a81e5e7cd08f3c0e56d9b78
fbshipit-source-id: 35f64244a2482c487a81e5e7cd08f3c0e56d9b78
2016-04-19 13:20:20 -07:00
Dave Miller 551c154261 Remove RKModal and Portal
Reviewed By: andreicoman11

Differential Revision: D3192529

fb-gh-sync-id: 4ea5d9d3e3b4f435e86a5dba4ddb7812f8d00fbc
fbshipit-source-id: 4ea5d9d3e3b4f435e86a5dba4ddb7812f8d00fbc
2016-04-19 07:42:29 -07:00
Thom Dixon d586daad51 Fix red screen due to ref being undefined in PullRefreshViewAndroid
Summary:This fixes the error
`undefined is not an object (evaluating 'this.refs[NATIVE_REF].setNativeProps')`, which seems to occur when the refresh fails (in our case due to CORS).

![screen shot 2016-03-16 at 12 23 52](https://cloud.githubusercontent.com/assets/461514/13826121/1f8b0aaa-eb73-11e5-81e3-b2c60e536bf0.png)
Closes https://github.com/facebook/react-native/pull/6489

Differential Revision: D3172217

fb-gh-sync-id: 5ba3b2653685888f5358ef32b01b441757eff7c8
fbshipit-source-id: 5ba3b2653685888f5358ef32b01b441757eff7c8
2016-04-19 06:58:22 -07:00
Krzysztof Magiera b5375bdc09 Support for Animated.add
Summary:This change adds suport native animated support for Animated.add.

Animated.add lets you declare node that outputs a sum of it input nodes.

**Test Plan**
Play with the following playground app: https://gist.github.com/39de37faf07480fcd7d1
Run JS tests: `npm test Libraries/Animated/src/__tests__/AnimatedNative-test.js`
Run java tests: `buck test ReactAndroid/src/test/java/com/facebook/react/animated`
Closes https://github.com/facebook/react-native/pull/6641

Differential Revision: D3195963

fb-gh-sync-id: bb1e1a36821a0e071ad0e7d0fa99ce0d6b088b0a
fbshipit-source-id: bb1e1a36821a0e071ad0e7d0fa99ce0d6b088b0a
2016-04-19 02:58:21 -07:00
Angela Hess 64d5da7754 Replace opacity console error with warning
Summary: This error message is remarkably aggressive relative to the severity of the issue, particularly since the pattern in question is used / necessary throughout the codebase. Animated ReactART components with set opacities trigger this error, and opacity coming from the style prop is not respected.

Reviewed By: sahrens

Differential Revision: D3177554

fb-gh-sync-id: 96061d5ff526177814996b28e4394e6649839582
fbshipit-source-id: 96061d5ff526177814996b28e4394e6649839582
2016-04-18 18:53:20 -07:00
Philipp von Weitershausen ebb44d202b Clean up and simplify WebSocket implementation on the JS side
Summary:- Get rid of no longer necessary WebSocket.js v WebSocketBase.js split
- Use `EventTarget(list, of, events)` as base class to auto-generate `oneventname` getters/setters that get invoked along with other event handlers
- Type annotation `any` considered harmful, especially when we can easily spell out the actual type
- Throw in some `const` goodness for free

**Test Plan:** Launch UIExplorer example app, supplied `websocket_test_server` script, and try different combinations of sending and receiving text and binary data on both iOS and Android.
Closes https://github.com/facebook/react-native/pull/6889

Differential Revision: D3184835

Pulled By: mkonicek

fb-gh-sync-id: f21707f4e97aa5a79847f5157e0a9f132a1a01cd
fbshipit-source-id: f21707f4e97aa5a79847f5157e0a9f132a1a01cd
2016-04-18 15:43:25 -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
Tomasz Netczuk 9a82c03e1f Navigator.SceneConfigs.PushFromRight similar to native iOS animation.
Summary:The animation looks ok now.

However, the original iOS navigator adds transparent overlay and shadow. Any idea how to implement it? I'd like to add it.
Closes https://github.com/facebook/react-native/pull/5061

Differential Revision: D3129246

Pulled By: ericvicenti

fb-gh-sync-id: ee86261a49ea4b8f6854abf69bef3ebfd6878852
fbshipit-source-id: ee86261a49ea4b8f6854abf69bef3ebfd6878852
2016-04-15 18:23:29 -07:00
Leland Richardson 4ee0f7b218 Round interpolation for RGB components
Summary:The CSS spec doesn't allow for decimal values inside of rgb colors, however the RN implementation does, so there was a disconnect here.

This tests to see if the output range is an rgb color, and if so, rounds the first 3 interpolated components (but not the 4th, since that would be opacity and allows for a decimal).

cc vjeux
Closes https://github.com/facebook/react-native/pull/6984

Differential Revision: D3186473

fb-gh-sync-id: a320bf2311764e084386700bf8c8a42ab2a347eb
fbshipit-source-id: a320bf2311764e084386700bf8c8a42ab2a347eb
2016-04-15 14:51:27 -07:00
grgmo d09cd62011 Add support for ontimeout and onerror handler when using XMLHttpRequest for Android and iOS
Summary:Currently React-Native does not have `ontimeout` and `onerror` handlers for [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest). This is an extension to [No timeout on XMLHttpRequest](https://github.com/facebook/react-native/issues/4648).

With addition to two handlers, both Android and iOS can now handle `ontimeout` if request times out and `onerror` when there is general network error.

**Test plan**

Code has been tested on both Android and iOS with [Charles](https://www.charlesproxy.com/) by setting a breakpoint on the request which fires `ontimeout` when the request waits beyond `timeout` time and `onerror` when there is network error.

**Usage**

JavaScript -

```
var request = new XMLHttpRequest();

function onLoad() {
    console.log(request.status);
};

function onTimeout() {
    console.log('Timeout');
};

function onError() {
    console.log('General network error');
};

request.onload = onLoad;
request.ontimeout = onTimeout;
request.onerr
Closes https://github.com/facebook/react-native/pull/6841

Differential Revision: D3178859

Pulled By: lexs

fb-gh-sync-id: 30674570653e92ab5f7e74bd925dd5640fc862b6
fbshipit-source-id: 30674570653e92ab5f7e74bd925dd5640fc862b6
2016-04-15 05:17:21 -07:00
Hedger Wang 7354ff33b2 Fix Portal
Summary:Portal keeps its opened modals as a state member. so if multiple consecutive `_showModal`
or `_closeModal` are called, it will only read the initial state and merge the end result,
which causes some close or open calls to be overwritten due to race condition.

This diff fixes such issue.

Reviewed By: dmmiller

Differential Revision: D3160561

fb-gh-sync-id: 6d936c795660b119e2d3fe8b3ab807307eca92c5
fbshipit-source-id: 6d936c795660b119e2d3fe8b3ab807307eca92c5
2016-04-15 02:18:21 -07:00
Matthew Arbesfeld ef8e688b20 Let inner nested stack reducers handle back actions first
Summary:Fix for #6963
Closes https://github.com/facebook/react-native/pull/6982

Differential Revision: D3180164

Pulled By: ericvicenti

fb-gh-sync-id: 234d3027097ae032ba0e24470adb3a5ebf07e351
fbshipit-source-id: 234d3027097ae032ba0e24470adb3a5ebf07e351
2016-04-14 18:24:25 -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
James Ide eaba2abc0b Use function refs and support composed refs
Summary:Fixes an issue where if you implement `renderScrollComponent` and have a `ref` callback on the returned element, the ref used to be clobbered by the ref that ListView adds to the element.

This is accomplished by converting the ref from a legacy string-based ref to a callback-based ref, and then using `cloneReferencedElement`, which is a simple utility to compose callback refs.
Closes https://github.com/facebook/react-native/pull/6441

Differential Revision: D3064250

Pulled By: mkonicek

fb-gh-sync-id: 2d55d04e2144a1cc08900a57a1fc0dab07c87eea
fbshipit-source-id: 2d55d04e2144a1cc08900a57a1fc0dab07c87eea
2016-04-14 06:41:22 -07:00
Sebastian Markbage 0db5439892 Update the Spectrum downstream and add the new cloneWithProps dependency
Reviewed By: aglemann

Differential Revision: D3167482

fb-gh-sync-id: b8c9933e629b049b15f9ebaf885817086866893b
fbshipit-source-id: b8c9933e629b049b15f9ebaf885817086866893b
2016-04-13 17:11:38 -07:00
Yao Bin Then 7e2026a268 Copy comment from LocationModule.java to Geolocation.js
Summary:This is to give a hint to developers when getCurrentPosition not returning anything on Android
Closes https://github.com/facebook/react-native/pull/6770

Differential Revision: D3131152

Pulled By: mkonicek

fb-gh-sync-id: 6726ed0f232c3b2f460d025fe9567e0d0783a707
fbshipit-source-id: 6726ed0f232c3b2f460d025fe9567e0d0783a707
2016-04-13 07:53:23 -07:00
mattds 69534a3373 Added support for Image corner radii in Android
Summary:Split out from PR #4252 - kmagiera I've made the changes to how the radii arrays are allocated, is the approach I've taken correct? also it looks like ImageStylePropTypes are needed so I left them in for the moment. I suppose this pull request will only be valid if iOS supports image corner radii, but at least it's here if/when needed. Attached an image of how it handles the existing case:
![screen shot 2016-01-08 at 4 21 25 pm](https://cloud.githubusercontent.com/assets/1407729/12200126/d3caceac-b625-11e5-8281-06274732a281.png)
Closes https://github.com/facebook/react-native/pull/5197

Differential Revision: D3138725

Pulled By: mkonicek

fb-gh-sync-id: df772fd07fe85386ae4c681f9e79a19d2316d38b
fbshipit-source-id: df772fd07fe85386ae4c681f9e79a19d2316d38b
2016-04-13 07:42:20 -07:00
James Ide f7bcb3e98d Add a way to prefetch remote images to cache with Image.prefetch
Summary:Adds `Image.prefetch` to prefetch remote images before they are used in an actual `Image` component. This is based off of #4420 by sospartan and skevy's work.
Closes https://github.com/facebook/react-native/pull/6774

Differential Revision: D3153729

Pulled By: bestander

fb-gh-sync-id: ef61412e051a49b42ae885edce7905a8ca0da23f
fbshipit-source-id: ef61412e051a49b42ae885edce7905a8ca0da23f
2016-04-13 07:30:28 -07:00
Dave Sibiski 4450d789e0 Uppercases the `method` variable to sanitize the string
Summary:This prevents possible developer errors when using 'post' or 'put' instead of 'POST' and 'PUT'.

Fixes: https://github.com/facebook/react-native/issues/6855

**Test plan:**

Previously, a `method put must not have a request body` error would be thrown when the method was in lowercase and a request body was indeed included.

With this fix and the following code (note the method name in all lowercase), the request is properly completed.

```javascript
const url = 'http://myurl.com';
const request = new XMLHttpRequest();

request.open('put', url);
request.setRequestHeader("Content-type","application/json");

request.onload = function() {
    console.log('onload');
};

request.onerror = function() {
    console.log('error');
};

request.send(JSON.stringify({ something: 'here' }));
```
Closes https://github.com/facebook/react-native/pull/6956

Differential Revision: D3173467

Pulled By: davidaurelio

fb-gh-sync-id: add90e9f31cd4f548547a3f85267a782ae74a89c
fbshipit-source-id: add90e9f31cd4f548547a3f85267a782ae74a89c
2016-04-13 06:48:19 -07:00
Luke Dubert ca2fb70fa9 Fix: swiping in navigator too quickly causes the gesture to be lost
Summary:**Issue:**

In the Navigator if a user attempts to navigate backwards (or forwards) through the route stack by swiping and they perform the gesture too quickly, the gesture is lost and nothing happens.

**Cause:**

In the `_matchGestureAction` function, the variable `moveStartedInRegion` is created and evaluates the gesture to determine if it was initiated in a valid region, (a.k.a. within the `edgeHitWidth`). The issue arises because `moveStartedInRegion` uses `currentLoc` (which is created from `gestureState.moveX`/`Y`) and when the gesture is performed using a flick of the finger, the first value of the `currentLoc` is outside of the `edgeHitWidth`.

**Solution:**

The solution is to track the coordinates of the initial grant (`gestureState.x0`/`y0`), and use that value instead of the `currentLoc` when evaluating `moveStartedInRegion`. The `currentLoc` is still needed however, for when the gestureState does not have a an initial x and y value, because the pan responder has not been granted.
Closes https://github.com/facebook/react-native/pull/6249

Differential Revision: D3168726

Pulled By: ericvicenti

fb-gh-sync-id: f2ac462e59bdc38536b99cac6a4877c99fa4e869
fbshipit-source-id: f2ac462e59bdc38536b99cac6a4877c99fa4e869
2016-04-12 11:08:23 -07:00
Martin Rädlinger 8a7eceeb4f make NavigationHeader and NavigationHeaderTitle pointerEvents configurable
Summary:I basically want to build a transparent NavigationHeader, so I need to be able to set the pointerEvents of the NavigationHeader.
Closes https://github.com/facebook/react-native/pull/6881

Differential Revision: D3168620

Pulled By: ericvicenti

fb-gh-sync-id: 679f3f5858142f468be329771ea281c31e1f0d40
fbshipit-source-id: 679f3f5858142f468be329771ea281c31e1f0d40
2016-04-12 10:55:30 -07:00
Emil Sjolander 303428ea28 Import css-layout measure mode changes from pull request #163
Reviewed By: lucasr

Differential Revision: D3167760

fb-gh-sync-id: f4f13bcb09a2d8b2db2764bd31fa8cbd8edb484b
fbshipit-source-id: f4f13bcb09a2d8b2db2764bd31fa8cbd8edb484b
2016-04-12 07:02:29 -07:00
Maxi Ferreira 2039be9d32 Added support for textDecorationLine style prop on Android
Summary:As suggested by kmagiera in #3819, I've implemented `textDecorationLine` style for Android in `ReactTextShadowNode` using span operations so we can support nested Text components.

![Demo](http://c.hlp.sc/022k2l033p0n/Image%202016-01-03%20at%2011.17.15%20PM.png)
Closes https://github.com/facebook/react-native/pull/5105

Differential Revision: D3167756

Pulled By: andreicoman11

fb-gh-sync-id: 122701a53d50f47f89b49e1f343c97db5fa2323d
fbshipit-source-id: 122701a53d50f47f89b49e1f343c97db5fa2323d
2016-04-12 03:37:34 -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
Scott Foggo 24f03af0c3 Implement clipping rectangle for ReactNativeART
Reviewed By: sebmarkbage, taomin

Differential Revision: D3140869

fb-gh-sync-id: 0da27705c4cfca7a1fcae12eed11a7335a62631f
fbshipit-source-id: 0da27705c4cfca7a1fcae12eed11a7335a62631f
2016-04-11 19:19:17 -07:00
Sebastian Markbage 0b534d1c3d Add deprecation warnings to ReactNative.addons
Summary:These were moved out into individual packages in React 0.14.

Exceptions are batchedUpdates and TestModule that are already reachable
on the ReactNative exports.
Closes https://github.com/facebook/react-native/pull/6927

Differential Revision: D3166243

Pulled By: sebmarkbage

fb-gh-sync-id: f696c84eda3cda522c91ec2ca584f5dde2e01407
fbshipit-source-id: f696c84eda3cda522c91ec2ca584f5dde2e01407
2016-04-11 18:20:28 -07:00
Emil Sjolander 8ef551174b backout update of css-layout. breaks ios <9
Reviewed By: javache

Differential Revision: D3164127

fb-gh-sync-id: 3926430f365711466ba93cd2eb7c91f31ef0c7f8
fbshipit-source-id: 3926430f365711466ba93cd2eb7c91f31ef0c7f8
2016-04-11 14:56:21 -07:00
cpojer 838cc48059 Make object properties in NativeModules configurable.
Summary:In Jest, we sometimes wipe away the (partial) state of the world. I noticed that when we run the NativeModules file twice, it throws. Because Jest implicitly throws out the state, it isn't obvious what exactly is going on.

I figured I'll fix this in react-native directly as I don't see a reason why those fields shouldn't be configurable. This shouldn't have any negative impact on react-native apps themselves.

cc ide bestander tadeuzagallo davidaurelio
Closes https://github.com/facebook/react-native/pull/6914

Differential Revision: D3162561

Pulled By: cpojer

fb-gh-sync-id: d3418ec210278a44f8ad325f7e9e01872b4877d1
fbshipit-source-id: d3418ec210278a44f8ad325f7e9e01872b4877d1
2016-04-11 07:57:28 -07:00
David Aurelio fcc89e9d92 Add support for missing XHR response types
Summary:Fixes #6679

This adds support for the missing response types to XMLHttpRequest.
Don?t ship this yet. This is completely untested. yolo and stuff.
Closes https://github.com/facebook/react-native/pull/6870

Reviewed By: bestander

Differential Revision: D3153628

Pulled By: davidaurelio

fb-gh-sync-id: 76feae3377bc24b931548a9ac1af07943b1048ac
fbshipit-source-id: 76feae3377bc24b931548a9ac1af07943b1048ac
2016-04-11 05:54:28 -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