Commit Graph

685 Commits

Author SHA1 Message Date
Konstantin Raev a759131ca1 another patch hoping to fix chronos 2016-02-24 10:17:56 +00:00
Konstantin Raev 96ecfade11 manual file sync for oss sync bot 2016-02-24 10:13:35 +00:00
Konstantin Raev ecfd4f854b patch commit that was not synced from fbsource
This one was not synced correctly https://phabricator.fb.com/rFAaebd840baa045b25f7c6641a0657b3cb1a01ba78
2016-02-24 10:01:37 +00: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
Martin Konicek f4e085a06c Clean up docs on building RN Android from source
Summary:Turns out we had two guides for the same thing.

Closes #6007

Reviewed By: mkonicek

Differential Revision:D2949234
Ninja: oss-only

fb-gh-sync-id: eda3a904ce8d8e7213a39021eb60b52449b20a43
shipit-source-id: eda3a904ce8d8e7213a39021eb60b52449b20a43
2016-02-18 07:59:39 -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
Martin Konicek 1d561fd604 New release process: Fix installArchives
Reviewed By: mkonicek

Differential Revision:D2917191
Ninja: Only related to open source React Native, does not affect any fb apps

fb-gh-sync-id: c4fc80ebdd520942e75161a4a30ea4d18030bec4
shipit-source-id: c4fc80ebdd520942e75161a4a30ea4d18030bec4
2016-02-09 10:30:32 -08:00
Martin Konicek e0f0bd2832 New release process: simplify installArchives
Summary:
Output the Android artifacts in the new location so we can simply
do `./gradlew :ReactAndroid:installArchives` and `npm publish`.

**Test Plan**

Same as test plan of 702f999b05 without having to manually move the artifacts.

public

Reviewed By: bestander

Differential Revision: D2916664

fb-gh-sync-id: 27dcc711b3055a5a6c554ed1e69cf4a64add849c
shipit-source-id: 27dcc711b3055a5a6c554ed1e69cf4a64add849c
2016-02-09 08:34:59 -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
Konstantin Raev 6ecfb61147 fixes gradle dependencies for compile and test
Summary: Closes https://github.com/facebook/react-native/pull/5676

Reviewed By: svcscm

Differential Revision: D2886944

Pulled By: androidtrunkagent

fb-gh-sync-id: 9cb68883cd38c31e588222bc746b5e296962c845
2016-02-01 13:23:36 -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
Konstantin Raev f6187565ac fixed gradle deps
Summary: Closes https://github.com/facebook/react-native/pull/5670

Reviewed By: svcscm

Differential Revision: D2885815

Pulled By: androidtrunkagent

fb-gh-sync-id: 670f731b0b12ca2f1b31f0a982f109ce4f736836
2016-02-01 09:42:29 -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
Konstantin Raev 063e8b9ae5 revert D2862911: this broke ReactNative
Reviewed By: balazsbalazs

Differential Revision: D2879926

fb-gh-sync-id: 9f833c209128eaa00b111387ee57dbbc6b74fcb7
2016-01-29 12:21:34 -08:00
Ognjen Dragoljevic 53100ecccb Add support for custom scale types
Summary:
public
This diff adds support for providing custom scaletypes to Drawee. The implementation for the preexisting scale types is preserved.
Breaking changes should be minimal. In fact, only direct usages of `ScalingUtils.getTransform(..., scaleType)` should be converted to `scaleType.getTransform(...)`.

Reviewed By: kirwan

Differential Revision: D2862911

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

Also fixed the flickering when a value is selected.

public

Reviewed By: bestander

Differential Revision: D2871092

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

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

Reviewed By: svcscm

Differential Revision: D2830623

Pulled By: andreicoman11

fb-gh-sync-id: c2a6920c6f4c7daab0115f13864db83b93b31abf
2016-01-29 01:17:35 -08:00
Marc Horowitz 5e82094fcb Move bridge dependencies into a single ReactTestFactory
Reviewed By: cjhopman

Differential Revision: D2816291

fb-gh-sync-id: 0eb654541cac7816922d948cc38a26fab44fad70
2016-01-29 00:57:35 -08:00
Andrei Coman 7e5247c041 Fix timing initialization bug
Reviewed By: AaaChiuuu

Differential Revision: D2875476

fb-gh-sync-id: a0d5b97524da3a37fc7bd30e8d2e58b9a0a9ba9e
2016-01-28 18:55:30 -08:00
Ahmed El-Helw 203fdcaa40 Support fade for remote images in React with nodes.
Reviewed By: dkoroskin

Differential Revision: D2804997

fb-gh-sync-id: e143fc16c07856e56182cba6d0eb2884a95c7318
2016-01-28 17:07:27 -08:00
Martin Konicek 0c0bd533f5 Remove dummy .so file 2016-01-29 01:48:48 +01:00
Nathan Spaun ca8792d2cc Add check to broadcast receiver to prevent exception
Reviewed By: andreicoman11

Differential Revision: D2876479

fb-gh-sync-id: 55b7e31a91cf8a05849a0876bf912ac931233638
2016-01-28 15:51:34 -08:00
Brent Vatne e9f95c1a7d Check for contentView before emitting scroll event
Summary:
I've found that when switching between tabs that each have ScrollViews, sometimes `emitScrollEvent` fires without a `contentView`, which causes the following crash:

```
`D/AndroidRuntime(24496): Shutting down VM
E/AndroidRuntime(24496): FATAL EXCEPTION: main
E/AndroidRuntime(24496): Process: com.listexp, PID: 24496
E/AndroidRuntime(24496): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getWidth()' on a null object reference
E/AndroidRuntime(24496):        at com.facebook.react.views.scroll.ReactScrollViewHelper.emitScrollEvent(ReactScrollViewHelper.java:59)
E/AndroidRuntime(24496):        at com.facebook.react.views.scroll.ReactScrollViewHelper.emitScrollMomentumEndEvent(ReactScrollViewHelper.java:46)
E/AndroidRuntime(24496):        at com.facebook.react.views.scroll.ReactScrollView$1.run(ReactScrollView.java:159)
E/AndroidRuntime(24496):        at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime(24496):        at android.os.Handler.disp
Closes https://github.com/facebook/react-native/pull/5561

Reviewed By: svcscm

Differential Revision: D2876385

Pulled By: androidtrunkagent

fb-gh-sync-id: 33406eaa96352d5adae857088da09fb446b68440
2016-01-28 15:12:50 -08:00
Daniel Colascione 96a3a8e9b9 Codemod realtime to CLOCK_MONOTONIC where it makes sense
Reviewed By: rickbrew

Differential Revision: D2860798

fb-gh-sync-id: 35cd188091f6f790809afed81529531850f82d85
2016-01-27 21:56:34 -08:00
Dave Miller f7c48ee0ce Fix per connection timeouts for XHR
Summary:
public

When initially implemented, the timeout for a request was actually set for all requests that the OKHttpClient handled, not just that request.
The fix is to clone the client, set the timeout for the client which will be used for that request.

Reviewed By: andreicoman11

Differential Revision: D2873220

fb-gh-sync-id: c8c102a6eb9dd0ac57d5a7f53c3ba3b7d6db5ef9
2016-01-27 19:00:32 -08:00
Konstantin Raev 1d819e9503 Open sourced <ImageEditor>, <ImageStore> for Android
Reviewed By: mkonicek

Differential Revision: D2869751

fb-gh-sync-id: 862c266601dd83ca3bf9c9bcbf107f7b17b8bdfd
2016-01-27 10:50:54 -08:00
Konstantin Raev 83fd314e37 Moving more unit tests to open source
Reviewed By: foghina, mkonicek

Differential Revision: D2865561

fb-gh-sync-id: 7aab67d205b94d657a6ec7bf81a4ecee644eabc2
2016-01-27 07:28:23 -08:00
Satyajit Sahoo e33e6ab1f0 Add cross-platform Linking module
Summary:
A promise based API for handling Link for Android and iOS. Refer #4971

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

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

Reviewed By: svcscm

Differential Revision: D2866664

Pulled By: androidtrunkagent

fb-gh-sync-id: 67e68a827e6b85886bfa84e79b897f079e78b1b5
2016-01-26 14:34:31 -08:00
Martin Konicek 9a0539d2c4 Open source Android date and time pickers
Reviewed By: bestander

Differential Revision: D2856486

fb-gh-sync-id: 0bb81136289e2f121387649765ba682103e4701b
2016-01-26 10:31:17 -08:00
Andy Street 91fe9158c9 Remove JSThreadState from Bridge
Reviewed By: lexs

Differential Revision: D2857580

fb-gh-sync-id: f3172cecb8f4563c70564a50c2e9f42178af347a
2016-01-25 18:36:48 -08:00
Satyajit Sahoo 0007bff977 Use promises in 'SourceCodeModule'
Summary: Closes https://github.com/facebook/react-native/pull/5504

