Commit Graph

367 Commits

Author SHA1 Message Date
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