Commit Graph

727 Commits

Author SHA1 Message Date
Janic Duplessis 114dde99ce Fix TouchableNativeFeedback state propagating to children
Summary:For some reason Android propagates the the pressed state to all of the ViewGroup's children when calling `setPressed`. This caused the issue described in #3952. Luckily we can override the `dispatchSetPressed` method of ViewGroup to prevent it from doing so.

Had to dig in the Android source a bit to find this one, here's the relevant pieces :
https://github.com/android/platform_frameworks_base/blob/master/core/java/android/view/View.java#L7883
https://github.com/android/platform_frameworks_base/blob/master/core/java/android/view/ViewGroup.java#L3722

**Test plan (required)**
Reproduced the bug using [this gist](https://gist.github.com/janicduplessis/9f1d42c670aefd660afb4c96e8bb6a4f) in UIExplorer. Touching the parent should not trigger the ripple on the children.

I also made sure all the touchable still work properly.

Fixes #3952
Closes https://github.com/facebook/react-native/pull/6783

Differential Revision: D3133407

fb-gh-sync-id: 317e55de2652ea185a1082cd96b8fe3a8b807962
fbshipit-source-id: 317e55de2652ea185a1082cd96b8fe3a8b807962
2016-04-04 08:48:22 -07:00
Pieter De Baets d95757037a Update css-layout from github
Summary:Update to latest master version of css-layout. Update integration in RCTShadow(Root)View to match.

This solves the issue with items not strechting vertically in column layouts (https://github.com/facebook/css-layout/issues/127)

Reviewed By: vjeux

Differential Revision: D3120699

fb-gh-sync-id: beba162e1255d3527e1160e9bd414a712cb10713
fbshipit-source-id: beba162e1255d3527e1160e9bd414a712cb10713
2016-04-04 04:10:24 -07:00
VonD 351c97ec37 adding missing string case in ReadableNativeMap to HashMap
Summary:about #6639
Closes https://github.com/facebook/react-native/pull/6762

Differential Revision: D3126541

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

Differential Revision: D3126354

Pulled By: mkonicek

fb-gh-sync-id: faa64314c0ddc87296277ccd707f18effef8f407
fbshipit-source-id: faa64314c0ddc87296277ccd707f18effef8f407
2016-04-01 07:16:20 -07:00
Atticus White dc3836a9d3 Add toArrayList and toHashMap methods for ReadableArray and ReadableMap. Fixes #4655
Summary:Context #4658

I kept the original commit and author.

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

Differential Revision: D3126336

Pulled By: mkonicek

fb-gh-sync-id: 5ae7b37f0eb1db355bb87076d621a405ff9c23c5
fbshipit-source-id: 5ae7b37f0eb1db355bb87076d621a405ff9c23c5
2016-04-01 07:02:25 -07:00
Andy Street 6a3b334139 Start creating views before end of batch
Summary:Creating views shouldn't have side effects so we can start doing them before the end of a batch. In order to limit the effect on framerate, we stop executing these create view operations after we've passed halfway through the frame.

Note, this doesn't seem to work yet for nodes: I'll address that in a followup diff.

Reviewed By: lexs

Differential Revision: D3120631

fb-gh-sync-id: 981540fac5a7499158146adb72c1be21fd0b5702
fbshipit-source-id: 981540fac5a7499158146adb72c1be21fd0b5702
2016-03-31 09:21:25 -07:00
Martin Konicek ae3dad86c5 Revert "Android support for perspective transform"
Summary:This reverts "Android support for perspective transform": 3e760f48c5, PR https://github.com/facebook/react-native/pull/6159, D3053532.

It broke negative scale transforms: https://github.com/facebook/react-native/issues/6622

Reviewed By: bestander

Differential Revision: D3120627

fb-gh-sync-id: 727528d39c049180fe4862d006f2089c997afd45
fbshipit-source-id: 727528d39c049180fe4862d006f2089c997afd45
2016-03-31 06:41:30 -07:00
Nathan Spaun 4498bc8197 Add prop to FbReactScrollView to fill the rest of the background to avoid overdraw
Reviewed By: foghina

Differential Revision: D3079290

fb-gh-sync-id: b824d235ca34f8e0408f5f40e6b73e028006ac9f
fbshipit-source-id: b824d235ca34f8e0408f5f40e6b73e028006ac9f
2016-03-30 18:06:19 -07:00
Andy Street d3b8846400 Easy: Add Java module and method name to systrace in xplat bridge
Summary: We lost java module and method names in systrace when we moved to the xplat bridge.

Reviewed By: mhorowitz

Differential Revision: D3116042

fb-gh-sync-id: a61181f4d6be04c70122b7f79d426e364df1e988
fbshipit-source-id: a61181f4d6be04c70122b7f79d426e364df1e988
2016-03-30 12:53:36 -07:00
Sokovikov e20e8a3cc8 Add support for vibration patterns
Summary:and "not supported" warnings for ios
Closes https://github.com/facebook/react-native/pull/6400

Differential Revision: D3113988

fb-gh-sync-id: 169623f157ec59c38b4368cbc668c85201b67ed8
fbshipit-source-id: 169623f157ec59c38b4368cbc668c85201b67ed8
2016-03-29 21:45:20 -07:00
Martin Bigio e54876dbd0 Fix duplicated buck dependency
Summary: Closes https://github.com/facebook/react-native/pull/6657

Differential Revision: D3098193

Pulled By: martinbigio

fb-gh-sync-id: 535cba9767494b886c03a1d67e71f4ebb3eb48f7
fbshipit-source-id: 535cba9767494b886c03a1d67e71f4ebb3eb48f7
2016-03-25 09:42:23 -07:00
Mart?n Bigio 5e559f85a0 Use `baseTransformer` for Instagram's bundle
Reviewed By: sam-swarr

Differential Revision: D3089888

fb-gh-sync-id: 61779538cd11cc0b62e851f7dd10a1d2ed4f07a3
fbshipit-source-id: 61779538cd11cc0b62e851f7dd10a1d2ed4f07a3
2016-03-25 07:56:26 -07:00
Marc Horowitz 18badf1c3e Move CREATE_CATALYST_INSTANCE_END marker inside JSCExecutor
Reviewed By: AaaChiuuu

Differential Revision: D3096157

fb-gh-sync-id: 6bcca134e5e7a426719816047ffc98a5178e9596
shipit-source-id: 6bcca134e5e7a426719816047ffc98a5178e9596
2016-03-24 19:42:28 -07:00
Satyajit Sahoo 6c22a2174e Fix fetching sourcemap in genymotion. Fixes #5338
Summary:Source maps are broken on Genymotion right now as they aren't being loaded from the correct URL. refer - https://github.com/facebook/react-native/issues/5338#issuecomment-188232402

**Test plan**

Build and install UIExplorer from master branch in genymotion and enable hot reload. When you change a file and save it, you'll see a Yellow box due to source map fetching failed, as per the referenced comment.

Doing the same for this branch doesn't produce any yellow boxes.
Closes https://github.com/facebook/react-native/pull/6594

Differential Revision: D3088218

Pulled By: martinbigio

fb-gh-sync-id: 0d1c19cc263de5c6c62061c399eef33fa4ac4a7b
shipit-source-id: 0d1c19cc263de5c6c62061c399eef33fa4ac4a7b
2016-03-24 12:06:45 -07:00
Dmitry Gladkov 393890e00f Don't strip NativeRunnable constructor. Fixes #6624
Summary:Fixes proguard in RN 0.22.+. Closes #6624
Closes https://github.com/facebook/react-native/pull/6626

Differential Revision: D3092892

fb-gh-sync-id: 3aaf97c6f1c7b5d575cb912196b43955d9ef10fb
shipit-source-id: 3aaf97c6f1c7b5d575cb912196b43955d9ef10fb
2016-03-24 08:17:21 -07:00
Krzysztof Magiera 65ccdffc8d Execute Animated.js declarative animation on UIThread on Android.
Summary:This is the first from the series of PRs I'm going to be sending shorty that would let Animated.js animations to run off the JS thread (for Android only).

This PR introduce a new native module that will be used for offloading animations - NativeAnimatedModule. It has a simple API that allows for animated nodes management via methods like: create/drop animated node, connect/disconnect nodes, start animation of a value node, attach/detach animated from a native view.

Similarly to how we handle UIManager view hierarchy updates we create a queue of animated graph operations that are then executed on the UI thread. This isolates us from problems that may be caused by concurrent updates of animated graph while UI thread is "executing" the animation.

The most important class NativeAnimatedNodesManager.java implements a management interface for animated nodes graph as well as implements a graph traversal algorithm that is run for each animation frame. For each animation frame we visit animated nodes th
Closes https://github.com/facebook/react-native/pull/6466

Differential Revision: D3092739

Pulled By: astreet

fb-gh-sync-id: 665b49900b7367c91a93b9d8864f78fb90bb36ba
shipit-source-id: 665b49900b7367c91a93b9d8864f78fb90bb36ba
2016-03-24 06:19:27 -07:00
Saurabh Aggarwal 3c488afb0f Remove stetho dependency in OSS react native's NetworkingModule
Reviewed By: astreet

Differential Revision: D3038280

fb-gh-sync-id: 169e21b9276f928b7144ebf2f3b8487b5e87c073
shipit-source-id: 169e21b9276f928b7144ebf2f3b8487b5e87c073
2016-03-23 12:41:24 -07:00
Dave Miller e8e31823b9 Fix the clip rect computation for removeClippedSubviews
Summary: The computation for calculateClippingRect didn't work if you had a horizontal scroll nested in a vertical scroll view.  The fix is to simplify the logic to first intersect the inner view within its parent and then apply transforms (translation by top/left and scroll offset).  That now provides the correct clipping rectangle for nested views.

Reviewed By: astreet

Differential Revision: D3087367

fb-gh-sync-id: efdd430e024c4599189ddb8dbb258fd2b118690f
shipit-source-id: efdd430e024c4599189ddb8dbb258fd2b118690f
2016-03-23 12:28:27 -07:00
Martin Konicek 85197a0326 Add Modal to the main Java package
Reviewed By: dmmiller

Differential Revision: D3087508

fb-gh-sync-id: 066b8c4102f9669ed58e6cda1b0013e74a3627f8
shipit-source-id: 066b8c4102f9669ed58e6cda1b0013e74a3627f8
2016-03-23 09:38:26 -07:00
David Aurelio 83fb122406 Add Random Access Module file names to stack traces
Summary: Adds support to generate stack traces that can be used with source maps that have a `x_facebook_offsets` field. If a file name of a stack frame contains only digits and ends with “.js”, it is included in the trace format generated by `ExceptionsManagerModule`

Reviewed By: martinbigio

Differential Revision: D3072953

fb-gh-sync-id: 69a57e3e2c758034939e5264008871f38f48a78f
shipit-source-id: 69a57e3e2c758034939e5264008871f38f48a78f
2016-03-22 15:22:23 -07:00
Spencer Ahrens 1f94a00785 Add JS Minify option to settings in Android
Summary: Useful for debugging minification issues and more representative perf testing.

Differential Revision: D3080489

fb-gh-sync-id: 315f696d3847a213eb95f247f409173a01864567
shipit-source-id: 315f696d3847a213eb95f247f409173a01864567
2016-03-21 21:12:23 -07:00
Fada Chen e3fe66acfc Backed out D3073724, revert changes in master only
Reviewed By: zjj010104

Differential Revision: D3076377

fb-gh-sync-id: da9ca730904c2d520c5c0619b68f3ebee2c74f02
shipit-source-id: da9ca730904c2d520c5c0619b68f3ebee2c74f02
2016-03-21 19:32:26 -07:00
DengYun 90aa7b951d Fix #5599: toast doesn't disappear after app exited.
Summary:Run `Toast.makeText` other than UI Thread will cause bug #5599 : toast doesn't disappear after app exited.

use `UiThreadUtil.runOnUiThread` to fix this.
Closes https://github.com/facebook/react-native/pull/6443

Differential Revision: D3047261

fb-gh-sync-id: 0096879f2a4b4d76bda996a32089f068ae68e3f3
shipit-source-id: 0096879f2a4b4d76bda996a32089f068ae68e3f3
2016-03-21 17:43:23 -07:00
Dave Miller dfce55a034 Fix Modal on Android
Summary: When I first did Modal on Android, I incorrectly set the styleWidth and styleHeight on the ModalHostShadowNode.  This corresponded to RCTModalHostView in Modal.js.  This node is actually really just a dummy node in the tree.  The proper node to set the width and height on is the inner <View/> that has top and left position set on it.  This updates the code to set the width and height on that inner node.

Reviewed By: mkonicek

Differential Revision: D3077415

fb-gh-sync-id: e9aee0a21333ed0b5bdde11f453381b0a13470c9
shipit-source-id: e9aee0a21333ed0b5bdde11f453381b0a13470c9
2016-03-21 14:35:27 -07:00
Fada Chen 4d39b1d6b5 Backed out D3073723, revert changes in master only
Reviewed By: kirwan

Differential Revision: D3076395

fb-gh-sync-id: 573462a5cb0898ca69824fd44b4e26ca15ddcbeb
shipit-source-id: 573462a5cb0898ca69824fd44b4e26ca15ddcbeb
2016-03-21 14:33:31 -07:00
Satyajit Sahoo 97a97b3c11 Tweak error message for HMR
Summary:The error messages are iOS specific right now. This PR improves them to include the Android bits also.

![screenshot_20160322-000431](https://cloud.githubusercontent.com/assets/1174278/13929839/2bccce5e-efc2-11e5-9db3-f72dcf486412.png)
Closes https://github.com/facebook/react-native/pull/6546

Differential Revision: D3077815

Pulled By: martinbigio

fb-gh-sync-id: 344430d350023e78bd5fdae923eb4b6ce2924be5
shipit-source-id: 344430d350023e78bd5fdae923eb4b6ce2924be5
2016-03-21 14:08:26 -07:00
Bruno Barbieri 2a2ba4bd6b color support for TextInput secureTextEntry={true}
Summary:Color property is ignored for TextInput with secureTextEntry={true} on Android.

This is coming  from #6540 and being split into 2 PRs by suggestion of dmmiller.
As he mentioned does almost the same  except it #6064 doesn't handle null case.

Working example:

![scn949wlce](https://cloud.githubusercontent.com/assets/1247834/13929873/b700d650-ef72-11e5-9d67-0a7e0385bc2a.gif)
Closes https://github.com/facebook/react-native/pull/6563

Differential Revision: D3077583

Pulled By: mkonicek

fb-gh-sync-id: f0761346b77060abf17f1d4573b375adebc5c607
shipit-source-id: f0761346b77060abf17f1d4573b375adebc5c607
2016-03-21 13:48:23 -07:00
Kevin McCray b7ae7d0b4e ReactNative: fix clang errors
Differential Revision: D3068705

fb-gh-sync-id: 83fcbf0105310f99a4f65f566df77a6014873686
shipit-source-id: 83fcbf0105310f99a4f65f566df77a6014873686
2016-03-21 09:47:27 -07:00
Brent Vatne 03619daf04 Align inline images to baseline by default on Android
Summary:Full discussion in FB group: https://www.facebook.com/groups/reactnativeoss/permalink/1532669803696315/

**Test plan**

In the following examples I use a different image than the one built in to UIExplorer because this one better demonstrates the alignment:

![before](https://cloud.githubusercontent.com/assets/90494/13887933/c183e60e-ecfb-11e5-98cb-9c6d0104bb23.png)

![after](https://cloud.githubusercontent.com/assets/90494/13887937/c896eb76-ecfb-11e5-88fa-979a1ba62714.png)

![ios](https://cloud.githubusercontent.com/assets/90494/13888029/40b1f3ee-ecfc-11e5-9d71-1cfdf8213ec8.png)

If you want to try this for yourself, you can copy this into the inline image example:

```javascript
<Text style={{fontSize: 20}}>
  This text contains an inline image, look at it! <Image source={{uri: 'https://d3fzfeknznuaac.cloudfront.net/images4/open_list_plus_grey@2x.png'}} style={{height: 15, width: 15}} />. Neat, huh?
</Text>
```
Closes https://github.com/facebook/react-native/pull/6528

Differential Revision: D3075801

Pulled By: foghina

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

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

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

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

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

Reviewed By: bestander

Differential Revision: D3012242

Pulled By: lexs

fb-gh-sync-id: 4967d7ec920f0229d823032ba95c8a3cace329c6
shipit-source-id: 4967d7ec920f0229d823032ba95c8a3cace329c6
2016-03-21 06:24:33 -07:00
Petr Glotov a95d9dc0ad fixed webview events package path
Summary:This PR makes package paths consistent with file paths.
Closes https://github.com/facebook/react-native/pull/6516

Differential Revision: D3075201

Pulled By: mkonicek

fb-gh-sync-id: a23a20f27427f28ac8a7e4f36387feb8a7409067
shipit-source-id: a23a20f27427f28ac8a7e4f36387feb8a7409067
2016-03-20 17:52:20 -07:00
Fada Chen 1ab2d85a15 Backed out D3019076
Reviewed By: zjj010104

Differential Revision: D3073723

fb-gh-sync-id: 229946ca4cd98488f8fa4d908412baebbc41d549
shipit-source-id: 229946ca4cd98488f8fa4d908412baebbc41d549
2016-03-20 13:03:24 -07:00
Fada Chen 630c142d81 Backed out D3019087
Reviewed By: zjj010104

Differential Revision: D3073724

fb-gh-sync-id: cd97477c9405f1ec048ba3dcdfd4280f77b631d2
shipit-source-id: cd97477c9405f1ec048ba3dcdfd4280f77b631d2
2016-03-20 12:59:20 -07:00
Alon Schwarz fb8340d289 Add center ImageResizeMode option
Summary:Adds a `center` option to `Image`'s `resizeMode` prop, which doesn't enlarge images.
This is how it looks in UIExplorer:
{F60386921}

Reviewed By: dmmiller

Differential Revision: D3064284

fb-gh-sync-id: 79cd2da8f44c5b3da2e42d3bebf3131335f53c28
shipit-source-id: 79cd2da8f44c5b3da2e42d3bebf3131335f53c28
2016-03-19 11:25:24 -07:00
Konstantin Raev da5596c97d fixed flow error on Travis
Summary: Closes https://github.com/facebook/react-native/pull/6530

Differential Revision: D3071277

fb-gh-sync-id: e2cfd2d2a8cbf5a862dcdb79fe834b1fdbcba107
shipit-source-id: e2cfd2d2a8cbf5a862dcdb79fe834b1fdbcba107
2016-03-19 02:15:24 -07:00
Dan Caspi 22e55d4396 Adding Pre-PArsing cache & StringRef to iOS 8's JSC
Reviewed By: michalgr

Differential Revision: D3066370

fb-gh-sync-id: 2dabffbd41d4f4f9f2a9ddaca3224ba00498821e
shipit-source-id: 2dabffbd41d4f4f9f2a9ddaca3224ba00498821e
2016-03-18 12:21:33 -07:00
Marc Horowitz 0cb7d16ab4 Race condition fix in refactored bridge code
Differential Revision: D3065139

fb-gh-sync-id: 820c97f9d0200c2290727a1467837af0ca6ded41
shipit-source-id: 820c97f9d0200c2290727a1467837af0ca6ded41
2016-03-18 11:21:21 -07:00
Michael Lee e4eb84fa70 Upgrade folly dependency
Summary: Folly deprecated the brace initialization for dynamic::array, so point to a more recent tarball and fix it.

Reviewed By: bestander

Differential Revision: D3066402

fb-gh-sync-id: aaf70423886cb0cbc14aba7878a1d4e32bce82b1
shipit-source-id: aaf70423886cb0cbc14aba7878a1d4e32bce82b1
2016-03-18 10:34:26 -07:00
Dave Miller db7a154360 Open source Modal
Summary: This open sources an internal Modal View

Reviewed By: mkonicek

Differential Revision: D3065229

fb-gh-sync-id: 763996aef375883d94f70e617bfc7835a9cecb6f
shipit-source-id: 763996aef375883d94f70e617bfc7835a9cecb6f
2016-03-18 04:21:48 -07:00
Janic Duplessis c76523f1ad Fix text input scroll when status bar is translucent
Summary:Changed the implementation of `setTranslucent` because the old one used the view flag SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN which has the sad side effect of making the ScrollViews not adjust properly when the keyboard is opened. Instead I use `setOnApplyWindowInsetsListener` to hook in the insets calculation process and consume the top offset so the decor view doesn't add top padding for the status bar.

I also limited the translucent prop to API 21+ because `setOnApplyWindowInsetsListener` is not available before that and anyway the translucent prop is only useful with a semi-transparent status bar color which only works on API 21+.

**Test plan**
Reproduced the bug using this code in UIExplorer.
https://gist.github.com/janicduplessis/217b9994e35f960a1793

Tapping a text field that would be hidden by the soft keyboard should scroll the view so it is not hidden.

Also tested that setting the translucent prop on and off still works as before.

Fixes #6455
Closes https://github.com/facebook/react-native/pull/6481

Differential Revision: D3067199

Pulled By: mkonicek

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

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

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

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

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

Differential Revision: D3017559

fb-gh-sync-id: d6f4c6a72a2dfde83496ecc0f56dca4abaf3055e
shipit-source-id: d6f4c6a72a2dfde83496ecc0f56dca4abaf3055e
2016-03-17 16:54:26 -07:00
Alexander Blom d329570ac8 Get rid of jackson (mostly)
Reviewed By: astreet

Differential Revision: D3041362

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

Differential Revision: D3053554

Pulled By: mkonicek

fb-gh-sync-id: a1f362c1551de1a0218f5d23c70668e4c8078993
shipit-source-id: a1f362c1551de1a0218f5d23c70668e4c8078993
2016-03-16 10:03:26 -07:00
Alexander Andersson 09820cbe36 GeoLocation timeout never called on android
Summary:Don't add systems current time to the `timeout` option. This is already correct on iOS.
Closes https://github.com/facebook/react-native/pull/6376

Differential Revision: D3053728

Pulled By: mkonicek

fb-gh-sync-id: 919068659d0d23906d8a6d85df7819296460b719
shipit-source-id: 919068659d0d23906d8a6d85df7819296460b719
2016-03-15 11:55:32 -07:00
Kevin Stumpf 3e760f48c5 Android support for perspective transform
Summary:- Motivation: ["Perspective" Transform](https://facebook.github.io/react-native/docs/transforms.html#proptypes) was so far supported only on iOS
- Closes #2915
- Test Plan: I built a [react-native-flip-view](https://github.com/DispatcherInc/react-native-flip-view) and ensured that the same perspective transform results in the same camera perspective on both iOS and Android:

![image](https://cloud.githubusercontent.com/assets/7293984/13342624/6556cfe0-dbf8-11e5-8fb2-05554a5081b7.png)

![image](https://cloud.githubusercontent.com/assets/7293984/13342677/daf90560-dbf8-11e5-9941-2ae0f9f9d99b.png)
Closes https://github.com/facebook/react-native/pull/6159

Differential Revision: D3053532

Pulled By: mkonicek

fb-gh-sync-id: a39a9fbafe0fc7c648fdafc2eb69f651fe58d9fb
shipit-source-id: a39a9fbafe0fc7c648fdafc2eb69f651fe58d9fb
2016-03-15 11:52:22 -07:00
Alexey Dodonov cc2068e201 Backed out changeset 183744d2415b
Reviewed By: nicklockwood

Differential Revision: D3053067

fb-gh-sync-id: de20718b5bf82eae433637847143e32b7a4bb216
shipit-source-id: de20718b5bf82eae433637847143e32b7a4bb216
2016-03-15 11:49:28 -07:00
David Aurelio d0cdabc73e Don't prepend the asset name string with "file://" for unbundles
Summary: D2922108 / PR #5814 broke the “Unbundle” loader by prepending the file path to the entry file with "file://". This converts it back.

Reviewed By: lexs

Differential Revision: D3052749

fb-gh-sync-id: 0b241c50e25f1a1c85265915bee01582d0ba7ac6
shipit-source-id: 0b241c50e25f1a1c85265915bee01582d0ba7ac6
2016-03-15 08:12:29 -07:00
Dave Miller 39fdce259d Refactor JS touch dispatch from ReactRootView
Reviewed By: andreicoman11

Differential Revision: D3035589

fb-gh-sync-id: a4af7b0be89e5ea13367481697ff4b3dda8536b1
shipit-source-id: a4af7b0be89e5ea13367481697ff4b3dda8536b1
2016-03-15 07:29:30 -07:00
Christopher Dro e674e45c2e Reverted commit D3040735
Summary:This is a follow up of 9b87e6c860.

- Allows custom headers on connection request
- Adds a default `origin` header to Android, just like iOS

**Introduces no breaking changes.**

I was working on something similar and would like to propose a few changes that make the API more consistent across both iOS and Android platforms and brings this closer to [spec](https://tools.ietf.org/html/rfc6455).

I believe aprock first implementation of adding custom `headers` was correct. It makes sense naming this argument `headers` since we have no other general options available, and the current `options` field is being used to pass in a header anyway.

My use case for custom headers was attaching a token to the `Authorization` header on the connection request. I have been testing this by passing a JWT inside the `Authorization` header and verifying it on the server before establishing a connection.
Closes https://github.com/facebook/react-native/pull/6016

Differential Revision: D3040735

fb-gh-sync-id: 183744d2415b895f9d9fd8ecf6023a546e18a546
shipit-source-id: 183744d2415b895f9d9fd8ecf6023a546e18a546
2016-03-15 07:20:26 -07:00
Christopher Dro 205b5d4732 Update options parameter to headers. Update to spec.
Summary:This is a follow up of 9b87e6c860.

- Allows custom headers on connection request
- Adds a default `origin` header to Android, just like iOS

**Introduces no breaking changes.**

I was working on something similar and would like to propose a few changes that make the API more consistent across both iOS and Android platforms and brings this closer to [spec](https://tools.ietf.org/html/rfc6455).

I believe aprock first implementation of adding custom `headers` was correct. It makes sense naming this argument `headers` since we have no other general options available, and the current `options` field is being used to pass in a header anyway.

My use case for custom headers was attaching a token to the `Authorization` header on the connection request. I have been testing this by passing a JWT inside the `Authorization` header and verifying it on the server before establishing a connection.
Closes https://github.com/facebook/react-native/pull/6016

Differential Revision: D3040735

Pulled By: nicklockwood

fb-gh-sync-id: f81bd14ccbdba36309b9d4b4850fb66fe4deae11
shipit-source-id: f81bd14ccbdba36309b9d4b4850fb66fe4deae11
2016-03-15 05:14:21 -07:00
Zen Xu e1e86a1174 Remove okhttp from release build for Instagram
Reviewed By: hendritan

Differential Revision: D3044625

fb-gh-sync-id: 0ae66187d9fe3d59b002f603fc73c0758640e287
shipit-source-id: 0ae66187d9fe3d59b002f603fc73c0758640e287
2016-03-14 16:14:25 -07:00
Chris Hopman 872b697730 Add support for multiple js contexts
Reviewed By: mhorowitz

Differential Revision: D3035333

fb-gh-sync-id: f829702992cd717acd1eb105b3dcc8abdbc6dc74
shipit-source-id: f829702992cd717acd1eb105b3dcc8abdbc6dc74
2016-03-14 11:38:57 -07:00
Aaron Chiu b006f79bf5 make Activity reference in ReactContext WeakReference
Reviewed By: andreicoman11

Differential Revision: D3040724

fb-gh-sync-id: fef5a84907d22d07ae1df82f5d1071c8fae45420
shipit-source-id: fef5a84907d22d07ae1df82f5d1071c8fae45420
2016-03-14 07:51:26 -07:00
Chris Hopman 9acf7417a8 Port some minor changes to the old bridge
Reviewed By: mhorowitz, astreet

Differential Revision: D3024252

fb-gh-sync-id: 3ea28f793d920d74caab9b8c1487957e89ea23b3
shipit-source-id: 3ea28f793d920d74caab9b8c1487957e89ea23b3
2016-03-11 09:30:23 -08:00
farwayer 8aa83a2d93 Fix setting android toolbar images after null them
Summary:fix #6374
Closes https://github.com/facebook/react-native/pull/6392

Differential Revision: D3041076

Pulled By: mkonicek

fb-gh-sync-id: 39efbc62c1cd352b54f062d8530a26f7630bf51f
shipit-source-id: 39efbc62c1cd352b54f062d8530a26f7630bf51f
2016-03-11 08:07:32 -08:00
Denis Koroskin c42fc61a2a Fix RCTText crashing when negative width is passed to measure
Reviewed By: sriramramani

Differential Revision: D3038767

fb-gh-sync-id: ad3fde7cf4b73aad786bdf1dc3cea24862d656b8
shipit-source-id: ad3fde7cf4b73aad786bdf1dc3cea24862d656b8
2016-03-10 17:19:22 -08:00
Dan Caspi c304364af4 Improvements to the preparsing cache
Reviewed By: michalgr

Differential Revision: D3005912

fb-gh-sync-id: 3ab1f804e6203807a5d9f35e5560e847a9830cd6
shipit-source-id: 3ab1f804e6203807a5d9f35e5560e847a9830cd6
2016-03-10 10:31:48 -08:00
Charles Dick 13c49e2006 Fix null deref in RN timer code
Reviewed By: astreet

Differential Revision: D3029772

fb-gh-sync-id: 0af13208659093b14013c0ee3c00b2438fadca9c
shipit-source-id: 0af13208659093b14013c0ee3c00b2438fadca9c
2016-03-10 07:22:26 -08:00
Chris Hopman e9c79f85ba Initialize glog in react native
Reviewed By: andreicoman11

Differential Revision: D3023912

fb-gh-sync-id: 0f240448f465fd0ad629c239f45a24f01af4dc1b
shipit-source-id: 0f240448f465fd0ad629c239f45a24f01af4dc1b
2016-03-10 06:02:21 -08:00
Alexander Andersson d20bde3f2e Add missing textAlignVertical support on android textview
Summary:Add missing implementation of `textAlignVertical` style prop for `Text`-component.
According to the [docs](https://facebook.github.io/react-native/docs/text.html#style) it should be implemented but was only added for `TextInput` in f453e14c8f.
Closes https://github.com/facebook/react-native/pull/6105

Differential Revision: D3029783

Pulled By: dmmiller

fb-gh-sync-id: 29bcd50a7280c890707f811bcfc7a3d5c5be5142
shipit-source-id: 29bcd50a7280c890707f811bcfc7a3d5c5be5142
2016-03-10 03:02:26 -08:00
Andrei Coman f5a349021d Fix event dispatcher timestamp sorting bug
Summary:Turns out even using nanoseconds as timestamps will not guarantee that events
won't happen at the same time. This fixes sorting for event comparison.

Differential Revision: D3030540

fb-gh-sync-id: 2630c50ea60a792ea07b1bf1c6cd46a6d9859268
shipit-source-id: 2630c50ea60a792ea07b1bf1c6cd46a6d9859268
2016-03-09 12:41:28 -08:00
Michael Lee ab4c73c30c Compensate for different versions of folly for open source build
Summary: ReactAndroid will need to use the deprecated version of folly::dynamic for the time being.

Reviewed By: bestander

Differential Revision: D3025433

fb-gh-sync-id: fee6beb65d5d0c449f1a08a0d3c593b788905001
shipit-source-id: fee6beb65d5d0c449f1a08a0d3c593b788905001
2016-03-08 13:17:21 -08:00
Corentin Smith 2070efa019 Convert Image resizeMode `contain` to FIT_CENTER
Summary:Convert from `CENTER_INSIDE` to `FIT_CENTER`.
The difference between those is that `CENTER_INSIDE` will not upscale if the image is too small.
See the Fresco docs: http://frescolib.org/javadoc/reference/com/facebook/drawee/drawable/ScalingUtils.ScaleType.html

Original issue: https://github.com/facebook/react-native/issues/4031
Closes https://github.com/facebook/react-native/pull/5738

Differential Revision: D2959473

Pulled By: mkonicek

fb-gh-sync-id: 8f76944e53b3d56fec0dc7303db339a71d0c389e
shipit-source-id: 8f76944e53b3d56fec0dc7303db339a71d0c389e
2016-03-08 12:12:34 -08:00
Michael Lee accccd8e55 Remove use of deprecated folly::dynamic initialization
Reviewed By: ot

Differential Revision: D3021659

fb-gh-sync-id: 1ba5e2fcc5b30ce4b6174fb911608236c1c3084b
shipit-source-id: 1ba5e2fcc5b30ce4b6174fb911608236c1c3084b
2016-03-08 10:44:33 -08:00
Michał Gregorczyk 6e3710f36b Make js perf API available to js
Reviewed By: tadeuzagallo

Differential Revision: D3011680

fb-gh-sync-id: 051864689af0b9041318cc314d339ae841fe35aa
shipit-source-id: 051864689af0b9041318cc314d339ae841fe35aa
2016-03-08 10:16:24 -08:00
Denis Koroskin aae521f57e Add ReactCompoundViewGroup interface that allows having both virtual and non-virtual (View) children
Summary: In React, ReactCompoundView is supposed to be implemented by a View, but there is no ViewGroup counterpart that allows mixing virual nodes and non-virtual ones (Views) in the same parent. This is needed because TouchTargetHelper always considers child Views when looking for touch target before falling back to View/ReactCompoundView. This works incorrectly for e.g. layout-only / flattened nodes. ReactCompoundViewGroup allow intercepting touch event before it is dispatched to its children. In that sense, ReactCompoundView.reactTagForTouch() is like View.onTouchEvent() whereas ReactCompoundViewGroup.interceptsTouchEvent() is like ViewGroup.onInterceptTouchEvent().

Differential Revision: D3018028

fb-gh-sync-id: d2c70a55afb9ce9823275e7483d72e0ebedf52e4
shipit-source-id: d2c70a55afb9ce9823275e7483d72e0ebedf52e4
2016-03-07 20:07:24 -08:00
Fada Chen 33e9e34648 Backed out changeset D3012925
Differential Revision: D3019076

fb-gh-sync-id: 201895cd5555845c8a7aa3c0b0f4d0a012912144
shipit-source-id: 201895cd5555845c8a7aa3c0b0f4d0a012912144
2016-03-07 12:26:25 -08:00
Fada Chen f885f5335c Backed out D3012969
Differential Revision: D3019087

fb-gh-sync-id: 8f137351d1fd89b71260b73b2f8daefb6f00127a
shipit-source-id: 8f137351d1fd89b71260b73b2f8daefb6f00127a
2016-03-07 11:28:21 -08:00
Fada Chen 4130f11b9d revert D2839551
Reviewed By: zjj010104

Differential Revision: D3012925

fb-gh-sync-id: b8db55a6ceaf7280ee6330776b80807565d83a09
shipit-source-id: b8db55a6ceaf7280ee6330776b80807565d83a09
2016-03-06 13:33:27 -08:00
Fada Chen fedca59bd0 revert D2971596
Reviewed By: zjj010104

Differential Revision: D3012969

fb-gh-sync-id: 8997a6167398715f8f78724a43a449da4079cc7e
shipit-source-id: 8997a6167398715f8f78724a43a449da4079cc7e
2016-03-06 13:31:24 -08:00
Martín Bigio cde58a61aa Rename dev menu option to Hot Reloading on boths ios and android
Reviewed By: sam-swarr

Differential Revision: D3013121

fb-gh-sync-id: 4fc5ff73425c1d896bc4fb0085d39b5eef7e0e94
shipit-source-id: 4fc5ff73425c1d896bc4fb0085d39b5eef7e0e94
2016-03-06 10:12:25 -08:00
Aaron Chiu ae11449516 in ReactContext, de-reference the Activity in onPause() instead of onHostDestroy()
Reviewed By: andreicoman11

Differential Revision: D3004340

fb-gh-sync-id: a408cb64565e18069a291b415b1ad9d429ba8f45
shipit-source-id: a408cb64565e18069a291b415b1ad9d429ba8f45
2016-03-05 20:31:22 -08:00
Kevin Stumpf a6a89fe4e0 Fix IllegalStateException crash in WebSocketModule.java
Summary:- Motivation: The WebSocket implementation on Android crashes the app when an attempt is made to write on a web socket that was closed due to a spotty connection. We found this issue by using Pusher, which is built on WebSockets. The following stack trace reveals that the WebSocketModule doesn't catch the case of a closed connection, when a consumer attempts to write:
```sh
Fatal Exception: java.lang.IllegalStateException: closed
       at com.squareup.okhttp.internal.ws.RealWebSocket.sendMessage(RealWebSocket.java:109)
       at com.facebook.react.modules.websocket.WebSocketModule.send(WebSocketModule.java:176)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:249)
       at com.facebook.react.bridge.NativeModuleRegistry$ModuleDefinition.call(NativeModuleRegistry.java:158)
       at com.facebook.react.bridge.NativeModuleRegistry.call(NativeModuleReg
Closes https://github.com/facebook/react-native/pull/6301

Differential Revision: D3016099

fb-gh-sync-id: 838dd9d2e5e5b7a4e2242fa6de5658dfdaf24f55
shipit-source-id: 838dd9d2e5e5b7a4e2242fa6de5658dfdaf24f55
2016-03-05 00:43:53 -08:00
Ahmed El-Helw 21b7bf4728 Fix commit order of operations in Nodes
Summary: Split dispatchViewUpdates into two methods, which enables subclasses to commit pending ui operations, even when no root node is present.

Differential Revision: D3011191

fb-gh-sync-id: a3491179441223aeffe21ff483dda582053768e7
shipit-source-id: a3491179441223aeffe21ff483dda582053768e7
2016-03-04 16:21:50 -08:00
Alexander Blom ea882b6f16 Immediate dispatch 0 time timers
Summary: Calling setTimeout(f, 0) will currently schedule f to be called the next frame instead of immediately (which is how it behaves on iOS). This immediately calls back to JS and invokes the function.

Reviewed By: astreet, tadeuzagallo

Differential Revision: D3006125

fb-gh-sync-id: 9fa109ed82836a718cbb2e8cb21da4943d96f5f6
shipit-source-id: 9fa109ed82836a718cbb2e8cb21da4943d96f5f6
2016-03-04 09:31:23 -08:00
Andy Street 9199c721de WebWorker: Allow worker script to be loaded from the network in debug builds
Summary:Making buck rebundle the worker script on every JS change is insanely slow. This allows the script to be downloaded for debug builds.

The plan is to couple this with an implementation of `require.resolve` which will automatically insert the correct packager network path in DEV builds and the correct local path in release builds.

e.g.

  var worker = new Worker(require.resolve('WebWorkerSample_getPrimesBetween.js'));

Reviewed By: lexs

Differential Revision: D2939279

fb-gh-sync-id: fbf64bbf1df1649b44e4b98ac504d095c10104a6
shipit-source-id: fbf64bbf1df1649b44e4b98ac504d095c10104a6
2016-03-04 07:34:26 -08:00
Andy Street e64987d780 Fix deadlock in bridge
Summary:There was a deadlock in the bridge if a native module tried to dispatch an event through EventDispatcher (that thread would hold the mTeardownLock and want the mEventStaging lock) at the same time the EventDispatcher callback was triggered and tried to dispatch a call through JS (that thread would hold the mEventStaging lock and want the mTeardownLock).

Now there are two locks (lol). In the scenario above, the native module would hold the mJSToJavaTeardownLock and want the mEventStaging lock, while the EventDispatcher callback would hold the mEventStaging lock and want the mJavaToJSTeardownLock.

Reviewed By: lexs

Differential Revision: D3011526

fb-gh-sync-id: c3ebd5c14a6370d73caebf6c99fcba18a86c6ac1
shipit-source-id: c3ebd5c14a6370d73caebf6c99fcba18a86c6ac1
2016-03-04 05:55:27 -08:00
Andy Street 1b4c23e001 WebWorkers: Update WebWorker sample to use networking/timers
Summary: Updates the sample to use native modules.

Differential Revision: D2932319

fb-gh-sync-id: 9dc12789839ec2d65e98205508d958d0c8c5b46e
shipit-source-id: 9dc12789839ec2d65e98205508d958d0c8c5b46e
2016-03-03 13:34:30 -08:00
Felix Oghina 2e4bb5364d destroy react instance on background critical memory pressure
Reviewed By: astreet

Differential Revision: D2989125

fb-gh-sync-id: 0e441409d6b0ea7d5ff6a037730cc1c36818a2da
shipit-source-id: 0e441409d6b0ea7d5ff6a037730cc1c36818a2da
2016-03-03 11:13:39 -08:00
Felix Oghina 4b52d185ac support simulating critical memory pressure, even when activity is destroyed
Reviewed By: lexs

Differential Revision: D2989094

fb-gh-sync-id: 17bbcac390ab1a3a745f1e85f7cb23d1dcf7043b
shipit-source-id: 17bbcac390ab1a3a745f1e85f7cb23d1dcf7043b
2016-03-03 11:13:34 -08:00
Felix Oghina c027f05ef4 add generic memory pressure listener interface
Reviewed By: lexs

Differential Revision: D2989071

fb-gh-sync-id: 375c7551bd4b281096850732432f016c2684add0
shipit-source-id: 375c7551bd4b281096850732432f016c2684add0
2016-03-03 11:13:28 -08:00
Andy Street 9a3f11d3e7 WebWorkers: Convert NetworkingModule to support web workers
Summary: Converts NetworkingModule to dispatch callbacks to the appropriate ExecutionContext.

Reviewed By: lexs

Differential Revision: D2932170

fb-gh-sync-id: ac77eec1a176ede4d2257bfd8ddb13153331c8a4
shipit-source-id: ac77eec1a176ede4d2257bfd8ddb13153331c8a4
2016-03-03 11:07:32 -08:00
Andy Street e4766b7979 WebWorkers: Update Timing module to support web workers
Summary: Example of a conversion to web worker support using the ExecutionContext API changes made in the last set of web worker diffs. WebWorkerSample now creates timers to show that we can dispatch timer calls to multiple JS contexts.

Reviewed By: lexs

Differential Revision: D2928657

fb-gh-sync-id: 17c5f8cd7c63624da43383da7c4160dc48482fe5
shipit-source-id: 17c5f8cd7c63624da43383da7c4160dc48482fe5
2016-03-03 08:51:33 -08:00
Andy Street 7fb33032f6 Copy weak reference to callback object when dispatching calls to Java
Summary: The bridge could be destructed, meaning we can't try to resolve member variables of PlatformBridgeCallback.

Reviewed By: lexs

Differential Revision: D3005994

fb-gh-sync-id: f83de432148ce62fd1060c6b84ec39ad2fa10a55
shipit-source-id: f83de432148ce62fd1060c6b84ec39ad2fa10a55
2016-03-03 07:52:30 -08:00
Konstantin Raev 32dd1fe35a fixed instrumentation tests crashes in emulator
Summary:Improving CircleCI stability running tests
Closes https://github.com/facebook/react-native/pull/6270

Differential Revision: D3005903

fb-gh-sync-id: 3421546a19b20db5485b3f816e2c6008e8121749
shipit-source-id: 3421546a19b20db5485b3f816e2c6008e8121749
2016-03-03 07:30:35 -08:00
Andy Street 6d5f9ddfff WebWorkers: Allow native modules to be notified when executors are unregistered
Summary: This will allow them to clean up resources when a web worker goes away.

Reviewed By: mhorowitz, lexs

Differential Revision: D2994721

fb-gh-sync-id: c7ca1afc7290e85038cf692a139f6478dba0ef61
shipit-source-id: c7ca1afc7290e85038cf692a139f6478dba0ef61
2016-03-03 04:10:39 -08:00
Sokovikov 1bab7c5182 vibration module
Summary:I will fix other notes from https://github.com/facebook/react-native/pull/2794 if I get positive feedback.
Closes https://github.com/facebook/react-native/pull/6061

Reviewed By: nicklockwood

Differential Revision: D2982173

Pulled By: dmmiller

fb-gh-sync-id: d1e9407798b0293b090897a10996085b0f0c1b3e
shipit-source-id: d1e9407798b0293b090897a10996085b0f0c1b3e
2016-03-03 04:08:31 -08:00
Dan Caspi d2d00e0fcd Adding GC Timer Sweeping to Android
Reviewed By: mhahnenberg

Differential Revision: D2972822

fb-gh-sync-id: b0ed28c26e3f1141c798d9d107d9e198611f9dce
shipit-source-id: b0ed28c26e3f1141c798d9d107d9e198611f9dce
2016-03-03 04:05:59 -08:00
Michał Gregorczyk 5a6a94b05a sync fbjni
Differential Revision: D2990551

fb-gh-sync-id: 587f2b5cd09295dc1829926c12e38f2880440a5e
shipit-source-id: 587f2b5cd09295dc1829926c12e38f2880440a5e
2016-03-02 07:24:40 -08:00
Michał Gregorczyk 5df3eeb723 Force 16 byte stack alignment on JNI method invocations on x86
Reviewed By: dcolascione

Differential Revision: D2989293

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

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

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

Differential Revision: D3000042

Pulled By: mkonicek

fb-gh-sync-id: 7f01270580b198498505d92e38a456c0b3a01488
shipit-source-id: 7f01270580b198498505d92e38a456c0b3a01488
2016-03-02 07:07:32 -08:00
Konstantin Raev f827f7b79a instrumentation tests are executed with BUCK
Summary:Added ability to run instrumentation tests with BUCK.

This change uses BUCK to build and run instrumentation tests facebook style.
The gains are that we can execute the same tests internally at FB and in OSS.
Also running tests not via graddle:connect command is 1.5 minutes faster.

I'll keep keep an eye on stability Gradle and BUCK builds for a while.
Closes https://github.com/facebook/react-native/pull/6176

Differential Revision: D2999878

Pulled By: bestander

fb-gh-sync-id: d715ba231769e57100685a1256f2e530c589921c
shipit-source-id: d715ba231769e57100685a1256f2e530c589921c
2016-03-02 06:55:35 -08:00
Konstantin Raev 00178b7b36 Added prebuilt folder with BUCK files to support BUCK run of ReactAndroid in OSS
This is a manualt sync of a folder from fbsource that was previously in ignored list
2016-03-02 11:09:31 +00:00
Andy Street bd95b22844 WebWorkers: Add ExecutorToken to route native module calls to/from workers
Summary:To support native modules in web workers, native modules need to have an notion of the JS executor/thread that called into them in order to respond via Callback or JS module call to the right executor on the right thread.

ExecutorToken is an object that only serves as a token that can be used to identify an executor/message queue thread in the bridge. It doesn't expose any methods. Native modules Callback objects automatically have this ExecutionContext attached -- JSModule calls for modules that support workers will need to supply an appropriate ExecutorToken when retrieving the JSModule implementation from the ReactContext.

Reviewed By: mhorowitz

Differential Revision: D2965458

fb-gh-sync-id: 6e354d4df8536d40b12d02bd055f6d06b4ca595d
shipit-source-id: 6e354d4df8536d40b12d02bd055f6d06b4ca595d
2016-03-01 07:57:35 -08:00
Andy Street 58f86b2d91 Don't execute things that may throw in Bridge/JSCExecutor dtors
Summary:In testing, I've found that there's no good way to return stack traces to the server for exceptions that happen in dtor's. If the dtor is not marked nothrow(false), the exceptions are uncatchable (and bubble up as a std::abort without exception info) and if annotated properly, the program instead crashes trying to resume the stack, again a std::abort without exception info.

Instead, I created a separate destroy method that can be called (and protected via fbjni) to make the dtor's no longer execute code that may throw. Note that we don't really expect the code that was previously in ~JSCExecutor() to throw, but it was in production and we had absolutely no info to help debug it.

Reviewed By: mhorowitz

Differential Revision: D2989999

fb-gh-sync-id: 4cf9de5e0592fe6830a9903375363a78e1339a94
shipit-source-id: 4cf9de5e0592fe6830a9903375363a78e1339a94
2016-03-01 04:26:35 -08:00
Ahmed El-Helw 9be1216c7f Minor code improvements for RCTTextInput
Summary: Expose hasUnseenUpdates in ReactShadowNode. Various text input cleanup and fixes.

Differential Revision: D2975870

fb-gh-sync-id: 26c4c0d36e82aaa025b4760603cc48c47ebf46a3
shipit-source-id: 26c4c0d36e82aaa025b4760603cc48c47ebf46a3
2016-02-29 16:43:32 -08:00
Chris Hopman e55cefc476 Add log message to bridge init
Reviewed By: mhorowitz

Differential Revision: D2983352

fb-gh-sync-id: d87fcb7d7728115ae45cdb6f061fa094da7dfba8
shipit-source-id: d87fcb7d7728115ae45cdb6f061fa094da7dfba8
2016-02-29 12:49:01 -08:00
Andy Street f99579adaa Try/catch exceptions in JSCExecutor for debugging crash
Reviewed By: lexs

Differential Revision: D2982534

fb-gh-sync-id: 4eda4116cd60e2e46771ecddefc1d27eee761762
shipit-source-id: 4eda4116cd60e2e46771ecddefc1d27eee761762
2016-02-26 10:58:29 -08:00
Andy Street f420f811c5 Revert D2982150: Revert D2926896 WebWorkers: Move web worker impl to JSCExecutor
Reviewed By: lexs

Differential Revision: D2982364

fb-gh-sync-id: 25f099377acca75298768072d38d77dcb9c1bff3
shipit-source-id: 25f099377acca75298768072d38d77dcb9c1bff3
2016-02-26 08:43:36 -08:00
Dave Miller 9edfd945d1 Fix minor code nit from D2977441
Reviewed By: andreicoman11

Differential Revision: D2982182

fb-gh-sync-id: dba3c6ea0dfbd375e3c27d3ad2ba3481d05e06e8
shipit-source-id: dba3c6ea0dfbd375e3c27d3ad2ba3481d05e06e8
2016-02-26 06:46:35 -08:00
Felix Oghina 9baef48498 decouple textview from fresco
Reviewed By: andreicoman11

Differential Revision: D2960626

fb-gh-sync-id: c03aa7f16cdea795cefe39da2c5d660ae6278a37
shipit-source-id: c03aa7f16cdea795cefe39da2c5d660ae6278a37
2016-02-26 06:16:49 -08:00
Andy Street c32e5fd84f Revert D2926896 WebWorkers: Move web worker impl to JSCExecutor
Reviewed By: lexs

Differential Revision: D2982150

fb-gh-sync-id: c75d05988df50b9788608e7c1bf00c4952ccfce1
shipit-source-id: c75d05988df50b9788608e7c1bf00c4952ccfce1
2016-02-26 05:56:36 -08:00
Andrei Coman d032cc967d Pass jsc config to JSC
Reviewed By: astreet

Differential Revision: D2965497

fb-gh-sync-id: 1aef5a1f2d7ccb8de8ca403e51ebcf247bd6b034
shipit-source-id: 1aef5a1f2d7ccb8de8ca403e51ebcf247bd6b034
2016-02-26 03:24:36 -08:00
Dave Miller 542432fc3e Launch a new task if openURL is called with a url in a different package
Summary: Change the default handling of openURL to attach the NEW_TASK flag if the package we will be launching is different than the currently running package.

Reviewed By: foghina

Differential Revision: D2977441

fb-gh-sync-id: 01d1ac1d791345f815bfc9e8358bce6420c08c1b
shipit-source-id: 01d1ac1d791345f815bfc9e8358bce6420c08c1b
2016-02-26 03:12:32 -08:00
Matthew Denner b860897cd5 Restore canvas once group has been drawn
Summary:The implementation of ARTGroupShadowNode saved the canvas and then drew the child nodes but did not reset the canvas afterwards, unlike the behaviour of the other ART shadow nodes.  Because of this the matrix operations were compounded for sibling nodes in the surface.

As an example the following code should draw a green circle in the bottom right corner of the surface and a red circle in the top left, which it does on iOS; on Android you'll find that the red circle is drawn in the bottom right corner instead.

```
'use strict';
import React, {
  AppRegistry,
  Component,
  StyleSheet,
  View,
} from 'react-native';

const { Surface, Group, Shape } = React.ART;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#808080',
  },
  surface: {
    backgroundColor: '#ffffff'
  },
});

class ARTGroupBug extends Component {
  render() {
    return (
      <View style={styles.container}>
        <
Closes https://github.com/facebook/react-native/pull/5619

Differential Revision: D2981865

Pulled By: spicyj

fb-gh-sync-id: 95ca701354fe728ed6ee78f8c02d1e1eb70c181e
shipit-source-id: 95ca701354fe728ed6ee78f8c02d1e1eb70c181e
2016-02-26 00:42:33 -08:00
AbilashK 8b88cae747 Fix android's image tintColor prop when used with alpha
Summary:Fixes https://github.com/facebook/react-native/issues/6075
UIExplorer example has been tested with 4 levels of opacity(100,75,50,25)

![selection_029](https://cloud.githubusercontent.com/assets/11550281/13228124/31c85dcc-d9c0-11e5-90e3-3938e155d5a2.png)
Closes https://github.com/facebook/react-native/pull/6090

Differential Revision: D2979913

Pulled By: mkonicek

fb-gh-sync-id: ff30dec853935a059979096d9b1da9088d146249
shipit-source-id: ff30dec853935a059979096d9b1da9088d146249
2016-02-25 17:16:02 -08:00
Konstantin Raev 5112a63953 Added ability to run Movies app with BUCK
Reviewed By: mkonicek

Differential Revision: D2874873

fb-gh-sync-id: 9feface8d9a18742e68206dbafb804de25f53ed8
shipit-source-id: 9feface8d9a18742e68206dbafb804de25f53ed8
2016-02-25 17:15:58 -08:00
Martin Konicek 9d3d9dfbce Make fbsource and GitHub consistent 2016-02-25 17:13:25 -08:00
Ahmed El-Helw 652c1c11e4 Fix incorrect MeasureSpec in ReactTextInputShadowNode
Summary:WRAP_CONTENT is not a valid size for MeasureSpec. While 0 is
a valid value size to pass to makeMeasureSpec, it's slightly cheaper to just
pass in 0 instead since makeMeasureSpec(0, UNSPECIFIED) is 0 anyway.

Differential Revision: D2968322

fb-gh-sync-id: 2ca0e27b12c1a8263800d96fec32127a4b967497
shipit-source-id: 2ca0e27b12c1a8263800d96fec32127a4b967497
2016-02-25 16:27:32 -08:00
Alexander Blom b8e7fe4959 Copy exif data when resizing images in ImageEditingManager
Summary:Previously images that have exif orientation data would be cropped and the exif data
would be lost leading to us displaying pictures rotated in error.

Reviewed By: foghina

Differential Revision: D2971596

fb-gh-sync-id: 40f92e27089455259a7d8b83c92d0cf36367e5df
shipit-source-id: 40f92e27089455259a7d8b83c92d0cf36367e5df
2016-02-25 07:46:39 -08:00
Ahmed El-Helw 6b80f11652 Add switch for enabling nodes screenshot tests
Summary: Allow customizing the UIImplementation passed in to loadApp.

Differential Revision: D2975785

fb-gh-sync-id: 2ce081fb488b78c0c91fcebe6a37dac4f587a467
shipit-source-id: 2ce081fb488b78c0c91fcebe6a37dac4f587a467
2016-02-24 21:13:35 -08:00
Michał Gregorczyk 9836b297ad Align stack on all JSC API calls
Reviewed By: astreet

Differential Revision: D2971504

fb-gh-sync-id: 4f2cb5924c135aa39853e6746b0a35e30f3e93a4
shipit-source-id: 4f2cb5924c135aa39853e6746b0a35e30f3e93a4
2016-02-24 13:00:41 -08:00
Andrei Coman 36400807ab Remove unused variable
Reviewed By: bestander

Differential Revision: D2971225

fb-gh-sync-id: 827d4403d436ec74043e2dde02e19513f7bf811f
shipit-source-id: 827d4403d436ec74043e2dde02e19513f7bf811f
2016-02-24 10:49:33 -08:00
Jason Sendros f538032888 Sync CSSLayout: Make 'stretch' aligned children fill cross-axis in containers of undefined size in the cross-axis
Reviewed By: lucasr

Differential Revision: D2971032

fb-gh-sync-id: 90ec286ca2070d666571fd3d0db4037bc9d3cda7
shipit-source-id: 90ec286ca2070d666571fd3d0db4037bc9d3cda7
2016-02-24 08:57:37 -08:00
Andrei Coman 936b5e794b Backed out changeset fe59b7f7c7da
Reviewed By: javache

Differential Revision: D2971309

fb-gh-sync-id: 0104f5499d32e0a4e4bd24128c58a9ee4aa7ca4e
shipit-source-id: 0104f5499d32e0a4e4bd24128c58a9ee4aa7ca4e
2016-02-24 08:39:35 -08:00
Andreas Drivenes ec173b1a17 Add drawerLockMode prop to DrawerLayoutAndroid
Summary:Closes #5270.
Closes https://github.com/facebook/react-native/pull/5534

Differential Revision: D2970771

fb-gh-sync-id: 36a814032283df7d4c469964f803b8d20d1b0c93
shipit-source-id: 36a814032283df7d4c469964f803b8d20d1b0c93
2016-02-24 03:25:30 -08:00
Chris Hopman 11843fd10e Initialize glog in react native.
Reviewed By: mhorowitz

Differential Revision: D2967180

fb-gh-sync-id: fe59b7f7c7dab8b5e7f3a449e72b467e1c2c2c67
shipit-source-id: fe59b7f7c7dab8b5e7f3a449e72b467e1c2c2c67
2016-02-24 02:18:28 -08:00
Andy Street 7176c5291e Dispatch JS calls to JS thread from c++ bridge
Summary: Instead of dispatching calls to the JS thread in Java, do it in the C++ bridge. This moves us closer to the cxx bridge and will allow us to dispatch to the correct web worker in C++ instead of in Java

Reviewed By: mhorowitz

Differential Revision: D2954115

fb-gh-sync-id: 7e7d4eff2c72601b8b4416f1ccd8d2985aebd755
shipit-source-id: 7e7d4eff2c72601b8b4416f1ccd8d2985aebd755
2016-02-23 10:59:00 -08:00
Mark Hahnenberg c17428e9d2 Schedule memory pressure handlers onto JS queue thread
Reviewed By: lexs

Differential Revision: D2940927

fb-gh-sync-id: 2556925194a753a33f039dc841a4001d7ede2bce
shipit-source-id: 2556925194a753a33f039dc841a4001d7ede2bce
2016-02-22 07:46:28 -08:00
Andy Street 5534f8b7c7 Fix instacrash on login in rnfeed
Summary:build-break

Proguard was renaming MessageQueueThread interface methods that we reference from c++.

Differential Revision: D2960332

fb-gh-sync-id: 572dcd8a64e774f65c5abfb8cdf891efcb2bd591
shipit-source-id: 572dcd8a64e774f65c5abfb8cdf891efcb2bd591
2016-02-22 06:03:33 -08:00
Konstantin Raev 26a7335d4d Backed out changeset 837af947846b
Reviewed By: astreet

Differential Revision: D2960159

fb-gh-sync-id: ec8df9c2f7213879470482b77346b3872c26413d
shipit-source-id: ec8df9c2f7213879470482b77346b3872c26413d
2016-02-22 03:58:30 -08:00
Andrei Coman b5d26679c4 Use nanoTime instead of currentTimeMillis for events
Reviewed By: foghina

Differential Revision: D2953917

fb-gh-sync-id: effd09849a5504c9eb7c684a510e616fdcfcdf6e
shipit-source-id: effd09849a5504c9eb7c684a510e616fdcfcdf6e
2016-02-22 03:26:32 -08:00
Janic Duplessis cf3bd9f9a1 Fix hidden StatusBar reappearing after exiting app on Android
Summary:I changed the technique used to hide the status bar and now it works properly. Also changed the way flags are set on the decorView to make sure it doesn't cause issues with other flags already set and fix deprecated Promise.reject

**Test plan**
Test using the UIExplorer StatusBar example, change the `hidden` prop value and go in and out of the app making sure the status bar has the right visibility.

Fixes #5991
Closes https://github.com/facebook/react-native/pull/6051

Differential Revision: D2960060

Pulled By: nicklockwood

fb-gh-sync-id: ee1c541896f5771d27cfd3ff18537edb6c017284
shipit-source-id: ee1c541896f5771d27cfd3ff18537edb6c017284
2016-02-22 01:50:29 -08:00
Chris Hopman 9294c6f5d4 Initialize glog in react native.
Reviewed By: astreet

Differential Revision: D2931172

fb-gh-sync-id: 837af947846ba862f7e82110771a680f6991342f
shipit-source-id: 837af947846ba862f7e82110771a680f6991342f
2016-02-19 16:25:27 -08:00
Konstantin Raev 54a423e466 fixed master branch
Summary:shame to astreet and glory circle ci
Closes https://github.com/facebook/react-native/pull/6038

Differential Revision: D2954377

fb-gh-sync-id: cda4f1e4d46c5a477756131a4c65a9430cd3cd95
shipit-source-id: cda4f1e4d46c5a477756131a4c65a9430cd3cd95
2016-02-19 15:13:51 -08:00
Andy Street 2b251638a6 WebWorkers: Allow web worker owner to inject globals into worker, supply modified __fbBatchedBridgeConfig
Summary: Now that web workers are just JSCExecutors, we can move forward with adding native module support. The means we need to supply the worker with a correct __fbBatchedBridgeConfig global so it can appropriately set up its JS MessageQueue. Unfortunately, native modules can't support multiple JS execution contexts out-of-the-box, so we need to whitelist those modules that actually can be referenced from a webworker. In order to do that, we add the supportsWebWorkers call in NativeModule and the SupportsWebWorkers annotation for JS modules. These add metadata to __fbBatchedBridgeConfig which allows us to create a new config with only those modules that support web workers.

Reviewed By: lexs

Differential Revision: D2927091

fb-gh-sync-id: 9b47331253b277940b552e7d899198b5f0a3ed8c
shipit-source-id: 9b47331253b277940b552e7d899198b5f0a3ed8c
2016-02-19 08:22:37 -08:00
Andy Street febb1fbe13 WebWorkers: Move web worker impl to JSCExecutor
Summary: Part of the plan to make web workers able to call native modules. We will reuse the infrastructure already present in JSCExecutor to allow web workers to call native modules via the Bridge.

Reviewed By: mhorowitz

Differential Revision: D2926896

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

Differential Revision: D2953940

Pulled By: nicklockwood

fb-gh-sync-id: 012769f3a2a3f7dc942b60de02a9d1b80a27236e
shipit-source-id: 012769f3a2a3f7dc942b60de02a9d1b80a27236e
2016-02-19 06:28:34 -08:00
Felix Oghina 19a1c4c229 use a static react instance holder
Reviewed By: astreet

Differential Revision: D2937867

fb-gh-sync-id: cdda79929fa5993b6ef159aa73922909017c2ded
shipit-source-id: cdda79929fa5993b6ef159aa73922909017c2ded
2016-02-19 05:07:34 -08:00
Konstantin Raev 0107d1a67b manual sync for D2949054 2016-02-19 11:43:54 +00:00
Huang Yu a6a4389bf4 add the ability to create triangles using css tricks
Summary:- modify ReactViewBackgroundDrawable.java to make each border a trapezoid
 - disable anti-alias to eliminate white spaces between borders
 - add examples to BorderExample.js (see last one)
Closes https://github.com/facebook/react-native/pull/5911

Differential Revision: D2953734

Pulled By: dmmiller

fb-gh-sync-id: dd103d80dec53ad35c9539ab1ceb93ef857feeb9
shipit-source-id: dd103d80dec53ad35c9539ab1ceb93ef857feeb9
2016-02-19 02:59:30 -08:00
Al Sutton 8956915ab1 Move appcompat-orig alongside fork
Reviewed By: bestander

Differential Revision: D2949054

fb-gh-sync-id: d1efc1814d82fdd3c93d08bae469ec815e51c028
shipit-source-id: d1efc1814d82fdd3c93d08bae469ec815e51c028
2016-02-18 09:04:38 -08:00
Al Sutton 449d4d4edd Remove old android support library version
Differential Revision: D2943730

fb-gh-sync-id: 61a5981efe8c15594bcf7d3369cc24261894ef0b
shipit-source-id: 61a5981efe8c15594bcf7d3369cc24261894ef0b
2016-02-18 01:09:33 -08:00
Dave Miller b26f699c9a Add measureInWindow on Android
Summary:public
This adds the capability to get a View in absolute position on the screen, not just relative to the RootView.  This is the Android implementation

Reviewed By: andreicoman11

Differential Revision: D2939170

fb-gh-sync-id: 658f1ebe6a458088f657a7469389add1a12222cd
shipit-source-id: 658f1ebe6a458088f657a7469389add1a12222cd
2016-02-17 08:31:33 -08:00
Chris Hopman 1e8991aa80 Add android ndk dep
Reviewed By: astreet

Differential Revision: D2943695

fb-gh-sync-id: a444b2506b7aadd200f5cd0fef626ce7fe66c660
shipit-source-id: a444b2506b7aadd200f5cd0fef626ce7fe66c660
2016-02-17 04:08:34 -08:00
Hedger Wang 011dc8904f Unbreak master build.
Summary:public

== cause ==

The follow block is error-prone.

```
 for (ReactInstanceEventListener listener : mReactInstanceEventListeners) {
   listener.onReactContextInitialized(reactContext);
 }
```

Because calling `listener.onReactContextInitialized` may have side-effect that
removes the `listener` from `mReactInstanceEventListeners`, thus break the
iteration with exception.

I've found at least one place that has such side-effect
diffusion/FA/browse/master/java/com/facebook/fbreact/autoupdater/AutoUpdaterScheduler.java;9c09e5bbd411e093fb2ad022ee5d0ea473e9ebfe$32

The right way to fix this is to be side-effect proof.

Reviewed By: zahanm

Differential Revision: D2943494

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

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

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

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

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

Differential Revision: D2941671

Pulled By: androidtrunkagent

fb-gh-sync-id: 07e3eb8b6a36eebf76968fdaac3c6ac335603194
shipit-source-id: 07e3eb8b6a36eebf76968fdaac3c6ac335603194
2016-02-16 16:51:39 -08:00
Felix Oghina 07a5f4407f add removeReactInstanceEventListener and call it from onDestroy
Reviewed By: zahanm

Differential Revision: D2937547

fb-gh-sync-id: 95461fdada8ac86d2c4174dae7023c97a3101e2e
shipit-source-id: 95461fdada8ac86d2c4174dae7023c97a3101e2e
2016-02-16 12:16:11 -08:00
Andy Street e1fed608e8 Fix double-destruct of string on syntax error
Reviewed By: davidaurelio

Differential Revision: D2939260

fb-gh-sync-id: b080b70aae7e33297d549d387e40bde07f4fc765
shipit-source-id: b080b70aae7e33297d549d387e40bde07f4fc765
2016-02-16 10:56:45 -08:00
Satyajit Sahoo 14ec6f011e Use promises in 'NetInfo'
Reviewed By: svcscm

Differential Revision: D2938010

fb-gh-sync-id: 4a24ce680b37e49759f3325987b4b440eb033b94
shipit-source-id: 4a24ce680b37e49759f3325987b4b440eb033b94
2016-02-15 13:34:33 -08:00
Scott Kyle e5ba46c30d Expose way for native modules to modify JSC context
Reviewed By: svcscm

Differential Revision: D2933197

fb-gh-sync-id: 32eb943ab341804343bbcadd29f0377fccf75de6
shipit-source-id: 32eb943ab341804343bbcadd29f0377fccf75de6
2016-02-15 12:58:29 -08:00
Ahmed El-Helw dfacb6c8f2 Fix TextInput in React Nodes
Reviewed By: dkoroskin

Differential Revision: D2930800

fb-gh-sync-id: 072d573b29061fb61744a20a459292e271998e8d
shipit-source-id: 072d573b29061fb61744a20a459292e271998e8d
2016-02-12 20:17:30 -08:00
Andy Street 9547264a96 WebWorkers: Rename Bridge.m_jsExecutor -> Bridge.m_mainExecutor
Reviewed By: cjhopman

Differential Revision: D2921994

fb-gh-sync-id: ec06b922264a443932eb0446ff820aaf3dcacaa7
shipit-source-id: ec06b922264a443932eb0446ff820aaf3dcacaa7
2016-02-12 09:10:52 -08:00
Andy Street 0de8860a46 Rename executeApplicationScript -> loadApplicationScript
Reviewed By: davidaurelio

Differential Revision: D2921959

fb-gh-sync-id: 5bf44f5d037f2341000070f59309df0fab72aa29
shipit-source-id: 5bf44f5d037f2341000070f59309df0fab72aa29
2016-02-12 09:10:46 -08:00
Andy Street cf7a97cc0f WebWorkers: Pass Bridge to JSExecutors
Reviewed By: cjhopman

Differential Revision: D2921840

fb-gh-sync-id: f89f9ffe2c3bb0dabce7e8cbb9c7dc8b5062e267
shipit-source-id: f89f9ffe2c3bb0dabce7e8cbb9c7dc8b5062e267
2016-02-12 09:10:39 -08:00
Adam Miskiewicz e018aa3100 Enable HMR
Reviewed By: svcscm

Differential Revision: D2932137

fb-gh-sync-id: 8bfab09aaac22ae498ac4fa896eee495111abc0d
shipit-source-id: 8bfab09aaac22ae498ac4fa896eee495111abc0d
2016-02-12 08:10:33 -08:00
Sreejumon a7521a23ae Created empty requestBody to solve the issue - "POST has no body"
Reviewed By: svcscm

Differential Revision: D2931739

fb-gh-sync-id: 04b6f59c257a35e4638c4c8f00bbffb34666145f
shipit-source-id: 04b6f59c257a35e4638c4c8f00bbffb34666145f
2016-02-12 04:51:33 -08:00
Olivier Notteghem 3e72211cab fix 'create' animation pivot to be relative to center of component
Reviewed By: sahrens

Differential Revision: D2931318

fb-gh-sync-id: b95ab0b5631f1780dab065b58340f25a274d0df9
shipit-source-id: b95ab0b5631f1780dab065b58340f25a274d0df9
2016-02-12 00:12:34 -08:00
Olivier Notteghem 065106678f Reset the animation config at the end of each batch
Reviewed By: sahrens

Differential Revision: D2931343

fb-gh-sync-id: 702b1df543fbdb9b244eb6cc2ce4d8557471004f
shipit-source-id: 702b1df543fbdb9b244eb6cc2ce4d8557471004f
2016-02-12 00:05:35 -08:00
Felix Oghina 8720d4bc76 strip devsupport from prod builds
Reviewed By: zen

Differential Revision: D2912192

fb-gh-sync-id: ff89fc16dcd86481657197055e31d2b67a94e7ea
shipit-source-id: ff89fc16dcd86481657197055e31d2b67a94e7ea
2016-02-11 13:34:37 -08:00
Andrei Coman 228a1fe7d4 Expose screen metrics and window metrics
Summary:
public
https://github.com/facebook/react-native/pull/4935 changed the window dimensions for android by replacing them with the actual screen dimensions. This changes the window dimensions back to their original values and adds `Dimensions.get('screen')` for the actual screen dimensions of the device.

Reviewed By: astreet

Differential Revision: D2921584

fb-gh-sync-id: 5d2677029c71d50691691dc651a11e9c8b115e8f
shipit-source-id: 5d2677029c71d50691691dc651a11e9c8b115e8f
2016-02-11 06:33:36 -08:00
Felix Oghina 0b89b18b1b format exceptions correctly when crashing
Reviewed By: ivank

Differential Revision: D2921881

fb-gh-sync-id: bd35ada33c752877dd3f6274ed8d4b4b7c851b9a
shipit-source-id: bd35ada33c752877dd3f6274ed8d4b4b7c851b9a
2016-02-11 04:37:28 -08:00
Adam Miskiewicz f2a60a202f Add 'file://' prefix to sourceURL when loading a script from a file.
Reviewed By: svcscm

Differential Revision: D2922108

Pulled By: androidtrunkagent

fb-gh-sync-id: d9c98af31e844e3fed2f57a3a4250a6ef5e735a8
shipit-source-id: d9c98af31e844e3fed2f57a3a4250a6ef5e735a8
2016-02-10 12:26:00 -08:00
Andy Street bab48182d9 Add Object.getPropertyNames() and Object.toJSONMap APIs
Summary:
Adds APIs to get all the enumerable property names of an object and to get an object as a map of property names to JSON values.

public

Reviewed By: lexs

Differential Revision: D2916238

fb-gh-sync-id: 0d9ee1eb4886d58fba8241537f6a0dad6024bd0e
shipit-source-id: 0d9ee1eb4886d58fba8241537f6a0dad6024bd0e
2016-02-10 08:14:35 -08:00
Andreas Stütz 142f8c92de Fixed icon handling
Summary:
[This commit](e730a9fdd0) (_Load assets from same folder as JSbundle (Android)_) causes React Native to look for assets inside the same folder the JSBundle was loaded from and generates asset URIs containing the absolute path to the asset (e.g. _/sdcard/bundle/drawable-xxhdpi/ic_back.png_).

While this is fine for a normal `ImageView`, `ToolbarAndroid`/`ReactToolbar` currently crashes if the icons are located on the file system. This happens because when setting an icon on `ReactToolbar`, Fresco is only used if the icon URI contains `http:// `or `https://`. For all other cases (like in this case where it starts with `file://`), the view tries to load the Drawable from the Android App Resources by it's name (which in this case is an absolute file-URI) and therefore causes it to crash (`getDrawableResourceByName` returns 0 if the Drawable was not found, then `getResources().getDrawable(DrawableRes int id)` throws an Exception if th
Closes https://github.com/facebook/react-native/pull/5753

Reviewed By: svcscm

Differential Revision: D2921418

Pulled By: foghina

fb-gh-sync-id: 7a3f81b530a8c1530e98e7b592ee7e44c8f19df1
shipit-source-id: 7a3f81b530a8c1530e98e7b592ee7e44c8f19df1
2016-02-10 05:01:35 -08:00
Chris Hopman d80ee0a8ac Clean up some includes/dependencies
Reviewed By: astreet

Differential Revision: D2905196

fb-gh-sync-id: d92f0e0296f4877b589cac674e388a5dbabc7d71
shipit-source-id: d92f0e0296f4877b589cac674e388a5dbabc7d71
2016-02-09 13:02:04 -08:00
Chris Hopman 48f82e4e2b Use our own noncopyable in react/
Reviewed By: astreet

Differential Revision: D2905195

fb-gh-sync-id: feede5288ef2d5de9dbd9802280e51f8782070ec
shipit-source-id: feede5288ef2d5de9dbd9802280e51f8782070ec
2016-02-09 13:01:59 -08:00
Chris Hopman 7cda49d516 Use c++ exceptions in react/
Reviewed By: astreet

Differential Revision: D2905193

fb-gh-sync-id: ddb4c615ede606e99c92a09a96a15141b912ef72
shipit-source-id: ddb4c615ede606e99c92a09a96a15141b912ef72
2016-02-09 13:01:52 -08:00
Chris Hopman 229c8c35c9 Remove jni dependencies from Bridge.h/cpp
Reviewed By: astreet

Differential Revision: D2905191

fb-gh-sync-id: 7510ef1d1b87ff50f35195d5ca8c0dd98f81526f
shipit-source-id: 7510ef1d1b87ff50f35195d5ca8c0dd98f81526f
2016-02-09 13:01:44 -08:00
Krzysztof Magiera 788e25894e Move SimpleArray and SimpleMap from test to src.
Summary:
As a part of this change I'm also renaming SimpleArray to JavaOnlyArray and SimpleMap to JavaOnlyMap. The main reason for the change is to support use-cases such as driving animations form the native code. In the case of native "animated" I'd like to be able to use the same interface as JS is using for updating the View properties. As view setters can take ReadableMap and ReadableArray as an argument in some cases it is necessary to create and pass those types to the setter. Using WritableNativeArray and WritableNativeMap for this purpose seems to me like a misuse and IMO will be less performant (vs java-only map/array) as those implementations of ReadableMap and ReadableArray proxies all their methods through JNI.

I'm also adding some additional class-level comments for the moved classes to avoid confusion and hopefuly prevent people from using those classess accidentally while writing native modules or methods that calls to JS.
Closes https://github.com/facebook/react-native/pull/5816

Reviewed By: svcscm

Differential Revision: D2911339

Pulled By: foghina

fb-gh-sync-id: 5b9a98d64f48d8bba34c15e3eecba2151da3577a
shipit-source-id: 5b9a98d64f48d8bba34c15e3eecba2151da3577a
2016-02-09 08:18:21 -08:00
Andrei Coman 5a109ae43b Make keyboard detection more robust
Reviewed By: nspaun

Differential Revision: D2905647

fb-gh-sync-id: 0bd5405f32a5e63c9f85178b4d1f777fe032f8d5
2016-02-08 11:46:39 -08:00
Andrei Coman 4254e8a0a9 Fix DisplayMetrics KeyboardListener dependency
Summary:
public
KeyboardListener needs DisplayMetrics to be initialized when it is attached. At
the moment, this breaks easily whenever we change these components, since DisplayMetrics are intialized
in a module and KeyboardListener is created eagerly in ReactRootView, whereas
ReactRootView can exist without the instance.
This changes to create DisplayMetrics as soon as possible, when the react
instance is built. The KeyboardListener is created and attached after the ReactRootView is
attached to an existing instance, point at which DisplayMetrics have to be
initialized.

Reviewed By: dmmiller

Differential Revision: D2911351

fb-gh-sync-id: 64d1805c5d5b2f6876adb694b565a2df059b381d
2016-02-08 11:46:32 -08:00
mattds 4937a4c5cd Added support for corner radii in Android
Summary:
This is a cut down version of a previous pull request with just the 4 corners catered for.
Closes https://github.com/facebook/react-native/pull/4252

Reviewed By: svcscm

Differential Revision: D2911959

Pulled By: androidtrunkagent

fb-gh-sync-id: 7ddcd684d90d4d92ccefed906c0126e92818dcde
2016-02-08 10:43:35 -08:00
sospartan 17fcc9440f allow use external typeface in native code
Summary:
Expose method to implement changing font family cache.  Like ide suggested in #4420 , this will helpful for using remote font file (use `Typeface#createFromFile` to load downloaded font file).
iOS's CoreText  already allow this in native code.
Closes https://github.com/facebook/react-native/pull/4696

Reviewed By: bestander

Differential Revision: D2911762

Pulled By: andreicoman11

fb-gh-sync-id: a931e2e711dd94fa0df6fdd066827756d862a4ba
2016-02-08 10:10:32 -08:00
Charles Dick 81dc884b2a cwdick: add better error messages on js bundle downloads
Reviewed By: foghina

Differential Revision: D2845168

fb-gh-sync-id: 4566eeff0181d5ae6045e7aeaf00b91579a01feb
2016-02-08 03:17:33 -08:00
Janic Duplessis 3e1f1ea7bb Allows RefreshControl to be mounted with refreshing = true
Summary:
RefreshControl did not start refreshing when refreshing was set to true initially. It also did not start refreshing on iOS when setting the prop from false to true without doing a pull to refresh gesture.

This was a pain in the ass to make work on iOS because UIRefreshControl seems super sensitive to when beginRefreshing can be called, for the initial render I need to call it in layoutSubviews. I also have to manually adjust the scrollview content offset when calling beginRefreshing. The code is a bit hacky but it was the only solution I found that was actually working.

Fixes #5716
Closes https://github.com/facebook/react-native/pull/5745

Reviewed By: svcscm

Differential Revision: D2910716

Pulled By: nicklockwood

fb-gh-sync-id: d60e73bcfe8d86bb01249ba5f17e6a23c5a5aff6
2016-02-07 13:40:29 -08:00
Janic Duplessis 62440b86b0 Fix jni build with gradle
Summary:
fc94f1e6d0 and the following commits introduced some changes to the jni build but only changed the BUCK build files and not the gradle ones. This ports the changes to the gradle build files to fix the build.
Closes https://github.com/facebook/react-native/pull/5791

Reviewed By: svcscm

Differential Revision: D2910012

Pulled By: vjeux

fb-gh-sync-id: b6c7edfed6873d501e46e80a0c9f128d9df04ca4
2016-02-06 14:04:04 -08:00
Chris Hopman cc926211b6 Move implementation of extracting bundles from assets to react/jni
Summary:
Splits JSModulesUnbundle into interface+implementation.

public

Reviewed By: astreet

Differential Revision: D2905186

fb-gh-sync-id: 3e621f7a7239d3f1e730334da2fe7cbeb17a1de4
2016-02-05 18:12:16 -08:00
Chris Hopman 52fcfc31cd Move creation of web worker threads into react/jni
Summary:
Injects implementation into react/

public

Reviewed By: astreet

Differential Revision: D2905183

fb-gh-sync-id: 3ea6aaf50aabc1faae4e7a93fe92e02b033407e8
2016-02-05 18:12:09 -08:00
Chris Hopman f4b826d6a0 Add MessageQueueThread interface to react/
Summary:
Everything below the bridge interacts with just a MessageQueueThread. The implementation (JMessageQueueThread) is injected from react/jni.

public

Reviewed By: astreet

Differential Revision: D2905178

fb-gh-sync-id: 8b138e746d5a96dd70837bb2149cd4e188fcdacc
2016-02-05 18:12:02 -08:00
Chris Hopman 2997c8feed Move getting the cache dir into react/jni
Summary:
This just moves the jni code that actual figures out the cache dir into OnLoad.cpp and then passes it down to the JSCEXecutorFactory.

public

Reviewed By: astreet

Differential Revision: D2905176

fb-gh-sync-id: bedf52fbeaab6beabac25c87aad00a98ddf182f7
2016-02-05 18:11:53 -08:00
Chris Hopman 75ca46e332 Inject some behavior from react/jni/ to react/
Summary:
So, this makes it so a set of behaviors that require accessing java can be injected from the jni/ folder. The behaviors are logging, perf logging, log markers and loading script from assets.

I'd argue that these should all actually be encapsulated by interfaces that are passed to the JSCExecutor/others (and I'd say that's regardless of whether they are injected from jni/ or not), but I wanted to stick to the least disruptive pattern for these changes.

public

Reviewed By: astreet

Differential Revision: D2905168

fb-gh-sync-id: 7c8c16cb77b8fc3d42750dacc6574259ad512ac2
2016-02-05 18:11:44 -08:00
Chris Hopman 2c8802f316 Make JSExecutorFactory not derive from fbjni::Countable
Summary:
This adds a CountableJSExecutorFactory that derives from Countable. And uses that. Basically it allows code that doesn't need to know about jni or Countable not depend on it.
public

Reviewed By: astreet

Differential Revision: D2905163

fb-gh-sync-id: f2bfd5589a3185bb175ad51660b17be08ba62424
2016-02-05 18:10:55 -08:00
Chris Hopman fc94f1e6d0 Update ReactAndroid/main/jni/react to use glog for logging
Summary:
Updates uses of FBLOG* and FBASSERT* to their glog equivalents.

public

Reviewed By: astreet

Differential Revision: D2905159

fb-gh-sync-id: 1f916283aa3de68d8469c8d4ca7fa0874cec28ef
2016-02-05 18:10:47 -08:00
Chris Hopman 294185ac32 Fix race in catalyst tests
Summary:
Native code accesses the Java Application through the ApplicationHolder. The application should be set on the holder as soon as possible. This change fixes a race in WebWorkersTest.

public

Reviewed By: astreet

Differential Revision: D2905157

fb-gh-sync-id: 7e488f4eecefedb8482276776b3a66e14a843f90
2016-02-05 18:10:39 -08:00
Christopher Dro 109036b4c4 Expose option for distance filtering on location updates.
Summary:
My original implementation involved creating a `RCT_ENUM_CONVERTER` with `CLLocationAccuracy` on iOS and a Hashmap on Android that would convert `string` values to `doubles` for distance filtering.

I got this to work just fine but realized that I made things more complicated than they needed to be and simplified everything by just have the option be a decimal value (in meters) that works both for iOS and Android.

The only thing i'm not sure about is if we can set arbitrary values for CLLocationManager's distance filter.
nicklockwood  Any idea?
Closes https://github.com/facebook/react-native/pull/5563

Reviewed By: svcscm

Differential Revision: D2908250

Pulled By: nicklockwood

fb-gh-sync-id: d83c12b3ce7c343f413749a2cd614b3bf04d6750
2016-02-05 16:55:33 -08:00
Alex Kotliarskyi 64d56f34b7 Improve Chrome debugger
Summary:
`debugger.html` contained a ton of hacky code that was needed to ensure we have a clean JS runtime every time a client RN app connects. That was needed because we used the page's global environment as runtime. Some time ago WebWorker support was added and now we run RN code inside an isolated WebWorker instance, and we can safely get rid of all these hacks.

This has a bunch of nice side-effects: debug reload works faster, `console.log`s are preserved, `debuggerWorker.js` selection doesn't change.

Made sure the debugging (breakpoints, etc.) still works as before.

Small demo
![](http://g.recordit.co/FPdVHLHPUW.gif)
Closes https://github.com/facebook/react-native/pull/5715

Reviewed By: svcscm

Differential Revision: D2906602

Pulled By: frantic

fb-gh-sync-id: 1a6ab9a5655d7c32ddd23619564e59c377b53a35
2016-02-05 15:17:33 -08:00
Oleg Lokhvitsky 4fd115ffa2 Added .setItems() integration for Android AlertDialog
Reviewed By: dmmiller

Differential Revision: D2892199

fb-gh-sync-id: d052313a488d9dfa0ab23f76ea0a96a77260d6c2
2016-02-05 15:14:35 -08:00
Andrei Coman fa2b53166e More perf markers
Reviewed By: javache

Differential Revision: D2895501

fb-gh-sync-id: bc06e2dc45a6f9201c25271ae4467cc93eb44545
2016-02-05 07:10:35 -08:00
Andrei Coman 77ad9459f5 Kill bridge initialization in onDestroy
Reviewed By: AaaChiuuu

Differential Revision: D2877999

fb-gh-sync-id: c986a921c8456213b03d6b7fd339da11713d040b
2016-02-05 06:54:31 -08:00
Adam Miskiewicz 6ac007b2ba Use new DisplayMetrics object in `getDisplayMetrics` as to not overwrite Android global state
Summary:
The change in 8e603940e3 actually causes a super bad bug when `context.getResources().getDisplayMetrics()` is accessed in other parts of the application.

It turns out that when you dive into the impl of `getRealMetrics`, it mutates whatever `DisplayMetrics` object is passed to it. In this case, `getDisplayMetrics` ends up mutating the `DisplayMetrics` object that sits on the application context's `Resources` instance.

This PR makes that not so.

/cc jesseruder ide jaysoo bestander astreet
Closes https://github.com/facebook/react-native/pull/5764

Reviewed By: svcscm

Differential Revision: D2902386

Pulled By: androidtrunkagent

fb-gh-sync-id: 3f24b68bc7e6b4ca83808c03ef3637e1ac9a673e
2016-02-05 06:29:33 -08:00
Andrei Coman fef4196c8b Cache image resource ids
Reviewed By: AaaChiuuu

Differential Revision: D2895691

fb-gh-sync-id: 40824c6fdf5bdd8f0b724a7c81645d3ea911bccf
2016-02-05 05:35:31 -08:00
Andy Street a0eddff5de Force stack alignment on x86 devices
Summary:
public

JSC enforces a stack-alignment that wasn't always being provided on x86 builds. See D2886997.

Reviewed By: foghina

Differential Revision: D2900982

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

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

Reviewed By: svcscm

Differential Revision: D2889897

Pulled By: dmmiller

fb-gh-sync-id: b2f44d2bcb48373f9945f6afd966447a118df717
2016-02-03 13:39:33 -08:00
Adam Miskiewicz e6cb02d61a Use "babel-preset-react-native"
Summary:
Rather than specifying Babel plugins in the `.babelrc` packaged with react-native, leverage a Babel preset to define the plugins (https://github.com/exponentjs/babel-preset-react-native).

This allows for a much better user experience for those who want (or need) to override options in their project's `.babelrc`.

Prior to this PR, if a user wanted to use a custom babel-plugin (or a custom set of babel plugins), they'd have either 1) manually override the `.babelrc` in the react-packager directory (or fork RN), or 2) specify a custom transformer to use when running the packager that loaded their own `.babelrc`. Note - the custom transformer was necessary because without it, RN's `.babelrc` options would supersede the options defined in the project's `.babelrc`...potentially causing issues with plugin ordering.

This PR makes the transformer check for the existence of a project-level `.babelrc`, and if it it's there, it _doesn't_ use the react-native `.babelrc`. This prevents any oddities with Babel plug
Closes https://github.com/facebook/react-native/pull/5214

Reviewed By: davidaurelio

Differential Revision: D2881814

Pulled By: martinbigio

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

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

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

Reviewed By: svcscm

Differential Revision: D2840417

Pulled By: nicklockwood

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

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

Reviewed By: nicklockwood

Differential Revision: D2895253

fb-gh-sync-id: 6f2c08c812ff0028973185356a8af285f7dd7969
2016-02-03 05:49:32 -08:00
Krzysztof Magiera 5f4390bf03 Fix bug related to removeClippedSubviews and view collapsing.
Summary:
The bug occurs for the cases when there is a nested view structure of at least two views with removeClippedSubvews enabled and with a "collapsable" view in between them that migrates from the collapsed state to non-collapsed state.

What happens in that case is that the "inner" view with "removeClippsedSubviews" gets reattached to a new parent, but we never update it's clipping rect because the update is currently only triggered for the size change (and for scroll change in case of scrollview). In the case when the view was doing some "clipping" when attached to its previous parent it needs to update its "clipping" status because the parent has change and clipping rect is calculated based on the parent clipping rect (see `ReactClippingViewGroupHelper#calculateClippingRect`).

This change triggers `updateClippingRect` when the view is attached to the window, which covers the case when it's reattached from one parent to the other.
Closes https://github.com/facebook/react-native/pull/5692

Reviewed By: svcscm

Differential Revision: D2893304

Pulled By: foghina

fb-gh-sync-id: a94ab3674adf9e496fc86dca5a430a91117f2c83
2016-02-03 03:31:29 -08:00
Dave Miller 804b23811b Fix lint for D2880851
Reviewed By: andreicoman11

Differential Revision: D2890474

fb-gh-sync-id: 2d6b2a9a5caa1964646706ba75a5fae8350d0ee5
2016-02-02 08:44:33 -08:00
Janic Duplessis 2633f10588 Fix a crash when logging a JS exception that has no source file
Summary:
This error occurs primarily when starting the app and the packager is not running.

`source` can be null when the evaluated code does not come from a source file so it just crashes with a SIGSEGV when passing it to `String::adopt`. This restores the beloved 'Can't find variable __fbBatchedBridge' redbox error :)

Seems to be introduced in 17e1ceb543.

cc davidaurelio
Closes https://github.com/facebook/react-native/pull/5689

Reviewed By: svcscm

Differential Revision: D2890634

Pulled By: astreet

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

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

Reviewed By: svcscm

Differential Revision: D2890072

Pulled By: nicklockwood

fb-gh-sync-id: a8fc7746bcc050a6e46fedf3583979f4cb9021b6
2016-02-02 07:12:32 -08:00
Konstantin Raev a0bed63f13 Migrating RN unit tests to robolectric 3 for opensourcing
Reviewed By: foghina

Differential Revision: D2887376

fb-gh-sync-id: 719942bb18a5aba27eeb9d30766084d636b3d2b5
2016-02-02 05:22:32 -08:00
Dave Miller fa4a5afe35 Fix Keyboard handling to allow all characters on Soft Input Panel and hardware keyboard
Summary:
public
This diff fixes two issues:
1) Makes it so that when a keyboard is displayed, all keys in that keyboard actually can be set as text.  Previously you could display a Numeric keyboard and it would only allow entering numbers despite the keyboard having other keys like comma, plus, space, etc.
 a) This also allows any key entered on a physical keyboard to go through to the view even if not present on the Soft Input keyboard
2) Makes more robust our Filter setting in setMaxLength so that we only affect the InputFilter.LengthFilter if present instead of all.

This works by creating a new KeyListener which will respond to getInputType as the KeyListener it is replacing (like a DigitsKeyListener for a numeric keyboard) but allow all characters when actually entering text.

Reviewed By: andreicoman11

Differential Revision: D2880851

fb-gh-sync-id: fa5eb549a849d8f30c592d7eac48054ca6a75544
2016-02-02 00:02:30 -08:00
Nick Lockwood 46106f756a Ported `source` prop over to iOS WebView
Summary:
public
https://github.com/facebook/react-native/pull/5494 added a new `source` property to WebView on Android that provides a better API, as well as allowing for request headers to be set.

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

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

Reviewed By: javache

Differential Revision: D2884643

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

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

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

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

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

Reviewed By: svcscm

Differential Revision: D2881313

Pulled By: nicklockwood

fb-gh-sync-id: 7cad8490d4932d0a7ef559165f3ec279d873c537
2016-02-01 10:06:35 -08:00
Jack Hsu 8e603940e3 Use `getRealMetrics` for display metrics. Closes #4934
Summary:
Fixes https://github.com/facebook/react-native/issues/4934.

Since API level 17, there has a `Display.getRealMetrics` method. This allows us to get the actual sizes of the screen (including soft menu bar and other system decor elements).

See: http://developer.android.com/reference/android/view/Display.html#getRealMetrics(android.util.DisplayMetrics)

I'm not sure if there is a good way to write unit or integration tests for this. Please let me know if there are any suggestions or concerns.
Closes https://github.com/facebook/react-native/pull/4935

Reviewed By: svcscm

Differential Revision: D2811091

Pulled By: bestander

fb-gh-sync-id: fed4e357db7eb36d638eebabd8ced4bdffd766a4
2016-02-01 09:09:34 -08:00
Konstantin Raev 33e8a03ada Open sourced view tests
Reviewed By: mkonicek

Differential Revision: D2881830

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

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

Reviewed By: dmmiller

Differential Revision: D2883515

fb-gh-sync-id: e5a0e1cf470e21af837b2311cf1048162ac3aff5
2016-02-01 04:04:35 -08:00
Andrei Coman 8a10fc629a Remove timeout from MessageQueueThreadImpl creation
Reviewed By: oli

Differential Revision: D2880630

fb-gh-sync-id: bd31395abc69750f16a6ab32d11c55af3ec985a4
2016-01-29 14:12:33 -08:00
Krzysztof Magiera 041fb59146 Fix bug with calculating Y offset in RecyclerViewBackedScrollView.
Summary:
This change fixes a bug in getTopOffsetForItem method of RecyclerViewBackedScrollView that was causing Y offset of onScroll events to be invalid when user would scroll up. I'm also adding some comments to this method which may help to understand its complexity.
Closes https://github.com/facebook/react-native/pull/5610

Reviewed By: svcscm

Differential Revision: D2880743

Pulled By: androidtrunkagent

fb-gh-sync-id: 7183e3d6760fab5683afc49d454864239260fb91
2016-01-29 13:26:35 -08:00