Commit Graph

672 Commits

Author SHA1 Message Date
Felix Oghina c027f05ef4 add generic memory pressure listener interface
Reviewed By: lexs

Differential Revision: D2989071

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

Reviewed By: lexs

Differential Revision: D2932170

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

Reviewed By: lexs

Differential Revision: D2928657

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

Reviewed By: lexs

Differential Revision: D3005994

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

Differential Revision: D3005903

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

Reviewed By: mhorowitz, lexs

Differential Revision: D2994721

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

Reviewed By: nicklockwood

Differential Revision: D2982173

Pulled By: dmmiller

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

Differential Revision: D2972822

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

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

Differential Revision: D2989293

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

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

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

Differential Revision: D3000042

Pulled By: mkonicek

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

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

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

Differential Revision: D2999878

Pulled By: bestander

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

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

Reviewed By: mhorowitz

Differential Revision: D2965458

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

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

Reviewed By: mhorowitz

Differential Revision: D2989999

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

Differential Revision: D2975870

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

Differential Revision: D2983352

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

Differential Revision: D2982534

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

Differential Revision: D2982364

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

Differential Revision: D2982182

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

Differential Revision: D2960626

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

Differential Revision: D2982150

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

Differential Revision: D2965497

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

Reviewed By: foghina

Differential Revision: D2977441

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

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

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

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

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

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

Differential Revision: D2981865

Pulled By: spicyj

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

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

Differential Revision: D2979913

Pulled By: mkonicek

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

Differential Revision: D2874873

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

Differential Revision: D2968322

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

Reviewed By: foghina

Differential Revision: D2971596

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

Differential Revision: D2975785

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

Differential Revision: D2971504

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

Differential Revision: D2971225

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

Differential Revision: D2971032

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

Differential Revision: D2971309

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

Differential Revision: D2970771

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

Differential Revision: D2967180

fb-gh-sync-id: fe59b7f7c7dab8b5e7f3a449e72b467e1c2c2c67
shipit-source-id: fe59b7f7c7dab8b5e7f3a449e72b467e1c2c2c67
2016-02-24 02:18:28 -08:00
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