Reviewed By: svcscm

Differential Revision: D2861158

Pulled By: dmmiller

fb-gh-sync-id: 3e9c257288539183f6156b8d360b54dc570bc7ad
2016-01-25 12:34:31 -08:00
Dan Caspi ea1aec3c23 JSC Pre-Parsing cache
Reviewed By: mikearmstrong001

Differential Revision: D2840411

fb-gh-sync-id: d238e10b9a859185e6011c4685229cedbcc57a3e
2016-01-25 11:41:31 -08:00
Martin Konicek c95d74ac09 Less Catalyst, more React
Summary:
Catalyst is the old project name. Rename a few files.

public

Reviewed By: bestander

Differential Revision: D2859553

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

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

Reviewed By: svcscm

Differential Revision: D2854696

Pulled By: mkonicek

fb-gh-sync-id: 251701ee8a64acbfc22694e9d4661c40eef75725
2016-01-24 14:00:39 -08:00
Konstantin Raev ae45d8bd4c More fixes to BUCK and java builds of OSS React Native
Reviewed By: mkonicek

Differential Revision: D2849743

fb-gh-sync-id: 7d0ae9a2fcfda8c017b60af3e8fe7fa4029ab6ea
2016-01-23 02:58:33 -08:00
Dave Miller 798acac18e Fix a crash in Image when passed an invalid uri
Summary:
public

Fix https://github.com/facebook/react-native/issues/5465

Instead of returning null when we fail to parse the Uri, just return an empty Uri which somewhat hides the problem but does prevent the crash

Reviewed By: mkonicek

Differential Revision: D2854902

fb-gh-sync-id: 71265d5e52302e174b898af5be25ac698abcf9ab
2016-01-22 10:38:33 -08:00
Martin Konicek 581434ac04 Add BUCK files 2016-01-22 16:20:13 +00:00
David Aurelio 35e1fd8826 Use `std::numeric_limits` in C++
Summary:
Instead of using `UINT32_MAX` in C++ code, use `std::numeric_limits<uint32_t>::max()`. The `UINT32_MAX` macro is not available in all compilation setups
Closes https://github.com/facebook/react-native/pull/5481

Reviewed By: svcscm

Differential Revision: D2854545

Pulled By: androidtrunkagent

fb-gh-sync-id: 00a70b429c78bcf120866bb59fae2ffe6330a910
2016-01-22 03:24:33 -08:00
Andrei Coman 2a70c53947 Don't NPE in reactTagForTouch
Summary:
This NPEs because the layout is null if the TextView has recently
changed. However, this also means that the TextView hasn't been laid out yet, so
the default TextView tag is correct.

public

Reviewed By: oli

Differential Revision: D2848412

fb-gh-sync-id: 5faf793d17f50283c153dc0d43fb717e8764cb7d
2016-01-21 15:33:08 -08:00
David Aurelio 17e1ceb543 Add ability to load “unbundles” to android
Summary:
public

This adds the ability to load “unbundles” in RN android apps. Unbundles are created by invoking the packager with the `unbundle` command rather than `bundle`.

The code detects usage of an “unbundle” by checking for the existence of a specific asset.

Reviewed By: astreet

Differential Revision: D2739596

fb-gh-sync-id: d0813c003fe0fa7b47798b970f56707079bfa5d7
2016-01-21 14:13:50 -08:00
Andrei Coman 29238eb3eb Remove timeouts from react instance loading
Reviewed By: lexs

Differential Revision: D2847813

fb-gh-sync-id: b4cb08633da8e637b0ec25a29bc21b963e337deb
2016-01-21 12:04:17 -08:00
Sokovikov c2d75d7a65 Android AppState
Summary: Closes https://github.com/facebook/react-native/pull/5152

Reviewed By: svcscm

Differential Revision: D2850250

Pulled By: mkonicek

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

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

Reviewed By: svcscm

Differential Revision: D2823456

Pulled By: mkonicek

fb-gh-sync-id: 349d17549f419b5bdc001d70b583423ade06bfe8
2016-01-21 11:08:34 -08:00
Dave Miller 9baff8f437 Make CameraRoll work with Promises
Summary:
public
This is the first module moving to the new model of working with Promises.

We now warn on uses of callback version.  At some point we will remove that.

Reviewed By: davidaurelio

Differential Revision: D2849811

fb-gh-sync-id: 8a31924cc2b438efc58f3ad22d5f27c273563472
2016-01-21 08:07:41 -08:00
Martin Konicek f97138f36f Build first-party C++ deps of OSS React Native with Buck
Reviewed By: sdwilsh

Differential Revision: D2840290

fb-gh-sync-id: 3dd4f7ee83a520d5c01f7864f443a04aa73b35fa
2016-01-21 05:24:31 -08:00
Martin Konicek d8b5539151 Add a dummy .so file to make sure we don't export these to github
Reviewed By: bestander

Differential Revision: D2849772

fb-gh-sync-id: 514bb6245feb3652cbc6d1d5a029eed47dc068aa
2016-01-21 04:31:32 -08:00
Marc Horowitz a9a7c78899 Expose setGlobalVariable in CatalystInstance interface
Summary:
this helps with cleaning up some tests
public

Reviewed By: astreet

Differential Revision: D2816285

fb-gh-sync-id: 37c4da7bdb3c8b5439184316bb5a8939160b40a3
2016-01-20 22:32:30 -08:00
Martin Konicek b9a8be97bc Build code depending on resources from the appcompat library with both Buck and Gradle
Reviewed By: sdwilsh

Differential Revision: D2844961

fb-gh-sync-id: 686a9f253eb370a9dc8cc33ca1c4e8453f89210a
2016-01-20 11:21:36 -08:00
Andy Prock 9b87e6c860 Added an optional options parameter for WebSockets
Summary:
This enables overriding origin, and other request headers. Similar to the https://github.com/websockets/ws api.
Closes https://github.com/facebook/react-native/pull/4629

Reviewed By: svcscm

Differential Revision: D2839951

Pulled By: mkonicek

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

Reviewed By: svcscm

Differential Revision: D2844937

Pulled By: nicklockwood

fb-gh-sync-id: 19953807ff07238e6a6ef5aedf1a3fcbca7e62a1
2016-01-20 10:54:32 -08:00
Konstantin Raev 4bd39500f8 qucik fix for running CI tests with gradle
Reviewed By: mkonicek

Differential Revision: D2844709

fb-gh-sync-id: 9aaff6d0117501b91db519fbd640b8e1736a8cd6
2016-01-20 06:51:40 -08:00
Konstantin Raev c817764d6a Running OSS instrumentation tests with BUCK
Reviewed By: mkonicek

Differential Revision: D2839833

fb-gh-sync-id: ae9aa52962aba1b9057a93804c86b54cd161a8be
2016-01-20 05:04:32 -08:00
Satyajit Sahoo 4bbb0f4c16 Revert "Remove unused ApplicationContext fetch" 2016-01-20 07:16:33 +05:30
Satyajit Sahoo 165e40f22d Merge pull request #5368 from vipulnsward/rm-context
Remove unused ApplicationContext fetch
2016-01-20 07:16:30 +05:30
mangogogos 8638f6a735 Provide a method to easily provide initial props to a ReactAndroid application
Summary:
Adds back support for initial props in ReactAndroid while maintaining the abstraction benefits of having the details of ReactActivity abstracted from the end user's MainActivity. This does remove the need for ReactRootView's two paramater version of the overloaded startReactApplication as far as I can tell but I wasn't sure if anyone might be using that method internally.
Closes https://github.com/facebook/react-native/pull/5384

Reviewed By: svcscm

Differential Revision: D2841602

Pulled By: androidtrunkagent

fb-gh-sync-id: 07e0937bbbdb3ac1585aa252e2fd0f3736690898
2016-01-19 14:38:30 -08:00
Satyajit Sahoo 554292d304 Improve the message shown when bundle download fails
Summary:
![screenshot_20160111-004544](https://cloud.githubusercontent.com/assets/1174278/12223410/cfc57586-b7fc-11e5-9f38-4d562c6e9f0a.png)
Closes https://github.com/facebook/react-native/pull/5235

Reviewed By: svcscm

Differential Revision: D2839867

Pulled By: foghina

fb-gh-sync-id: 36230e1a0d063146db11e9c1d38cea2022a89a12
2016-01-19 12:15:57 -08:00
Dave Miller a10b4d8c47 Standardize Error objects for Promises
Summary:
public

Promises are coming.  And as part of it, we are standardizing the error objects that will be returned.  This puts the code in place on the Android side to always send the proper error format.

It will be an error object like this
`{
  code : "E_SOME_ERROR_CODE_DEFINED_BY_MODULE", // Meant to be machine parseable
  message : "Human readable message",
  nativeError : {} // Some representation of the underlying error (Exception or NSError) , still figuring out exactly, but hopefully something with stack info
}`

Reviewed By: davidaurelio

Differential Revision: D2839927

fb-gh-sync-id: 08f1ce79af24d70357b9957f14471a12627dcffa
2016-01-19 12:15:48 -08:00
Almouro 1f501a9431 Fix image orientation on Android for local uris
Summary:
In Android, when displaying an image with local uri, react-native seems to fail to rotate it according to Exif.
Images on iOS seem like they are being rotated, so this does not seem like a consistent behaviour.

For instance, when taking a picture on a Samsung Galaxy S6, and displaying it with code like below, image does not have a correct orientation.
```javascript
<Image source={{uri: "file:/storage/emulated/0/DCIM/Camera/20160106_171628.jpg"}} />
```
<img src="https://cloud.githubusercontent.com/assets/4534323/12403776/aa5075cc-be36-11e5-885a-7be8236a7fdd.jpg" width=200 />

As seen [here](http://frescolib.org/docs/resizing-rotating.html#auto-rotation), Fresco can do all the work for us (hence this very simple PR).
I tested it on Samsung Galaxy S6 (lollipop), Galaxy S4 (kitkat) and Moto X Style (marshmallow).

I have written an example that fetches images uri from the Java side and then display them in a list view.
[Here](https://github.com/Almouro/rn-camera-roll/tree/use-react-native-master
Closes https://github.com/facebook/react-native/pull/5386

Reviewed By: svcscm

Differential Revision: D2839551

Pulled By: androidtrunkagent

fb-gh-sync-id: 6f0f2f301f263fd142dfbeba6a53f8c482fb5cb0
2016-01-18 19:31:34 -08:00
Dotan J. Nahum e36de0a858 small typo correction
Summary: Closes https://github.com/facebook/react-native/pull/5385

Reviewed By: svcscm

Differential Revision: D2839339

Pulled By: androidtrunkagent

fb-gh-sync-id: ff1c8663daf2c65dd387a51ef3b37f2118fc8da1
2016-01-18 14:59:29 -08:00
Martin Konicek 9fea485138 Build React Native with Buck
Reviewed By: bestander

Differential Revision: D2834002

fb-gh-sync-id: ebd5303a05fe9a01545365e4205d4cb8724a77a8
2016-01-18 12:39:16 -08:00
Felix Oghină 58fc0f07bd add timeout param to remaining RCTNetworking implementations
Reviewed By: nicklockwood

Differential Revision: D2839041

fb-gh-sync-id: 374fca9ce0fdf5622f57a10456c99628ca7a1400
2016-01-18 10:04:36 -08:00
Alex Roman 1303e6d039 Implement XHR timeout for Android and IOS natively.
Summary:
Opening this in a separate PR but the discussion can be viewed on #4832.

Basically, this is a native implementation and is a bit more elegant. The consensus on my previous PR was that it should be done natively rather than in JS.

There's now no maximum valid timeout value and a timeout of 0 will never time out.

ontimeout isn't implemented (yet) in this PR.

cc nicklockwood ide philikon
Closes https://github.com/facebook/react-native/pull/5038

Reviewed By: svcscm

Differential Revision: D2838743

Pulled By: nicklockwood

fb-gh-sync-id: 774f864ac35082bf522f7665f4311bd3affbe82c
2016-01-18 08:10:59 -08:00
Vipul A M 85bf2073f1 Remove unused ApplicationContext fetch 2016-01-17 23:16:51 +05:30
Janic Duplessis 5ac848cd7f Allow setting elevation on any type of View
Summary:
Moved setElevation from ReactViewManager to BaseViewManager. This allows
setting elevation on any type of view such as Toolbar for exemple.
Closes https://github.com/facebook/react-native/pull/5292

Reviewed By: svcscm

Differential Revision: D2837415

Pulled By: androidtrunkagent

fb-gh-sync-id: a5aa7abd95b99303d312cd9c2414539335540925
2016-01-16 02:33:31 -08:00
Felix Oghina a10a510d96 support removeClippedSubviews in ReactHorizontalScrollView
Reviewed By: andreicoman11

Differential Revision: D2831013

fb-gh-sync-id: 2ac4eb8d748f2d66523992e8683c1b4d60198ba1
2016-01-15 09:47:31 -08:00
Dave Miller 2a02621e74 Fix incorrect size issue with inline image text
Reviewed By: andreicoman11

Differential Revision: D2834175

fb-gh-sync-id: 827d37e0128eb07f2e009479269b63c3a3549315
2016-01-15 08:34:34 -08:00
Konstantin Raev 18437093f2 Open sourced spinner aka picker aka drop down for android
Reviewed By: mkonicek

Differential Revision: D2830803

fb-gh-sync-id: e6b6fcdbe33d942180cf2c1041076ad71d0473ce
2016-01-15 06:25:16 -08:00
Andrei Coman 25c3dd140f Add phone-pad keyboard
Summary:
With the numeric keyboard now being an actual numeric keyboard (before
it was actually phone-pad), we need a proper phone-pad keyboard as well.

public

Reviewed By: dmmiller

Differential Revision: D2830707

fb-gh-sync-id: 80a1d314eac730e691de73a31342c014a2fa5ba6
2016-01-14 11:42:34 -08:00
Konstantin Raev 892497408c Open sourced Camera Roll module
Reviewed By: mkonicek

Differential Revision: D2827804

fb-gh-sync-id: c1f06f148855bc4f69da8e19b8445988f1b022b3
2016-01-14 04:33:11 -08:00
Dave Miller f8c384ffdd Consolidate event dispatch to one method that gets the context and event dispatcher
Reviewed By: andreicoman11

Differential Revision: D2827596

fb-gh-sync-id: 3971237aa5eb08934a341e1486c7130381252c99
2016-01-14 04:30:36 -08:00
Dave Miller 393adacfa6 Fix WebView not to double load the URL
Reviewed By: andreicoman11

Differential Revision: D2823397

fb-gh-sync-id: deb04ab22bee7022bc8bcb61fa4c24f86eddbaa8
2016-01-14 04:28:32 -08:00
Brent Vatne f8f5cb1fcf Fix content offset calculations when scrolling up
Summary:
The offset is cached so it doesn't need to calculate the entire height on each scroll, but the cached value was being thrown away when you scroll up -- this fixes that. Found this because it was breaking an infinite scroll view that depended on the contentOffset.y value reported from onScroll.
Closes https://github.com/facebook/react-native/pull/5278

Reviewed By: svcscm

Differential Revision: D2827556

Pulled By: dmmiller

fb-gh-sync-id: 0897b89de427cada7389113991444f57c970f980
2016-01-13 07:31:55 -08:00
Alexander Blom e2641a237a Scan parent class' methods for @ReactProp and @ReactPropGroup annotations
Summary:
When class A declares a ReactProp method foo() and class B that extends from A overrides foo(), it loses the annotation so it has to be duplicated. To allow "inheriting" annotation on Override, we need to scan parent class methods for annotation as well. This diff implements the required logic.

public

Reviewed By: dkoroskin

Differential Revision: D2818278

fb-gh-sync-id: 7e9ae728cc70ce2345db7bc48b3857a0e91c4ca3
2016-01-12 13:41:38 -08:00
Denis Koroskin 44cd2e0e73 In ReactPropertyProcessor, use switch over key String instead of HashMap<String,Integer> lookup followed by a switch over int.
Summary: public Switch over a String is essentially a switch(string.hashCode()) and it is faster than a HashMap lookup. It also doesn't use extra memory, and doesn't require static initialization (startup penalty). Plus I believe this way the generated code looks more readable.

Reviewed By: lexs

Differential Revision: D2818223

fb-gh-sync-id: d9100ec0f8ad556c347681cbe1433d066076d3e5
2016-01-12 11:52:38 -08:00
Andy Street bfcce36efb Update Android.mk files to fix github build
Summary:
public

Since we don't use BUCK in OSS, we also have to update the Android.mk files :(

Reviewed By: bestander

Differential Revision: D2823434

fb-gh-sync-id: 4feef307f8f158653ef8e76d72447d79f47c329a
2016-01-12 07:41:38 -08:00
Andy Street e29eaaddc8 WebWorkers: Add simple integration test
Summary:
public

Adds a simple integration test that verifies that a message can be posted to/from the worker andthat it's torn down properly.

Reviewed By: lexs

Differential Revision: D2815244

fb-gh-sync-id: 00c0d8933d785b2913d378c0589b2fbabf0d0edb
2016-01-12 04:52:16 -08:00
Andy Street 0be36a2c80 WebWorkers: implement tear down and terminate()
Summary:
public
Previously we did no cleanup when the executor was torn down and didn't expose a way to tear down the worker from JS. Now we do.

Termination happens synchronously and waits the the worker's MessageQueueThread to finish and join.

Reviewed By: mhorowitz

Differential Revision: D2815240

fb-gh-sync-id: 786beb30d4d64556586b91727f32e379c667a965
2016-01-12 04:52:10 -08:00
Andy Street b0519c8280 Update WebWorkers API to return message object in onmessage
Summary:
public

I wasn't obeying the web workers API correctly: I had missed that the message isn't sent directly but is attached to a message object in a data field.

Reviewed By: lexs

Differential Revision: D2811247

fb-gh-sync-id: 8e51414766e0cfe382ee9bdde8f0d66e269cb83a
2016-01-12 04:52:01 -08:00
Andy Street 72d1826ae3 WebWorkers: Implement initial WebWorkers API
Summary:
public

Implements a basic WebWorkers API that allows posting messages between the main JS thread and a worker background thread. It follows the existing webworkers API from JS. Currently passed memory needs to be JSON serializable and is copied (unfortunately, this is what webkit does as well, but with a more advanced serialization/deserialization process).

There are a lot of TODO's: I'll add tasks for them once this is accepted.

Reviewed By: lexs

Differential Revision: D2779349

fb-gh-sync-id: 8ed04c115d36acf0264ef1f6a12a65dd0c14ff18
2016-01-12 04:51:53 -08:00
Andy Street dd60964736 WebWorkers: Add c++ API for working with MessageQueueThread
Summary:
public

Adds a fbjni API similar to JNativeRunnable so that you can post ##std::function<void()>## to MessageQueueThreads.

Reviewed By: lexs

Differential Revision: D2779094

fb-gh-sync-id: 8f873fc93fb6b817268e9422c0b6f85c3e453676
2016-01-12 04:51:45 -08:00
Aaron Chiu 73be933d09 fix release builds throwing errors / accessing null objects
Reviewed By: zjj010104

Differential Revision: D2816705

fb-gh-sync-id: 0873fd26b3b34fb56abf5ed033198f1b1d84057f
2016-01-08 20:59:30 -08:00
Aaron Chiu bb73e98513 revert the revert (D2816377)
Reviewed By: zjj010104

Differential Revision: D2816742

fb-gh-sync-id: 2b3b46e54055cfd4b7a137a1f21a330cecd7d663
2016-01-08 19:54:31 -08:00
Jiajie Zhu b6ef42299e revert D2759498 to unbreak AMA release build
Reviewed By: AaaChiuuu

Differential Revision: D2816377

fb-gh-sync-id: 2b8821e4fcbde2bbd9e33d0175f49fdc794441fc
2016-01-08 13:46:30 -08:00
Dave Miller 8ecd352bbf Fix the 'end' value in the onTextInput callback for onscreen keyboard
Summary:
public
The 'end' value in the onTextInput callback was incorrectly computed.  It now is correct.  The value of start and end are relative to the entirety of the entire prechange text in the text input.

Reviewed By: andreicoman11

Differential Revision: D2815064

fb-gh-sync-id: e9f9c84cc5836042d0ffcccc991df72b725ab994
2016-01-08 05:05:31 -08:00
Aaron Chiu 648364594c Don't create DevSupportManager when not in Dev mode
Summary:
public

1. fixes I/O on UI Thread diffusion/FA/browse/master/java/com/facebook/catalyst/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManager.java;e6819b923967f9380dd6c10bfa8f1f40be558e2f$149 in prod builds
2. Less calls to Choreographer (i.e. https://fburl.com/188102408 in AutoProfiler) ==> better newsfeed scroll perf
3. Lower Memory footprint in prod

Reviewed By: astreet

Differential Revision: D2759498

fb-gh-sync-id: 4f593ba9219febb7045f4e470a14995e995ebbb1
2016-01-08 00:49:00 -08:00
Andrei Coman cc449b394e Refactor text input keyboards
Reviewed By: foghina

Differential Revision: D2807491

fb-gh-sync-id: e7e5fb8c235f3637f619b2f44053749c51f379f0
2016-01-07 13:40:33 -08:00
realaboo b659d7f0d1 Get response url from XMLHttpRequest
Summary:
An HTTP request may be redirected to another URL, sometimes we need to know the URL where the  response comes from.

If the server is in control, we can add an HTTP header X-Request-URL for the redirect URL. However there will be cases that 3rd party services are used.

This PR retrieves the response URL from native networking module and passes to it XMLHttpRequest. The fetch API built on XMLHttpRequest also benefits from this feature.
Closes https://github.com/facebook/react-native/pull/4981

Reviewed By: svcscm

Differential Revision: D2811392

Pulled By: lexs

fb-gh-sync-id: 3ec356fb92f8011b6a243d6879172877a3dc498a
2016-01-07 12:03:48 -08:00
realaboo a45219966c ProgressBarAndroid: default value for styleAttr
Summary:
Current default value of ProgressBarAndroid's styleAttr is "Large" which sets the ProgressBar's style to [Widget_ProgressBar_Large](http://developer.android.com/reference/android/R.style.html#Widget_ProgressBar_Large) at native side. But large is not the default style for the native side ProgressBar.

For example, the size of the ProgressBar is 48dip for default style, but 76dip for large and 16dip for small as in the Material themes. Although the size of ProgressBarAndroid could be set in JS, it'll be better to have the same default style as in native side themes.

My PR adds a "Normal" value for styleAttr prop and makes it the default value.
Closes https://github.com/facebook/react-native/pull/4974

Reviewed By: svcscm

Differential Revision: D2811229

Pulled By: bestander

fb-gh-sync-id: 087f68d1919fe933d86e5194112bf7a5f5b3f3c6
2016-01-07 12:02:37 -08:00
Felix Oghina cb94d997ca allow cancelling reload requests
Summary:
Make the ProgressDialog cancelable and cancel the network request / websocket connection when the user presses back.

public

Reviewed By: andreicoman11

Differential Revision: D2764788

fb-gh-sync-id: 0fdb87ba9431be5a3c453422724cd364292eff61
2016-01-07 12:02:16 -08:00
Dave Miller 6dc6794881 Add onSelectionChange for Android TextInput
Summary:
public

Add an onSelectionChange method to TextInput that works on Android same as iOS

Reviewed By: andreicoman11

Differential Revision: D2780131

fb-gh-sync-id: 9b3b8fbd9ea653d43e3107a338e4bc08bde2e8c6
2016-01-07 12:02:06 -08:00
Alexander Blom 57f6cbb3dc Add annotation processor for @ReactProp
Summary:
The annotation processor finds subclasses of ViewManager and ShadowNode and generates classes that can both provide a mapping of property names to their type as well as a way of setting these properties.

This avoids having to do reflection to find the properties.

The annotation processor is currently not working when building with Gradle.

public

Reviewed By: astreet

Differential Revision: D2748958

fb-gh-sync-id: ded5b072d236ebf19fb43eaf704fc7f221a82c26
2016-01-07 03:52:58 -08:00
Alexander Blom c1b7a369af Move UIManager annotations to separate package
Summary:
Moves ReactProp and ReactPropGroup to `com.facebook.react.uimanager.annotations`. This is needed
so that future annotation processor can run on code inside the com.facebook.react.uimanager package.

public

Reviewed By: astreet

Differential Revision: D2754842

fb-gh-sync-id: 3808c3e3f6c45e5897ecab88cd4175573c0c24e6
2016-01-07 03:52:50 -08:00
Michael Lee 0b15418d92 snprintf off by one.
Summary:
According to `man snprintf`

    Upon successful return, these functions return the number of
    characters printed (not including the trailing '\0' used to end
    output to strings).

Or am I misunderstanding something about what's going on here?

public

Reviewed By: zlern2k, dcolascione

Differential Revision: D2805759

fb-gh-sync-id: f20908f80cdfff9677fe38c7c1cf733f0f5b1c5e
2016-01-06 13:02:34 -08:00
Geoffrey Goh e730a9fdd0 Load assets from same folder as JSbundle (Android)
Summary:
https://github.com/facebook/react-native/issues/3679 was only partially fixed as the behaviour only works on iOS. This implements the same behaviour for Android. If the JSBundle was loaded from the assets folder, this will load images from the built-in resources. Else, load the image from the same folder as the JS bundle.

EDIT: For added clarity:

On iOS,
Bundle Location: 'file:///Path/To/Sample.app/main.bundle'
httpServerLocation: '/assets/module/a/'
Name: 'logo'
type: 'png'
**Resolved Asset location: '/Path/To/Sample.app/assets/module/a/logo.png'**

On Android,
Bundle Location: 'file:///sdcard/Path/To/main.bundle'
httpServerLocation: '/assets/module/a/',
name: 'logo'
type: 'png'
**Resolved Asset location: 'file:///sdcard/Path/To/drawable_mdpi/module_a_logo.png'**
Closes https://github.com/facebook/react-native/pull/4527

Reviewed By: svcscm

Differential Revision: D2788005

Pulled By: mkonicek

fb-gh-sync-id: 3f6462a7ee6370a92dd6727ac422c5de346c3ff1
2016-01-06 08:46:35 -08:00
Satyajit Sahoo 5b3cb05fa8 Add a menu item for HMR
Summary:
cc martinbigio
Closes https://github.com/facebook/react-native/pull/5092

Reviewed By: svcscm

Differential Revision: D2807241

Pulled By: mkonicek

fb-gh-sync-id: e4418eeb4944d795f30f94be94b80648b4d7034c
2016-01-06 07:05:33 -08:00
SangYeob Bono Yu daa93a6222 Change the signature of onDropViewInstance. issue #5053
Summary:
https://github.com/facebook/react-native/issues/5053
Closes https://github.com/facebook/react-native/pull/5125

Reviewed By: svcscm

Differential Revision: D2807202

Pulled By: foghina

fb-gh-sync-id: 1e268c940a08aa7bf243971ba91d4595973f12af
2016-01-06 06:57:30 -08:00
Andy Street 1bfd267acb Resubmit: [react_native] WebWorkers: Add JSLoader API for loading script from assets with AssetLoader reference
Summary:
public

Adds the ability to load files from assets without threading through an AssetManager. After the bridge is unforked, we should move to passing through an Environment object instead.

Resubmit: previous version was reverted due to adsmanager crash

Reviewed By: foghina

Differential Revision: D2802899

fb-gh-sync-id: 3d850256fc22f7e9eb21fa71f6adb09cacc839c4
2016-01-06 06:30:31 -08:00
Andy Street cf350a69de WebWorkers: New c++ interface for NativeRunnable
Reviewed By: mhorowitz, lexs

Differential Revision: D2779083

fb-gh-sync-id: dc36b71504b4e74b1671bb48f72d001c9c87721b
2016-01-06 04:17:28 -08:00
odino 2462c8f87d Enables webview debugging
Summary:
2 things that I want to clarify / ask for feedback:

* do we really need to make sure we're running on the UI thread? I guess `onPageStarted` maybe already runs there? Couldnt find anything [here](http://developer.android.com/reference/android/webkit/WebView.html) though
* everytime a page starts we re-enable debugging -- it's a bit useless but I also don't think it's a huge problem, as debugging should only be enabled in dev

Relates to issue #4857, where we switched debugging off as, in some circumstances, it would crash the application as debugging was invoked outside the UI thread.
Closes https://github.com/facebook/react-native/pull/5071

Reviewed By: svcscm

Differential Revision: D2803649

Pulled By: astreet

fb-gh-sync-id: 523d3b442b196d6c54b14ba0c2b29601095c3363
2016-01-05 11:40:32 -08:00
odino 6edcebef9c Stop using platform-specific names for props
Summary:
Follows up on [this comment](https://github.com/facebook/react-native/pull/5065#issuecomment-168353782) by nicklockwood in #5065.

Rely on using the platform annotation and keep the API / naming less redundant.
Closes https://github.com/facebook/react-native/pull/5081

Reviewed By: svcscm

Differential Revision: D2803143

Pulled By: nicklockwood

fb-gh-sync-id: 9bdf028f5022ef46fcb63aa6c3fc931fdcc46f2b
2016-01-05 10:32:43 -08:00
Alexander Blom 6d9096fb3f Fix deadlock when recreating websocket connection
Summary:
When you reload code while using the Chrome debugger we used to create a new websocket connection before closing
the old one. This sometimes would cause a in-flight call to not get a response. This in turn would deadlock the JS thread
because we try to shut it down before killing the websocket connection.

This change instead makes sure to close the old connection before creating a new one. This is done by using a factory for
creating the JavascriptExecutor so we can defer the creation until after the old Bridge has been torn down.

public

Reviewed By: astreet

Differential Revision: D2735011

fb-gh-sync-id: 0ce0f35abaeef5457bad8d6b8d10122281192af4
2016-01-05 09:27:42 -08:00
Andy Street 1c1d7006c2 Remove extra JSUnprotect call
Summary:
public
Value doesn't protect it's value, so it shouldn't be unprotecting them in its destructor.

I'm also pretty sure we don't need to Protect the exception while it's on the stack according to the JSValueProtect docs: https://developer.apple.com/library/mac/documentation/JavaScriptCore/Reference/JSValueRef_header_reference/index.html#//apple_ref/c/func/JSValueProtect

Reviewed By: lexs

Differential Revision: D2779255

fb-gh-sync-id: 7d5df34639c8e7c41e92d3b8d652b93443d194a1
2016-01-05 04:58:29 -08:00
Fada Chen ee82bad3f7 revert D2779079
Reviewed By: zjj010104

Differential Revision: D2802728

fb-gh-sync-id: 9e09f00d1d7facd2091fe60eee8565c4bf599b1d
2016-01-05 00:41:31 -08:00
Ben Alpert 27ac04742a Open-source ART for Android
Summary:
This is already open-source on iOS, albeit badly documented. Now Android too!

Tested in open source by adding a `import com.facebook.react.ARTPackage;` and `.addPackage(new ARTPackage())` to UIExplorerActivity.java, running

```
./gradlew :Examples:UIExplorer:android:app:installDebug
```

and copying VectorWidget into the UIExplorer JS code as described in http://browniefed.com/blog/2015/05/03/getting-react-art-running-on-react-native/.

public

Reviewed By: foghina

Differential Revision: D2700481

fb-gh-sync-id: 2a5308b022869ecc1868a46dbecf397581ddbe04
2016-01-04 18:59:58 -08:00
Felix Oghina 4866ec2767 crash gracefully on fatal js errors (take two)
Reviewed By: AaaChiuuu

Differential Revision: D2773513

fb-gh-sync-id: f8e50ad12e808caf1d85c6c7859c04fcabdaaeae
2016-01-04 13:18:54 -08:00
Andy Street ba2fcd39d1 WebWorkers: Add JSLoader API for loading script from assets with AssetLoader reference
Summary:
public

Adds the ability to load files from assets without threading through an AssetManager. After the bridge is unforked, we should move to passing through an Environment object instead.

Reviewed By: lexs

Differential Revision: D2779079

fb-gh-sync-id: 82b47ecdf48b724076d87f4879ec40601e21e6bc
2016-01-04 12:08:29 -08:00
Andy Street 42e5b2a5bc WebWorkers: Add MessageQueueThreadRegistry
Summary:
public

It is helpful to be able to access the current MessageQueueThread like you would the current Looper. I would do this exactly as Looper does it, but we have forked implementations of MQT for the native bridge and MQT is an interface that can't hold private members.

Reviewed By: lexs

Differential Revision: D2779072

fb-gh-sync-id: 0ff841d8c490b971697c8e5d45f9c0a57668376b
2016-01-04 12:01:33 -08:00
Mike Armstrong 40d9918f5d Fix systrace use in OSS
Reviewed By: bestander

Differential Revision: D2799222

fb-gh-sync-id: 8002c7f94eedffdf05bb134ced14809a78757bb0
2016-01-04 05:12:28 -08:00
Mike Armstrong e42c6d4446 Flows between RN Threads
Reviewed By: tadeuzagallo

Differential Revision: D2743733

fb-gh-sync-id: df4ae69a3501a37e08286857a8d4be3cd27c0ac3
2016-01-04 02:16:31 -08:00
Kudo Chien 4972cabaa5 Add <Text> shadow support
Summary:
Add three new TextStylePropTypes for \<Text>
- textShadowOffset
- textShadowRadius
- textShadowColor
Closes https://github.com/facebook/react-native/pull/4975

Reviewed By: svcscm

Differential Revision: D2796278

Pulled By: nicklockwood

fb-gh-sync-id: f8c3fa210e664428b029b9fba8eca4a8eb81c08d
2016-01-01 09:33:31 -08:00
odino 6793128435 Allowing turning on / off DOM storage on android webviews
Summary:
Was developing on a WebView and couldnt get it to run. Turns out its JS code mostly depends on `localStorage` and I realized it wasnt turned on in RN. This PR adds a prop, similar to `javascriptEnabledAndroid` to be able to turn DOM storage on / off.

TBH I dont really know how it works on IOS, so I created an android specific thingy. I assume DOM storage is enabled by default on IOS.
Closes https://github.com/facebook/react-native/pull/5065

Reviewed By: svcscm

Differential Revision: D2797735

Pulled By: androidtrunkagent

fb-gh-sync-id: cd60cfa4d24d80fb82e4f54f387a4517a99e75ab
2015-12-31 18:04:29 -08:00
Alessandro Nadalin dcc01b04f1 Fixed typo 2015-12-31 12:26:10 +04:00
Konstantin Raev 88baaa1239 increased stability of circleCI e2e tests
Summary:
Out of 57 builds in the 5 days during Christmas only 15 were successful.
15 of the failed ones were caused by `com.android.ddmlib.ShellCommandUnresponsiveException` when running unstrumentation tests.
Another 10 were because of crashes probably related to memory usage.

This PR follows ideas from https://github.com/Originate/guide/blob/master/android/guide/Continuous%20Integration.md

So far I've made 6 successful builds with this setup.
Need to run it for a few more days to get accurate stats.
Closes https://github.com/facebook/react-native/pull/5021

Reviewed By: svcscm

Differential Revision: D2795713

Pulled By: androidtrunkagent

fb-gh-sync-id: 33373fed7ca7c5fb83b35cf551f8501286e33d7b
2015-12-30 11:39:32 -08:00
Mike Armstrong dfcc4f8ad5 Log Memory tags using LegacyProfiler
Reviewed By: jspahrsummers

Differential Revision: D2789647

fb-gh-sync-id: 220a0fc4eccccd92a6b8f45b07b32735a7054614
2015-12-29 22:12:30 -08:00
Andy Street 322a77340c WebWorkers: Add APIs for working with JSObjectRef
Reviewed By: lexs

Differential Revision: D2779267

fb-gh-sync-id: 8aee2aee3ca4d1119576494caa39010e854b92a6
2015-12-29 19:51:36 -08:00
Andy Street 690eb08e63 WebWorkers: Extract evaluateScript logic to JSCHelpers
Reviewed By: lexs

Differential Revision: D2779277

fb-gh-sync-id: ab9a040193f36f40a4a34229a4a90199537253aa
2015-12-29 19:48:35 -08:00
Andy Street a68f8f4224 WebWorkers: Add APIs for working with JSObjectRef
Reviewed By: lexs

Differential Revision: D2779267

fb-gh-sync-id: 5c5a49988a1d501f15e5033b2dd5b528d97d96ed
2015-12-29 19:48:29 -08:00
SangYeob Bono Yu e4272b456e Set encoding to UTF-8 in Android. Fixes #4873
Summary: Closes https://github.com/facebook/react-native/pull/4938

Reviewed By: svcscm

Differential Revision: D2789328

Pulled By: androidtrunkagent

fb-gh-sync-id: c0a0b385be0d832cd052b2495def431cf2c51c8c
2015-12-24 17:18:44 -08:00
Konstantin Raev 308612314e added emulator support to circle.ci
Summary: Closes https://github.com/facebook/react-native/pull/4911

Reviewed By: svcscm

Differential Revision: D2789142

Pulled By: androidtrunkagent

fb-gh-sync-id: 9fd9520c27fc9acb7b139de6843a71ca3f918249
2015-12-24 10:40:28 -08:00
Andreas Stütz 7164c755cb Add props for content insets
Summary:
This PR adds a contentInsetStart and a contentInsetEnd property to ToolbarAndroid, allowing offsetting Toolbar contents to different keylines
Closes https://github.com/facebook/react-native/pull/4699

Reviewed By: svcscm

Differential Revision: D2759294

Pulled By: mkonicek

fb-gh-sync-id: f22aa255f07929ad7a99ac7568981d35e848065b
2015-12-23 10:08:33 -08:00
Christopher Dro c74d6403f5 Update dev menu to keep track of element inspector.
Summary:
This PR makes the android dev menu consistent with iOS where toggling the inspector will update the button label accordingly.
Closes https://github.com/facebook/react-native/pull/4628

Reviewed By: svcscm

Differential Revision: D2740549

Pulled By: mkonicek

fb-gh-sync-id: 02458d09b84e1592dcf245290ee2bbfb2863060d
2015-12-23 10:08:18 -08:00
Denis Koroskin d0de0767e3 Implement touch intercepting in RCTView
Summary:
public React allows excluding certain elements from touch handling by assigning `PointerEvents` filter to them, such as BOX_NONE - this element will not receive touch but its children will, BOX_ONLY - only this element will receive pointer event and not children, NONE - neither this element nor its children will receive pointer events, and AUTO - pointer events are allowed for both this element and its children.

This diff adds PointerEvents support to flat RCTView. Most of the implementation is copied from ReactViewManager/ReactViewGroup. One small change is made to TouchTargetHelper to ensure that it works correctly with virtual nodes when their parent has PointerEvents set to PointerEvents.BOX_NONE.

Reviewed By: ahmedre

Differential Revision: D2784208

fb-gh-sync-id: 4b831f9b1bfb8014a99d7b33534ae7ff7b4ab498
2015-12-23 10:08:13 -08:00
Satyajit Sahoo 935cbb76c0 Add a base activity for React Native apps. Fixes #4043
Summary:
Having a base activity allows us to add new features and fixes without having to change the generated `MainActivity` file.

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

Reviewed By: bestander

Differential Revision: D2783527

Pulled By: mkonicek

fb-gh-sync-id: 707b82839809ca2e1775f5d3ac022a6d00bcac5a
2015-12-23 10:07:42 -08:00
Brent Vatne 6df737d1e7 Expose in public interface
Summary:
Allows you to do:
```
var { RecyclerViewBackedScrollView } = require('react-native')
```

Rather than:
```
var RecyclerViewBackedScrollView = require('react-native/Libraries/Components/ScrollView/RecyclerViewBackedScrollView')
```

Also...

- Export `ScrollView` by default rather than `UnimplementedView` for `RecyclerViewBackedScrollView` on iOS -- this makes it easier on the user, so you don't have to always do a conditional for: `if IOS then use ScrollView else use RecyclerViewBackedScrollView`. I can't think of a case where this would lead to undesirable behaviour.
- Add `RecyclerViewBackedScrollView` to `MainReactPackage`
- Fix an issue with `MapView` that threw a red-screen when trying to access constants on Android because there is no `MapView` in open source and MapView.js doesn't have a platform extension.
Closes https://github.com/facebook/react-native/pull/4514

Reviewed By: svcscm

Differential Revision: D2753466

Pulled By: mkonicek

fb-gh-sync-id: 0b6e2133975c911d5117e7531cb9093faf314c52
2015-12-23 10:07:34 -08:00
Andrei Coman 41875eec47 Add cold start events dashboard ctscan test
Reviewed By: AaaChiuuu

Differential Revision: D2765609

fb-gh-sync-id: 1ac6b76dfad2cd01e52908c31e5391897aa2d99f
2015-12-21 10:24:37 -08:00
Konstantin Raev a99c5160ee Android Instrumentations tests are ready to be run in github/CI open source environment
Reviewed By: mkonicek

Differential Revision: D2769217

fb-gh-sync-id: 7469af816241d8b642753cca21f6542b971e9572
2015-12-21 09:39:57 -08:00
Jan Kassens 4769bdc013 disable debugging of web views
Reviewed By: andreicoman11

Differential Revision: D2773171

fb-gh-sync-id: 41b1313c2ec3d3a22cf56ee15e452b978adf5a78
2015-12-18 10:52:44 -08:00
Martin Konicek b436943a27 Pass the correct URL to Android WebView events
Summary:
`WebView.getUrl()` doesn't return the correct value in WebView callbacks
(e.g. `onPageFinished`).
For example, when navigating to a URL, we report that loading finished,
but still with the old URL. This diff fixes that.

public

Reviewed By: andreicoman11

Differential Revision: D2769597

fb-gh-sync-id: f14bdd405290469ac0a20d0fb89aa2a27d33e758
2015-12-18 03:41:31 -08:00
Martin Konicek a3d16c0178 Fix gitignore
build/ is too generic, ignores valid paths.

Test plan:
- Built Android UI explorer, ReactAndroid, iOS UIExplorer, iOS React
- Git still ignores build output files correctly
2015-12-18 11:35:30 +00:00
Denis Koroskin 56fd138fd3 Dispatch OnLayoutEvent when node gets re-laid out
Reviewed By: ahmedre

Differential Revision: D2768625

fb-gh-sync-id: 4a9862e4c7ada218565fcd87cae25414a0bd5181
2015-12-17 18:46:27 -08:00
Denis Koroskin 18d2177989 Implement @ReactProp nativeBackgroundAndroid in RCTView
Reviewed By: ahmedre

Differential Revision: D2768671

fb-gh-sync-id: cb3ae29f1cecfaec103708cbc82cf4b57dc80d1a
2015-12-17 15:05:45 -08:00
Denis Koroskin ad74dabb68 Turn FlatViewManager into ViewGroupManager
Reviewed By: ahmedre

Differential Revision: D2768667

fb-gh-sync-id: 39298e4033aab5ca8230516f98da252790811f14
2015-12-17 13:31:31 -08:00
Jing Chen 022eac9bd8 Revert D2739392 to fix events dash loading on android
Reviewed By: andreicoman11

Differential Revision: D2770201

fb-gh-sync-id: 6391936f41ba18606637c801645c3177ed1da9ea
2015-12-17 12:54:37 -08:00
Martin Konicek 8cd7730080 Open source Android WebView
Summary:
Keep `WebView.android.js` and `WebView.ios.js`, there are
some small differences. Use the same example on both platforms.

public

Reviewed By: bestander

Differential Revision: D2769446

fb-gh-sync-id: be3d0afcbfd6ddcbaa49f70555063b3081ba03cb
2015-12-17 12:47:39 -08:00
Martin Konicek 3a3af8a385 Open souce the Android Dialog module
Summary:
public

The `DialogModule` requires `android.support.v4.app.FragmentManager` which means
every app that wants to use Dialogs would need to have its Activity extend the legacy
`android.support.v4.app.FragmentActivity`.

This diff makes the `DialogModule` work with both the Support `FragmentManager`
(for AdsManager & potentially other fb apps) and the `android.app.FragmentManager`
(for new apps with no legacy dependencies).

Also wrap the native module in the same `Alert` API that we have on iOS and provide
a cross-platform example. In my opinion the iOS Alert API is quite nice and easy to use.

We still keep `AlertIOS` around because of its `prompt` function which is iOS-specific
and also for backwards compatibility.

Reviewed By: foghina

Differential Revision: D2647000

fb-gh-sync-id: e2280451890bff58bd9c933ab53cd99055403858
2015-12-17 11:11:13 -08:00
Mike Armstrong 1be5777265 define out the memory heap jsc functions
Reviewed By: mkonicek

Differential Revision: D2764964

fb-gh-sync-id: 26eff3e29762287f3527de84b146cee90eccd580
2015-12-16 10:45:52 -08:00
Denis Koroskin 42a1620b1e Remove referenced to dropped views
Reviewed By: ahmedre

Differential Revision: D2757310

fb-gh-sync-id: 2ac97476823879d60dac63920f5e7f086872888a
2015-12-16 10:06:31 -08:00
Dave Miller fcf0431d25 Add support for more Scroll Events to Android
Summary:
public
This adds support for
onScrollBeginDrag/End
onMomentumScrolBegin/End

Reviewed By: astreet

Differential Revision: D2739035

fb-gh-sync-id: 2a49d1df54e5f5cd82008bdb0ffde0881ba39aff
2015-12-16 00:48:28 -08:00
Denis Koroskin 1fabd86048 Add support for custom AndroidViews
Reviewed By: ahmedre

Differential Revision: D2751716

fb-gh-sync-id: 3007cc1eb0303bb2e9eab84836b486e1c2e21021
2015-12-15 20:08:34 -08:00
Felix Oghina 3d4889b5cf return packager URL instead of proxy URL when debugging
Summary:
JS relies on the URL returned by SourceCodeModule to load packager assets. Because we currently return localhost when debugging (because that's the URL Chrome uses), assets don't load when debugging. This makes it so SourceCodeModule still returns the package URL relative to the emulator / device even when debugging.

public

Reviewed By: astreet

Differential Revision: D2759710

fb-gh-sync-id: bab6a88ef044b8b4d971381e3b23c59fa9aa2ed0
2015-12-15 12:17:28 -08:00
Mike Armstrong 7f92aea371 JSC Heap snapshot and capture
Reviewed By: astreet

Differential Revision: D2699681

fb-gh-sync-id: 81617187abec6d9bc1ffe3da02513c6875d0b93b
2015-12-15 10:53:31 -08:00
Alexander Blom 12bec39da1 Fix cxxbridge usage of SettableFuture
Reviewed By: mhorowitz

Differential Revision: D2759591

fb-gh-sync-id: 920b4a5c934c1bd9d196ccbeec0799a54001b85d
2015-12-15 10:43:36 -08:00
Dave Miller e6d498b99b Fix case where measure is called with a view that is now off screen (and removed from clipping)
Reviewed By: astreet

Differential Revision: D2760119

fb-gh-sync-id: cf2723ddc94de64bba961e9390ce54f39ca4651f
2015-12-15 10:43:29 -08:00
Felix Oghina 7871abf907 crash gracefully on fatal js errors
Reviewed By: AaaChiuuu

Differential Revision: D2739392

fb-gh-sync-id: bcc1171c076a4f6425184e7b9ffed204f5ce6f0e
2015-12-15 08:20:32 -08:00
Satyajit Sahoo eb188c8d98 Add deep linking support to IntentAndroid
Summary:
Add a method to handle URLs registered to the app,

```js
IntentAndroid.getInitialURL(url => {
    if (url) {
        // do stuff
    }
});
```

Refer - http://developer.android.com/training/app-indexing/deep-linking.html#adding-filters

The API cannot be same as the iOS API (i.e. as a constant), as the activity is not availble at the time of module initialization. Moreover, multiple activties can share the same bridge instance, and the activity itself is not a constant. Hence the initialURL can change.
Closes https://github.com/facebook/react-native/pull/4320

Reviewed By: svcscm

Differential Revision: D2759667

Pulled By: foghina

fb-gh-sync-id: b725231ae1401fa5565d444eee5a30d303e263ae
2015-12-15 06:27:27 -08:00
David Aurelio cf94a9ea95 Avoid copying the JS bundle unnecessarily
Summary:
public
When forwarding the unbundle code to the bridge, we’re passing the code by value.
This changes the affected method to take it by reference.

Reviewed By: astreet

Differential Revision: D2759569

fb-gh-sync-id: 508d4f4d56bcbdd5a7df5610cf9040121f8878ef
2015-12-15 05:47:31 -08:00
Martin Kralik c46936a00d updated css-layout and fixed callsites
Reviewed By: foghina

Differential Revision: D2757965

fb-gh-sync-id: 061ff38ae59783edb36ff66516866e4a22fd6e25
2015-12-15 04:49:29 -08:00
Andrei Coman dbc35b69fa Make it possible to set DB size
Reviewed By: oli

Differential Revision: D2749219

fb-gh-sync-id: 2165ed8a89c48687ad82cd1facf2b875d31ca997
2015-12-14 12:10:32 -08:00
Krzysztof Magiera 2f56c0c90a Upgrade gradle to 2.9
Summary:
public

New version of gradle has a better support for zipTree copy task. Since we have a few of those including one for boost library which used to take very long, after upgrading we no longer need 6a656a1.

Also seems like many improvements made to gradle since 2.2 made it perform better on incremental builds (around 10% improvement on my laptop).

Command used to upgrade gradle version:

    gradle wrapper --gradle-version 2.9

Some of the plugins require updating as well since the previous versions were incompatible with gradle 2.9.

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

Reviewed By: mkonicek

Differential Revision: D2754786

Pulled By: mkonicek

fb-gh-sync-id: 92c07d29aec6d5b4b2c55205b42b135c4d9479a9
2015-12-14 06:37:34 -08:00
Alexander Blom 01e291751a Use callOnQueue() instead of latch
Reviewed By: astreet

Differential Revision: D2717989

fb-gh-sync-id: 9770e773015838301f6e9520a1ca7a283f647de7
2015-12-12 14:33:17 -08:00
Alexander Blom 8de172e92d Refactor so that mBridge can not be null and can be final
Reviewed By: astreet

Differential Revision: D2717983

fb-gh-sync-id: 969499eb062d54e0271f910c06c4539e2cb20030
2015-12-12 14:33:12 -08:00
Qiao Liang c60b581327 fix POST/PUT/PATCH has no body redbox, when xhr is used without body
Summary:
… by passing a empty body
fix #3371
referring to https://github.com/square/okhttp/pull/1559/files
Closes https://github.com/facebook/react-native/pull/4518

Reviewed By: svcscm

Differential Revision: D2753086

Pulled By: lexs

fb-gh-sync-id: 5c486b127b194b29cd0f8a2cb9a1ef19449109e3
2015-12-12 09:11:30 -08:00
Martin Konicek f168fc335e Don't insta-crash when network permission is missing
Summary:
public

Rename the `ConnectivityModule` to `NetInfoModule` (there's
no need to name things differently in two places). Add exception
handling to the module in case the network permission is missing.

When the permission is missing, throw an actionable error from
all calls to `NetInfo`: http://imgur.com/zVIMxOV

Without this change, the app immediately crashes on startup:
`getCurrentConnectionType` is called from `Activity.onResume`.

Reviewed By: andreicoman11, bestander

Differential Revision: D2749230

fb-gh-sync-id: 1b752d21a8f28ffeaf60a3322cb76f869dc70a14
2015-12-11 10:29:23 -08:00
Mike Armstrong 1a94698658 expose systemclock time to JS
Reviewed By: tadeuzagallo

Differential Revision: D2748749

fb-gh-sync-id: 4d1dbae61f69a07b7106cb57caff03cadfb85776
2015-12-11 07:32:30 -08:00
Tadeu Zagallo 3549ff049c Rename BridgeProfiling to Systrace for consistency
Summary:
public

Rename the `BridgeProfiling` JS module to `Systrace`, since it's actually just
an API to Systrace markers.

This should make it clearer as we add more perf tooling.

Reviewed By: jspahrsummers

Differential Revision: D2734001

fb-gh-sync-id: 642848fa7340c545067f2a7cf5cef8af1c8a69a2
2015-12-11 03:53:19 -08:00
Mike Armstrong 7f710f9050 Add fbsystrace markers using the legacyprofiler
Reviewed By: astreet

Differential Revision: D2728033

fb-gh-sync-id: 264d40930b8fec0262cbea36529bd8b11efcc58e
2015-12-10 04:39:31 -08:00
Dave Miller 5775d9e1d0 Update touch/measure/hotspot to all use same coordinate space
Reviewed By: astreet

Differential Revision: D2731165

fb-gh-sync-id: 729943233af66f139907cac2002fed4038b3fa6a
2015-12-10 03:01:37 -08:00
Felipe Martim 96553cf553 Add rotateX and rotateY transforms to Android Views .
Summary:
Setting rotateX and rotateY for Android Views.
Closes https://github.com/facebook/react-native/pull/4413

Reviewed By: svcscm

Differential Revision: D2741328

Pulled By: mkonicek

fb-gh-sync-id: 931027c006bc571ef374a7b82cc7074b8a34bc8d
2015-12-09 16:09:30 -08:00
Siddu Duddikunta 64a78ed74b Fix bug in Android elevation implementation
Summary:
If border radius is not set or is zero, then elevation will not
work properly. This bug seems to have been introduced when the
style in facebook/react-native#4180 was modified slightly to
produce commit b65f1f2234.
Closes https://github.com/facebook/react-native/pull/4555

Reviewed By: svcscm

Differential Revision: D2741203

Pulled By: mkonicek

fb-gh-sync-id: f4ee9ccdfc64374d58824a6e988409ac2b7532a4
2015-12-09 15:52:29 -08:00
Martin Konicek 2aa3e0dd1a Use the new Android Clipboard module
Summary:
public

- Open source the unit test for `ClipboardModule`, start using the `ReactTestHelper` in two unit tests
- Fixes a few references to "pasteboard" in strings

Reviewed By: bestander

Differential Revision: D2739614

fb-gh-sync-id: e076940a3ae5c22314e181a37fe2c3f77a18cf85
2015-12-09 15:21:30 -08:00
Denis Koroskin c0c8e7cfdf Add support for `double` type in ReactPropGroup
Reviewed By: astreet

Differential Revision: D2735362

fb-gh-sync-id: a8eab400248fc4c8ad5d43e6a34cfd350dfb1d26
2015-12-09 12:39:38 -08:00
Martin Konicek e8659b3602 Remove all BUCK files 2015-12-09 20:25:19 +00:00
tantan 90c7ad112f add Clipboard component for ios and android
Summary:
add Clipboard component for ios and android
 ```javascript
    import Clipboard from 'react-native'

    Clipboard.get((content)=>{
          console.log('here is content in clipboard:%s',content)
    });
    var content = 'here is a string';
    Clipboard.set(content);
```
Closes https://github.com/facebook/react-native/pull/4384

Reviewed By: svcscm

Differential Revision: D2738881

Pulled By: mkonicek

fb-gh-sync-id: a06df32d1eb2824cc9ca3de9d45e4e67fd2edbc9
2015-12-09 10:04:21 -08:00
Sebastian Markbage 8d397b4cbc Decouple Module System from Native Calls
Summary:
The JavaScript ecosystem doesn't have the notion of a built-in native module loader. Even Node is decoupled from its module loader. The module loader system is just JS that runs on top of the global `process` object which has all the built-in goodies.

Additionally there is no such thing as a global require. That is something unique to our providesModule system. In other module systems such as node, every require is contextual. Even registered npm names are localized by version.

The only global namespace that is accessible to the host environment is the global object. Normally module systems attaches itself onto the hooks provided by the host environment on the global object.

Currently, we have two forms of dispatch that reaches directly into the module system. executeJSCall which reaches directly into require. Everything now calls through the BatchedBridge module (except one RCTLog edge case that I will fix). I propose that the executors calls directly onto `BatchedBridge` through an instance on the global so that everything is guaranteed to go through it. It becomes the main communication hub.

I also propose that we drop the dynamic requires inside of MessageQueue/BatchBridge and instead have the modules register themselves with the bridge.

executeJSCall was originally modeled after the XHP equivalent. The XHP equivalent was designed that way because the act of doing the call was the thing that defined a dependency on the module from the page. However, that is not how React Native works.

The JS side is driving the dependencies by virtue of requiring new modules and frameworks and the existence of dependencies is driven by the JS side, so this design doesn't make as much sense.

The main driver for this is to be able to introduce a new module system like Prepack's module system. However, it also unlocks the possibility to do dead module elimination even in our current module system. It is currently not possible because we don't know which module might be called from native.

Since the module system now becomes decoupled we could publish all our providesModule modules as npm/CommonJS modules using a rewrite script. That's what React Core does.

That way people could use any CommonJS bundler such as Webpack, Closure Compiler, Rollup or some new innovation to create a JS bundle.

This diff expands the executeJSCalls to the BatchedBridge's three individual pieces to make them first class instead of being dynamic. This removes one layer of abstraction. Hopefully we can also remove more of the things that register themselves with the BatchedBridge (various EventEmitters) and instead have everything go through the public protocol. ReactMethod/RCT_EXPORT_METHOD.

public

Reviewed By: vjeux

Differential Revision: D2717535

fb-gh-sync-id: 70114f05483124f5ac5c4570422bb91a60a727f6
2015-12-08 16:03:37 -08:00
Mike Armstrong e7a4b20d75 exceptions generated from incorrect arg usage on JSC trace and LegacyProfile functions
Reviewed By: astreet

Differential Revision: D2729015

fb-gh-sync-id: a3f56554ff6e77170e07aaf93934f93522b3a81b
2015-12-08 06:14:34 -08:00
Andrei Coman 5aef380609 Refactor NetInfo
Reviewed By: foghina

Differential Revision: D2718059

fb-gh-sync-id: 5c4e946991be27c5ae2bcc3eec32b5bc596545bd
2015-12-08 04:56:26 -08:00
Mike Armstrong dcebe8cd37 Use ascii characters to construct JSStringRef
Reviewed By: astreet

Differential Revision: D2700781

fb-gh-sync-id: be790600ea3d4c0238553efe69a0979c177ddb2d
2015-12-08 01:39:28 -08:00
Mike Armstrong 0f98dedefe More markers for view operations
Reviewed By: astreet

Differential Revision: D2679126

fb-gh-sync-id: 882e815a7551d23b4594fdc2dd257b4f1cdbbab7
2015-12-07 15:25:27 -08:00
Alexander Blom 510d50fc17 Trigger GC and drop compiled code on low memory
Reviewed By: astreet

Differential Revision: D2658693

fb-gh-sync-id: 8cba49b67ac45a2dbf8b4c9c404d6fb9c97693f6
2015-12-07 08:46:25 -08:00
Mike Armstrong 69ce5ab5b8 JSC bindings for flow events
Reviewed By: astreet

Differential Revision: D2717887

fb-gh-sync-id: 40d03ac140669b8ebeb096917f2aba32fe260a1a
2015-12-07 03:51:29 -08:00
Olivier Notteghem a38ce5c570 match RN attachment images Feed experience with Native with spinner/fade in
Reviewed By: astreet

Differential Revision: D2722917

fb-gh-sync-id: a09b9a1a4b9a19b94471d8e93ec5bde53af7da06
2015-12-06 15:48:34 -08:00
Dave Miller fa884ee5e6 Fix Y-coord on touches
Summary:
public

D2670028 updated the x/y positions of touch events to be relative to the window, but measure still uses the location on the screen. Therefore, in Touchable.js, we were seeing taps get inproperly invalidated because they were erroneously considered outside of the touch rect. This diff moves back to the old version of pageX/Y on touch events that's compatible with the current version of measure.

Reviewed By: nicklockwood

Differential Revision: D2724917

fb-gh-sync-id: 978ae26fcaa23c47a4f619e2b7ff2d078388ae95
2015-12-04 20:54:39 -08:00