Commit Graph

685 Commits

Author SHA1 Message Date
Andrei Coman 4254e8a0a9 Fix DisplayMetrics KeyboardListener dependency
Summary:
public
KeyboardListener needs DisplayMetrics to be initialized when it is attached. At
the moment, this breaks easily whenever we change these components, since DisplayMetrics are intialized
in a module and KeyboardListener is created eagerly in ReactRootView, whereas
ReactRootView can exist without the instance.
This changes to create DisplayMetrics as soon as possible, when the react
instance is built. The KeyboardListener is created and attached after the ReactRootView is
attached to an existing instance, point at which DisplayMetrics have to be
initialized.

Reviewed By: dmmiller

Differential Revision: D2911351

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

Reviewed By: svcscm

Differential Revision: D2911959

Pulled By: androidtrunkagent

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

Reviewed By: bestander

Differential Revision: D2911762

Pulled By: andreicoman11

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

Differential Revision: D2845168

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

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

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

Reviewed By: svcscm

Differential Revision: D2910716

Pulled By: nicklockwood

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

Reviewed By: svcscm

Differential Revision: D2910012

Pulled By: vjeux

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

public

Reviewed By: astreet

Differential Revision: D2905186

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

public

Reviewed By: astreet

Differential Revision: D2905183

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

public

Reviewed By: astreet

Differential Revision: D2905178

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

public

Reviewed By: astreet

Differential Revision: D2905176

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

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

public

Reviewed By: astreet

Differential Revision: D2905168

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

Reviewed By: astreet

Differential Revision: D2905163

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

public

Reviewed By: astreet

Differential Revision: D2905159

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

public

Reviewed By: astreet

Differential Revision: D2905157

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

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

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

Reviewed By: svcscm

Differential Revision: D2908250

Pulled By: nicklockwood

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

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

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

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

Reviewed By: svcscm

Differential Revision: D2906602

Pulled By: frantic

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

Differential Revision: D2892199

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

Differential Revision: D2895501

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

Differential Revision: D2877999

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

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

This PR makes that not so.

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

Reviewed By: svcscm

Differential Revision: D2902386

Pulled By: androidtrunkagent

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

Differential Revision: D2895691

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

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

Reviewed By: foghina

Differential Revision: D2900982

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

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

Reviewed By: svcscm

Differential Revision: D2889897

Pulled By: dmmiller

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

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

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

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

Reviewed By: davidaurelio

Differential Revision: D2881814

Pulled By: martinbigio

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

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

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

Reviewed By: svcscm

Differential Revision: D2840417

Pulled By: nicklockwood

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

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

Reviewed By: nicklockwood

Differential Revision: D2895253

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

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

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

Reviewed By: svcscm

Differential Revision: D2893304

Pulled By: foghina

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

Differential Revision: D2890474

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

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

Seems to be introduced in 17e1ceb543.

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

Reviewed By: svcscm

Differential Revision: D2890634

Pulled By: astreet

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

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

Reviewed By: svcscm

Differential Revision: D2890072

Pulled By: nicklockwood

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

Differential Revision: D2887376

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

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

Reviewed By: andreicoman11

Differential Revision: D2880851

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

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

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

Reviewed By: javache

Differential Revision: D2884643

fb-gh-sync-id: 83f24494bdbb4e1408aa8f3b7428fee33888ae3a
2016-02-01 18:01:35 -08:00
Konstantin Raev 6ecfb61147 fixes gradle dependencies for compile and test
Summary: Closes https://github.com/facebook/react-native/pull/5676

Reviewed By: svcscm

Differential Revision: D2886944

Pulled By: androidtrunkagent

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

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

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

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

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

Reviewed By: svcscm

Differential Revision: D2881313

Pulled By: nicklockwood

fb-gh-sync-id: 7cad8490d4932d0a7ef559165f3ec279d873c537
2016-02-01 10:06:35 -08:00
Konstantin Raev f6187565ac fixed gradle deps
Summary: Closes https://github.com/facebook/react-native/pull/5670

Reviewed By: svcscm

Differential Revision: D2885815

Pulled By: androidtrunkagent

fb-gh-sync-id: 670f731b0b12ca2f1b31f0a982f109ce4f736836
2016-02-01 09:42:29 -08:00
Jack Hsu 8e603940e3 Use `getRealMetrics` for display metrics. Closes #4934
Summary:
Fixes https://github.com/facebook/react-native/issues/4934.

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

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

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

Reviewed By: svcscm

Differential Revision: D2811091

Pulled By: bestander

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

Differential Revision: D2881830

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

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

Reviewed By: dmmiller

Differential Revision: D2883515

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

Differential Revision: D2880630

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

Reviewed By: svcscm

Differential Revision: D2880743

Pulled By: androidtrunkagent

fb-gh-sync-id: 7183e3d6760fab5683afc49d454864239260fb91
2016-01-29 13:26:35 -08:00
Konstantin Raev 063e8b9ae5 revert D2862911: this broke ReactNative
Reviewed By: balazsbalazs

Differential Revision: D2879926

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

Reviewed By: kirwan

Differential Revision: D2862911

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

Also fixed the flickering when a value is selected.

public

Reviewed By: bestander

Differential Revision: D2871092

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

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

Reviewed By: svcscm

Differential Revision: D2830623

Pulled By: andreicoman11

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

Differential Revision: D2816291

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

Differential Revision: D2875476

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

Differential Revision: D2804997

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

Differential Revision: D2876479

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

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

Reviewed By: svcscm

Differential Revision: D2876385

Pulled By: androidtrunkagent

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

Differential Revision: D2860798

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

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

Reviewed By: andreicoman11

Differential Revision: D2873220

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

Differential Revision: D2869751

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

Differential Revision: D2865561

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

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

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

Reviewed By: svcscm

Differential Revision: D2866664

Pulled By: androidtrunkagent

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

Differential Revision: D2856486

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

Differential Revision: D2857580

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

Reviewed By: svcscm

Differential Revision: D2861158

Pulled By: dmmiller

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

Differential Revision: D2840411

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

public

Reviewed By: bestander

Differential Revision: D2859553

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

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

Reviewed By: svcscm

Differential Revision: D2854696

Pulled By: mkonicek

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

Differential Revision: D2849743

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

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

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

Reviewed By: mkonicek

Differential Revision: D2854902

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

Reviewed By: svcscm

Differential Revision: D2854545

Pulled By: androidtrunkagent

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

public

Reviewed By: oli

Differential Revision: D2848412

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

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

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

Reviewed By: astreet

Differential Revision: D2739596

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

Differential Revision: D2847813

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

Reviewed By: svcscm

Differential Revision: D2850250

Pulled By: mkonicek

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

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

Reviewed By: svcscm

Differential Revision: D2823456

Pulled By: mkonicek

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

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

Reviewed By: davidaurelio

Differential Revision: D2849811

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

Differential Revision: D2840290

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

Differential Revision: D2849772

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

Reviewed By: astreet

Differential Revision: D2816285

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

Differential Revision: D2844961

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

Reviewed By: svcscm

Differential Revision: D2839951

Pulled By: mkonicek

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

Reviewed By: svcscm

Differential Revision: D2844937

Pulled By: nicklockwood

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

Differential Revision: D2844709

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

Differential Revision: D2839833

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

Reviewed By: svcscm

Differential Revision: D2841602

Pulled By: androidtrunkagent

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

Reviewed By: svcscm

Differential Revision: D2839867

Pulled By: foghina

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

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

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

Reviewed By: davidaurelio

Differential Revision: D2839927

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

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

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

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

Reviewed By: svcscm

Differential Revision: D2839551

Pulled By: androidtrunkagent

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

Reviewed By: svcscm

Differential Revision: D2839339

Pulled By: androidtrunkagent

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

Differential Revision: D2834002

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

Differential Revision: D2839041

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

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

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

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

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

Reviewed By: svcscm

Differential Revision: D2838743

Pulled By: nicklockwood

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

Reviewed By: svcscm

Differential Revision: D2837415

Pulled By: androidtrunkagent

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

Differential Revision: D2831013

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

Differential Revision: D2834175

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

Differential Revision: D2830803

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

public

Reviewed By: dmmiller

Differential Revision: D2830707

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

Differential Revision: D2827804

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

Differential Revision: D2827596

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

Differential Revision: D2823397

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

Reviewed By: svcscm

Differential Revision: D2827556

Pulled By: dmmiller

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

public

Reviewed By: dkoroskin

Differential Revision: D2818278

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

Reviewed By: lexs

Differential Revision: D2818223

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

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

Reviewed By: bestander

Differential Revision: D2823434

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

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

Reviewed By: lexs

Differential Revision: D2815244

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

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

Reviewed By: mhorowitz

Differential Revision: D2815240

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

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

Reviewed By: lexs

Differential Revision: D2811247

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

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

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

Reviewed By: lexs

Differential Revision: D2779349

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

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

Reviewed By: lexs

Differential Revision: D2779094

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

Differential Revision: D2816705

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

Differential Revision: D2816742

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

Differential Revision: D2816377

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

Reviewed By: andreicoman11

Differential Revision: D2815064

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

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

Reviewed By: astreet

Differential Revision: D2759498

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

Differential Revision: D2807491

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

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

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

Reviewed By: svcscm

Differential Revision: D2811392

Pulled By: lexs

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

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

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

Reviewed By: svcscm

Differential Revision: D2811229

Pulled By: bestander

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

public

Reviewed By: andreicoman11

Differential Revision: D2764788

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

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

Reviewed By: andreicoman11

Differential Revision: D2780131

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

This avoids having to do reflection to find the properties.

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

public

Reviewed By: astreet

Differential Revision: D2748958

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

public

Reviewed By: astreet

Differential Revision: D2754842

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

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

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

public

Reviewed By: zlern2k, dcolascione

Differential Revision: D2805759

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

EDIT: For added clarity:

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

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

Reviewed By: svcscm

Differential Revision: D2788005

Pulled By: mkonicek

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

Reviewed By: svcscm

Differential Revision: D2807241

Pulled By: mkonicek

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

Reviewed By: svcscm

Differential Revision: D2807202

Pulled By: foghina

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

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

Resubmit: previous version was reverted due to adsmanager crash

Reviewed By: foghina

Differential Revision: D2802899

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

Differential Revision: D2779083

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

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

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

Reviewed By: svcscm

Differential Revision: D2803649

Pulled By: astreet

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

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

Reviewed By: svcscm

Differential Revision: D2803143

Pulled By: nicklockwood

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

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

public

Reviewed By: astreet

Differential Revision: D2735011

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

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

Reviewed By: lexs

Differential Revision: D2779255

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

Differential Revision: D2802728

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

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

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

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

public

Reviewed By: foghina

Differential Revision: D2700481

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

Differential Revision: D2773513

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

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

Reviewed By: lexs

Differential Revision: D2779079

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

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

Reviewed By: lexs

Differential Revision: D2779072

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

Differential Revision: D2799222

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

Differential Revision: D2743733

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

Reviewed By: svcscm

Differential Revision: D2796278

Pulled By: nicklockwood

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

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

Reviewed By: svcscm

Differential Revision: D2797735

Pulled By: androidtrunkagent

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

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

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

Reviewed By: svcscm

Differential Revision: D2795713

Pulled By: androidtrunkagent

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

Differential Revision: D2789647

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

Differential Revision: D2779267

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

Differential Revision: D2779277

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

Differential Revision: D2779267

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

Reviewed By: svcscm

Differential Revision: D2789328

Pulled By: androidtrunkagent

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

Reviewed By: svcscm

Differential Revision: D2789142

Pulled By: androidtrunkagent

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

Reviewed By: svcscm

Differential Revision: D2759294

Pulled By: mkonicek

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

Reviewed By: svcscm

Differential Revision: D2740549

Pulled By: mkonicek

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

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

Reviewed By: ahmedre

Differential Revision: D2784208

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

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

Reviewed By: bestander

Differential Revision: D2783527

Pulled By: mkonicek

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

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

Also...

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

Reviewed By: svcscm

Differential Revision: D2753466

Pulled By: mkonicek

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

Differential Revision: D2765609

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

Differential Revision: D2769217

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

Differential Revision: D2773171

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

public

Reviewed By: andreicoman11

Differential Revision: D2769597

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

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

Differential Revision: D2768625

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

Differential Revision: D2768671

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

Differential Revision: D2768667

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

Differential Revision: D2770201

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

public

Reviewed By: bestander

Differential Revision: D2769446

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

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

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

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

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

Reviewed By: foghina

Differential Revision: D2647000

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

Differential Revision: D2764964

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

Differential Revision: D2757310

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

Reviewed By: astreet

Differential Revision: D2739035

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

Differential Revision: D2751716

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

public

Reviewed By: astreet

Differential Revision: D2759710

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

Differential Revision: D2699681

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

Differential Revision: D2759591

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

Differential Revision: D2760119

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

Differential Revision: D2739392

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

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

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

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

Reviewed By: svcscm

Differential Revision: D2759667

Pulled By: foghina

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

Reviewed By: astreet

Differential Revision: D2759569

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

Differential Revision: D2757965

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

Differential Revision: D2749219

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

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

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

Command used to upgrade gradle version:

    gradle wrapper --gradle-version 2.9

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

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

Reviewed By: mkonicek

Differential Revision: D2754786

Pulled By: mkonicek

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

Differential Revision: D2717989

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

Differential Revision: D2717983

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

Reviewed By: svcscm

Differential Revision: D2753086

Pulled By: lexs

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

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

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

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

Reviewed By: andreicoman11, bestander

Differential Revision: D2749230

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

Differential Revision: D2748749

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

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

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

Reviewed By: jspahrsummers

Differential Revision: D2734001

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

Differential Revision: D2728033

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

Differential Revision: D2731165

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

Reviewed By: svcscm

Differential Revision: D2741328

Pulled By: mkonicek

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

Reviewed By: svcscm

Differential Revision: D2741203

Pulled By: mkonicek

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

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

Reviewed By: bestander

Differential Revision: D2739614

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

Differential Revision: D2735362

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

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

Reviewed By: svcscm

Differential Revision: D2738881

Pulled By: mkonicek

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

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

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

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

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

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

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

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

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

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

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

public

Reviewed By: vjeux

Differential Revision: D2717535

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

Differential Revision: D2729015

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

Differential Revision: D2718059

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

Differential Revision: D2700781

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

Differential Revision: D2679126

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

Differential Revision: D2658693

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

Differential Revision: D2717887

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

Differential Revision: D2722917

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

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

Reviewed By: nicklockwood

Differential Revision: D2724917

fb-gh-sync-id: 978ae26fcaa23c47a4f619e2b7ff2d078388ae95
2015-12-04 20:54:39 -08:00
Dave Miller 4661e59d1a For clippedSubViews, pass down the opportunity for children views to update their clipping if they intersect at all
Reviewed By: astreet

Differential Revision: D2717903

fb-gh-sync-id: 8852a6d3ac3a329c4cad663e7f9f7093f9b6ae16
2015-12-04 04:16:28 -08:00
Andy Street ecdc3429cd Fork v4 support library NestedScrollView to fix fling bug
Reviewed By: oli, lexs

Differential Revision: D2707733

fb-gh-sync-id: c9b375a6aa1010d60d21ca7500e862a6ff91a49b
2015-12-03 11:15:51 -08:00
Mike Armstrong 5ad7dd3cac pre add new systrace TRACE_TAG_REACT_VIEW
Reviewed By: foghina

Differential Revision: D2717692

fb-gh-sync-id: 572b9286bd5be9f15ba3295e29770c4d33ee7590
2015-12-03 06:17:27 -08:00
Sameer Rahmani c8eed6a361 RTL support added for ToolbarAndroid via "rtl" property
Summary: Closes https://github.com/facebook/react-native/pull/4378

Reviewed By: svcscm

Differential Revision: D2715052

Pulled By: mkonicek

fb-gh-sync-id: e24f5db230cd7329911797794e5ef150f6195c4a
2015-12-03 05:18:26 -08:00
David Aurelio a68c731aca Android: Accept Throwables in Promise.reject()
Summary:
public

Fixes #4309

This adds the possibility to reject `Promise` instances with `Throwable`s in java, instead of strings.
For now, it only reads the message, but we can add more features on top of this, e.g. forwarding the error stack.

Reviewed By: andreicoman11

Differential Revision: D2708192

fb-gh-sync-id: ca5ff584eca29370a9f9b780fa9825b17863a7e9
2015-12-03 04:52:26 -08:00
Konstantin Raev 0779dd1e87 Open source the Android NetInfo module
Reviewed By: mkonicek

Differential Revision: D2703432

fb-gh-sync-id: 4a85844f1734ec433df543c89f0fdd56fe5db13c
2015-12-02 11:52:22 -08:00
Felix Oghina c06efc0831 remove activities from module constructors
Summary:
Refactor modules that take activities (or activities that implement some interface) as constructor args to not do that. Expose `getCurrentActivity()` in `ReactContext` and use that wherever the activity is needed.

public

Reviewed By: astreet

Differential Revision: D2680462

fb-gh-sync-id: f263b3fe5b422b7aab9fdadd051cef4e82797b0a
2015-12-02 10:05:28 -08:00
Alon Schwarz f69ac1eaef Revert D2679408 (Only send layout update operation to nativehierarchymanager when layout actually changes)
Reviewed By: andreicoman11

Differential Revision: D2712224

fb-gh-sync-id: e6aebe6fcf54e9f36cac092cab801bb97a65dbfd
2015-12-02 06:46:28 -08:00
Alexander Blom 30a5eb51f8 Generate module definition on demand
Reviewed By: astreet

Differential Revision: D2707977

fb-gh-sync-id: fb2baa464a23df82e8b48a91a84c98370517d311
2015-12-02 06:25:28 -08:00
Olivier Notteghem 098fcb3a27 LayoutAnimation support for Android RN
Reviewed By: dernienl

Differential Revision: D2710141

fb-gh-sync-id: 28d6af84441b7c2dbc423b73eb05e71f62f7cdea
2015-12-01 19:06:32 -08:00
Denis Koroskin b828ae4200 Initial FlatUIImplemenatation
Summary: public This patch adds an alternative UIImplementation based on an idea of creating UI hierarchy off-the-main-thread (everything but Views), flattening ReactShadowNode hierarchy and displaying it within a single View when possible. While NativeViewHierarchyOptimizer allows removing layout-only RCTViews, this allows removing RCTView, RCTText and RCTImage.

This is an initial bare-bones implementation that doesn't really draw anything, only lays out the shadow nodes. Followup diffs will add missing features.

Reviewed By: astreet

Differential Revision: D2564309

fb-gh-sync-id: 2dda4c8cfc2bac3eb39c5c15e97bd23a57550a1d
2015-12-01 13:11:27 -08:00
Daniel Hugenroth b0e39d26ae implemented tracing async flow events (s, t and f)
Reviewed By: jkeljo

Differential Revision: D2699625

fb-gh-sync-id: 1d1b41fac157650e98a49307b701b6da63589c4b
2015-12-01 10:36:27 -08:00
Aaron Chiu b6f662d6b6 init Timing.java in a paused state
Summary: It hasn't been resumed yet when first constructed.

public

Reviewed By: astreet

Differential Revision: D2705635

fb-gh-sync-id: fa90a89524d56fd5e349ebad2820b42deba7f26f
2015-12-01 10:06:27 -08:00
Satish Sampath 765801dfc2 Improve JSC GC implementation on android
Reviewed By: astreet

Differential Revision: D2657643

fb-gh-sync-id: a049ee745de9a066a4a2da2762ec6a2f1517c78b
2015-12-01 08:50:32 -08:00
Dave Miller 7377fdcc70 Fix XY coords to be XY instead of YX
Summary: public

This fixes the ordering of methods in touch handling to take their arguments as X,Y instead of Y,X.

This is really just internal cleanup of native touch handling.

Reviewed By: andreicoman11

Differential Revision: D2703003

fb-gh-sync-id: d169436d21fd11c1a9cb251e7e0b57b2094699e4
2015-12-01 05:35:34 -08:00
Denis Koroskin baa97b2e9f Make ViewManagerRegistry class public
Summary: public I need to construct this class outside of the uimanager package, and this requires the class (and its constructor) to be public.

Reviewed By: astreet

Differential Revision: D2554847

fb-gh-sync-id: a73c3236b91a1ed7074521e19b72e1994804cced
2015-11-30 19:13:25 -08:00
Denis Koroskin 00046bc832 Allow extending NativeViewHierarchyManager
Summary: public This diff makes a few small changes to NativeViewHierarchyManager to allow extending it:
a) makes the class public so it can be constructed from outside of the package
b) adds resolveView and resolveViewManager to access mTagsToViews and mTagsToViewManagers
c) changes addRootView signature to make root view a ViewGroup instead of SizeMonitoringFrameLayout

The reason behind change c) is that in FlatUIImplementation I want to use a root view that does not extend SizeMonitoringFrameLayout. NativeViewHierarchyManager doesn't really use any of the root view properties, so it could be even a View, but ViewGroup seems more fitting.

This diff should contain no functional changes or other side-effects.

Reviewed By: astreet

Differential Revision: D2554841

fb-gh-sync-id: cce748707cf7485d456e4a057dae1db87aa17160
2015-11-30 18:59:26 -08:00
Denis Koroskin fe28118a48 When creating a View using NativeViewHierarchyManager, pass ThemedReactContext instead of root view tag
Summary: public NativeViewHierarchyManager.createView() takes int rootViewTag which is only used to resolve ThemedReactContext, but we already have it resolved before we enqueueCreateView, so we can just pass it directly. This makes mRootViewsContext tag -> to ThemedReactContext mapping unnecessary in NativeViewHierarchyManager. Makes the class simpler.

Reviewed By: kmagiera, astreet

Differential Revision: D2460280

fb-gh-sync-id: 68c503f4fb37ca0b1dcb2abc9e0c33a5225d1f6a
2015-11-30 18:21:40 -08:00
Denis Koroskin c4c74215fa Allow extending UIViewOperationQueue
Summary: public I need to extend NativeViewHierarchyManager to support a richer set of operations on Views, and those operations needs to be ran in UI thread.
Existing UIViewOperationQueue doesn't know about those operations, so I need to extend it too to allow them. This patch is making the class constructor protected to allow subclassing it from another package. Should not have any functional changes.

Reviewed By: astreet

Differential Revision: D2554826

fb-gh-sync-id: ad2d44a61beb216d940e20cd1489d3b5da1b398b
2015-11-30 17:43:27 -08:00
Denis Koroskin dd5bb96e44 Provide getters for CallerContext and DraweeControllerBuilder in ReactViewManager
Summary: public Right now there is no centralized place to initialize CallerContext for Fresco. It should probably go through FrescoModule, but currently it's going through ReactImageManager, and thus unavailable to FlatUIImplementation, that doesn't use ReactImageManager. So this diff provides public getters for CallerContext (and DraweeControllerBuilder) in ReactViewManager. This is hacky and generally should not be needed, but without it groups don't have correct CallerContext set.

Reviewed By: kmagiera, astreet

Differential Revision: D2569372

fb-gh-sync-id: 2622e69c64bfebfc575deb330ee77e0139efb7ec
2015-11-30 13:58:29 -08:00
Dave Miller c929e15523 Update touch handling to properly handle transformed Views
Summary: public

Our view handling for determining if a touch was in a view was not transform aware.  This updates it to be
transform aware (by borrowing the code from ViewGroup).

Now, touches will be correctly translated to the view if the view is transformed.  They will also have the correct
local touch point.

This fixes https://github.com/facebook/react-native/issues/3557

Reviewed By: andreicoman11

Differential Revision: D2696063

fb-gh-sync-id: 291f6b9884c610c29f8f8b9992c98d59863ab481
2015-11-30 06:12:24 -08:00
mkonicek pr tester c9dd4015f1 Better error handling in Android Geolocation module (PR 2)
Summary: Just a testing PR for the shipit bot (please don't close :))
Closes https://github.com/facebook/react-native/pull/4355

Reviewed By: svcscm

Differential Revision: D2702784

Pulled By: mkonicek

fb-gh-sync-id: 867c65dcea486750ca65a8437b37a0f658538111
2015-11-30 04:27:28 -08:00
Denis Koroskin 3dca8cf9fd Add UIImplementationProvider and allow overriding it in AbstractReactActivity
Summary: public UIImplementationProvider allows plugging in an alternative UIImplementation. A follow up diff adds a toggle under FB Dev Settings and uses this class to control an implementation. This allows us experimenting with other ways of generating UI hierarchy from JavaScript components.

Reviewed By: astreet

Differential Revision: D2554774

fb-gh-sync-id: 6574a893020e3519bd2ab00b9620a6dbdfaed595
2015-11-29 23:27:30 -08:00
Der-Nien Lee e8e7a2db57 @build-break revert of D2217731
Differential Revision: D2702368

fb-gh-sync-id: 64f53168610c5bf5f3dc22cd7e4dd6b4bb620b4c
2015-11-29 17:41:28 -08:00
olivier notteghem 593a45e319 LayoutAnimation support for Android RN
Reviewed By: astreet

Differential Revision: D2217731

fb-gh-sync-id: d990af4b630995f95433690d5dcf510382dc34d2
2015-11-29 16:33:26 -08:00
Alexander Blom 4890424562 Allow to pass in `ImagePipelineConfig` to `FrescoModule`
Summary: This allows an app to configure much more options in Fresco. public

Reviewed By: astreet

Differential Revision: D2700598

fb-gh-sync-id: e1ffff18bff270e14ef82c14f7bfeef984605738
2015-11-29 04:49:28 -08:00
Denis Koroskin fd0d987768 ShadowNodeHierarchyManager should be supplied externally to UIManagerModule
Summary: public UIManagerModule should not be creating UIImplementation. Instead, UIImplementation instance should be supplied to it to allow plugging in different implementations. No functional changes.

Reviewed By: astreet

Differential Revision: D2464632

fb-gh-sync-id: e7372977c93ceb7ef5e8658e5ee7e8e87f52d851
2015-11-28 11:59:28 -08:00
Felix Oghină 9e30c3b218 add native module overriding
Differential Revision: D2700638

fb-gh-sync-id: a88ffaf864be848e1bba22e443d301e4623f04ec
2015-11-27 06:31:12 -08:00
Oleksandr Stashuk af1475fc4c revert of D2699721
Reviewed By: lexs

Differential Revision: D2700660

fb-gh-sync-id: c59fc46e03146af9a1a6ce836070924d6bcfaba6
2015-11-27 04:28:28 -08:00
Konstantin Raev 01983c2f0a Ability to run unit tests in react-android-github via gradle
Reviewed By: mkonicek

Differential Revision: D2699804

fb-gh-sync-id: 7b31287407bacf2e8e3de6ee1c723a11bb2a0f27
2015-11-27 04:20:19 -08:00
Alexander Blom 2c0679bed1 Reuse DraweeControllerBuilder instead of allocating one for every image
Reviewed By: astreet

Differential Revision: D2699801

fb-gh-sync-id: 883e788f0a5c7231bf26f1ba4149115a15487366
2015-11-27 03:03:33 -08:00
Alexander Blom 699a75b01f Clear Fresco caches when going low on memory
Reviewed By: astreet

Differential Revision: D2699721

fb-gh-sync-id: 2d4685885ee254546496b0517633e5fe2de840d6
2015-11-27 03:03:28 -08:00
Mike Armstrong e1adea86c6 add timestamps to determine string convert time
Reviewed By: astreet

Differential Revision: D2684174

fb-gh-sync-id: feed759025e131fd913c6188f783d6920ad1839c
2015-11-27 02:53:26 -08:00
Andy Street a636ddd9f0 Backout D2677289 [react_native] View recycling in JS
Summary: public

We're seeing related crashes. The diff has no tests, the perf tests weren't conclusive, and the person who'd be supporting it no longer is available to work on it. We can try this again later in a less rushed manner with proper perf testing.

Reviewed By: davidaurelio

Differential Revision: D2696615

fb-gh-sync-id: 3b6814ac12af19516146d5c42d2add8321b10db5
2015-11-26 08:41:27 -08:00
Konstantin Raev c0f60d2018 Moved React Native Android unit tests to open source
Reviewed By: mkonicek

Differential Revision: D2685799

fb-gh-sync-id: 56f061df58641c8cb13fc16bad5f87039f0c49fb
2015-11-26 08:05:15 -08:00
SungHyun Park 9365414559 added TRACE_TAG_REACT_APPS constants
Summary: added required constants
Closes https://github.com/facebook/react-native/pull/4366

Reviewed By: svcscm

Differential Revision: D2699433

Pulled By: astreet

fb-gh-sync-id: 33c69b248f682e1b31bb2ef79cb0253ddd8d8817
2015-11-26 03:35:32 -08:00
Denis Koroskin 76e033ead9 Extract shadow hierarchy logic from UIManagerModule into UIImplementation
Summary: public This diff extracts all shadow hierarchy-specific logic from UIManagerModule into a UIImplementation class. This will later allow using in alternative UIImplementations in future.

Reviewed By: astreet

Differential Revision: D2457849

fb-gh-sync-id: 532128ce1d67b525cdf03794a5a29d7e9ed0ab90
2015-11-25 22:15:37 -08:00
Denis Koroskin aeda31428d When addRootView() is called in a background thread, execute it as a generic UIOperation command in UIViewOperationQueue
Summary: public There is really no reason NativeViewHierarchyManager.addRootView() should be performed synchroniously when called from background thread, as long as it is executed before every other command in UIViewOperationQueue, and we can ensure that by putting add view command at the front of the queue. When that happpens, the queue should always be empty anyway, but it's best to be safe.

This eliminates an unnecessary blocking call and should overall make the code simpler and safer (Semaphores can timeout).

Reviewed By: astreet

Differential Revision: D2462680

fb-gh-sync-id: 784ac6573a455019b93628c70992f3830b9d6f1f
2015-11-25 22:15:32 -08:00
Denis Koroskin 16350ae09b Remove AnimationRegistry from UIManageModule
Summary: public UIManageModule creates AnimationRegistry but never uses it, this diff moves it to NativeViewHierarchyManager who owns it. UIViewOperationQueue depends on AnimationRegistry to perform some of the enqueued operations, so it accessed it through a getting in NativeViewHierarchyManager. This will also make sure NativeViewHierarchyManager. and UIViewOperationQueue operate on the same AnimationManager (previously, that wasn't really enforced). This is needed so I can move away UIViewOperationQueue creation off the UIManagerModule. This diff should have no functional changes whatsoever.

Reviewed By: astreet

Differential Revision: D2462605

fb-gh-sync-id: 1e3cd64908f51126362f2b5fb39b1efa6521854e
2015-11-25 22:15:26 -08:00
Brent Vatne ae09a10c95 Add onLoadX support on Android
Summary: ~~This is a WIP, just finished the first bit and wanted to get some feedback to see if this approach seems appropriate, as I haven't done a lot of Android development.~~

Looks ready for review now.
Closes https://github.com/facebook/react-native/pull/3791

Reviewed By: svcscm

Differential Revision: D2672262

Pulled By: mkonicek

fb-gh-sync-id: 1e8f1cc6658fb719a68f7da455f30a7c9b1db730
2015-11-25 18:30:31 -08:00
Kyle Corbitt b65f1f2234 Use elevation to implement shadows on Android
Summary: This PR includes a working interface to Android's `elevation` property implemented as an RN style. Elevation is the only (easy) [platform-supported way to create shadows](http://developer.android.com/training/material/shadows-clipping.html). For it to work note that you must be running on Android 5.0+, and add `elevation` to a view with a `backgroundColor` set. These are platform limitations.

This PR is not intended to be merged in its current state, but rather to inform the discussion from #2768. At a minimum, before merging we would need to add the elevation style to the docs and rebase this to master (**EDIT** I have now rebased on master because from v0.14.2 too many commits were being pulled in -- haven't tested it since the rebase though). Additionally, it might be good to add tests, although I couldn't find any for the Android code. I'm happy to get that done if this feature gets signed off by the React Native team.

Finally, as I argued in #2768 I think that `elevation` is a useful abstraction ov
Closes https://github.com/facebook/react-native/pull/4180

Reviewed By: svcscm

Differential Revision: D2684746

Pulled By: mkonicek

fb-gh-sync-id: 825f3ccd20c4b0eea9d11b5f0e3a6b018b7e4378
2015-11-25 18:28:29 -08:00
Andy Street ca016e4eb3 Add perf markers for cold start
Summary: public

Adds useful systrace perf markers for cold start analysis

Reviewed By: mikearmstrong001

Differential Revision: D2695629

fb-gh-sync-id: d964f28a1f3e10a13c441a17b0300c980d4914e8
2015-11-25 05:58:31 -08:00
Pieter De Baets 38db6fa465 Remove scrollview support from UIManager, remove mainScrollView(delegate)
Reviewed By: nicklockwood

Differential Revision: D2692749

fb-gh-sync-id: 48975d2f09f3b2902dfa2e56ff9d34257b2395bc
2015-11-25 04:12:34 -08:00
Mike Armstrong aaffb239ca Allow the output of the JSC profile to be specified in JS
Reviewed By: astreet

Differential Revision: D2674869

fb-gh-sync-id: 15e192015ecc9291359d6c988e793849eac97513
2015-11-25 01:35:23 -08:00
Alexander Blom 2b22d22a83 Clear static arg arrays after use
Reviewed By: astreet

Differential Revision: D2690812

fb-gh-sync-id: b00291c57e294eece5772531e9f16e0c60b8b8f4
2015-11-24 10:58:45 -08:00
Alexander Blom 69c8dd50fe Avoid leaking FrescoModule when setting SoLoaderShim handler
Summary: The anonymous class had an implicit reference back to FrescoModule that would in turn retain the context.

public

Reviewed By: astreet

Differential Revision: D2690747

fb-gh-sync-id: 8a97c102e461b903c6adf7c65956baf364fa5faf
2015-11-24 10:58:38 -08:00
Alexander Blom 5387df8dc5 Make ReactDatabaseSupplier use application context
Summary: public
We pass in a `ReactContext` but we really only need a context. Make sure we're using the application one.

Reviewed By: astreet

Differential Revision: D2690692

fb-gh-sync-id: 857d6571c9c01d35e12f09be4c8733cca007306f
2015-11-24 10:58:32 -08:00
Alexander Blom 3a00545bc7 Remove cookie handler on destroy
Reviewed By: andreicoman11, astreet

Differential Revision: D2690634

fb-gh-sync-id: a2ab8ce52dd501eed88f166b4c218886ea229744
2015-11-24 10:58:25 -08:00
Konstantin Raev 37f81341a0 Open source SwipeRefreshLayoutAndroid
Reviewed By: mkonicek

Differential Revision: D2679605

fb-gh-sync-id: 7f3e7384b37f29002ddd8cb7a4567fa96c76f047
2015-11-24 10:15:14 -08:00
Dave Miller 7bfbc5dd00 Add support for providing AbstractDraweeControllerBuilder to TextInlineImageSpan similar to ImageView
Reviewed By: andreicoman11

Differential Revision: D2690762

fb-gh-sync-id: 80596575d3fa577f8eb05d9f44f72337a640a3db
2015-11-24 08:04:30 -08:00
Andy Street 05c79059ae Reduce logcat spew when checking packager status
Summary: public

The common case is to hit an error when the server isn't running. We shouldn't spew a stack trace for it.

Reviewed By: foghina

Differential Revision: D2685706

fb-gh-sync-id: d230af170b92a05452f04a90f23172f15e62dce6
2015-11-24 04:53:27 -08:00
Denis Koroskin ac0134322f Remove UIManagerModule dependency in UIViewOperationQueue
Reviewed By: astreet

Differential Revision: D2463226

fb-gh-sync-id: eafc876ca750a08406917d8bbbfe87c27a4649fd
2015-11-23 14:29:31 -08:00
Peter Lai 56a56f33d1 add method to determine if current activity is null
Reviewed By: andreicoman11

Differential Revision: D2680281

fb-gh-sync-id: ac158fb55dd60d05b7e3444d68e06a010e04eef4
2015-11-23 10:49:34 -08:00
Dave Miller 0c2ee5d480 Update Android Touch events
Summary: public

This moves Android touch events to parity with iOS.  The locationX,Y value passed to js now is view relative to the view that is handling the touch.
The pageX,Y is now relative to the root view.

Reviewed By: andreicoman11

Differential Revision: D2670028

fb-gh-sync-id: 5438640d6c78633629b9a308a59cc306bb07815e
2015-11-23 09:30:37 -08:00
Alexander Blom 274c5c78c4 Support cookies on Android
Summary: This adds a persistent cookie store that shares cookies with WebView.

Add a `ForwardingCookieHandler` to OkHttp that uses the underlying Android webkit `CookieManager`.
Use a `LazyCookieHandler` to defer initialization of `CookieManager` as this will in turn trigger initialization of the Chromium stack in KitKat+ which takes some time. This was we will incur this cost on a background network thread instead of during startup.
Also add a `clearCookies()` method to the network module.

Add a cookies example to the XHR example. This example should also work for iOS (except for the clear cookies part). They are for now just scoped to Android.

Closes #2792.

public

Reviewed By: andreicoman11

Differential Revision: D2615550

fb-gh-sync-id: ff726a35f0fc3c7124d2f755448fe24c9d1caf21
2015-11-23 03:21:31 -08:00
Alexander Blom f57c2a9140 Add GuardedResultAsyncTask
Reviewed By: andreicoman11

Differential Revision: D2679459

fb-gh-sync-id: 8a9ec170ce76bbc3340c9e8872e19b78ae5a5c2d
2015-11-23 03:21:25 -08:00
Marc Horowitz 9a61628f13 Clean up the interface to the bridge
Summary: Change the following classes into interfaces, with a separate
Impl file:  CatalystInstance, ReactInstanceManager,
CatalystQueueConfiguration, MessageQueueThread.  This is done to help
isolate the interface between React Native and applications which use it.
This will also help some intrusive development work on a branch
such as porting parts of the bridge to common C++ code, without affecting
app reliability while this work is ongoing.
public

Reviewed By: astreet

Differential Revision: D2651277

fb-gh-sync-id: f04dc04a6e68df7acbc2bbf8b2529287d7b5b2ae
2015-11-20 12:30:30 -08:00
Marc Horowitz facf8a56d2 minor build cleanups
Summary: make DevSupportManager PUBLIC visibility, instead of adding
to it more; put private parts of OnLoad into an anonymous namespace,
and move NativeRunnable into it; don't make NativeArray depend on
MethodCall which it does not use.
public

Reviewed By: astreet

Differential Revision: D2651270

fb-gh-sync-id: d5262da79cbd60c4eb490d43d13cc625fa163cdf
2015-11-20 12:29:33 -08:00
Marc Horowitz c8f3b43984 Don't use the Bridge from CatalystInstance.
Summary: getBridge() is annotated VisibleForTesting, but still used
in DevSupportManager.  Instead, add the necessary methods to the
CatalystInstance interface.
public

Reviewed By: astreet

Differential Revision: D2651265

fb-gh-sync-id: 395893a961c32843871de4451eeccb33135b7ede
2015-11-20 12:29:27 -08:00
Marc Horowitz 5b6b5a64d1 Split JavaSJExecutor and ProxyExecutorException into their own file
Summary: This makes the exception a nested class of the interface,
which eliminates the dependency of DevSupportManager on
ProxyJavaScriptExecutor.
public

Reviewed By: astreet

Differential Revision: D2651252

fb-gh-sync-id: 99de1c308b9bce717ab749c4e239d2773a920e1f
2015-11-20 12:29:20 -08:00
Marc Horowitz 67209e6396 If fbsystrace is running when catalyst starts, it asserts
Summary: registering with systrace checks if the bridge is
initialized, which it's not yet in the ctor.  Defer registration until
after the bridge is created, and only unregister in that case.
public

Reviewed By: astreet, dreiss

Differential Revision: D2651244

fb-gh-sync-id: 8da1108e9d15fddde48d06f4ed61ee0f787016ad
2015-11-20 10:10:29 -08:00
Saurabh Aggarwal a7c4ed106b Adds stetho interceptor to the OSS react native networking module
Reviewed By: mkonicek

Differential Revision: D2669416

fb-gh-sync-id: d061711a412348b16ffb877e0178a05460fd95f2
2015-11-20 09:44:27 -08:00
Krzysztof Magiera 205a35ad37 View recycling in JS.
Summary: public
Native view recycling implementation based on limited pools of views.

In this diff I introduced new UIManager method: dropViews. Instead of removing views from tag->view maps when they are detached we keep them there until we get a call to dropViews with the appropriate tag. JS may keep a pool of object and selectively decide not to enqueue drop for certain views. Then instead of removing those views it may decide to reuse tag that has been previously allocated for a view that is no longer in use.

Special handling is required for layout-only nodes as they only can transition from layout-only to non-layout-only (reverse transition hasn't been implemented). Because of that we'd loose benefits of view flattening if we decide to recycle existing non-layout-only view as a layout-only one.

This diff provides only a simple and manual method for configuring pools by calling `ReactNativeViewPool.configure` with a dict from native view name to the view count. Note that we may not want recycle all the views (e.g. when we render mapview we don't want to keep it in memory after it's detached)

Reviewed By: davidaurelio

Differential Revision: D2677289

fb-gh-sync-id: 29f44ce5b01db3ec353522af051b6a50924614a2
2015-11-20 08:11:36 -08:00
Krzysztof Magiera 0c8850f3a7 Only send layout update operation to nativehierarchymanager when layout actually changes.
Reviewed By: andreicoman11

Differential Revision: D2679408

fb-gh-sync-id: 7f0a972e9e12f70402e2d285edef458a61ca1c39
2015-11-20 08:04:29 -08:00
Krzysztof Magiera 1195f9c8e8 Further improvements in RecyclerViewBackedScrollView.
Summary: public
Changed ListView to use onLayout and onContentSizeChange (new) events instead of measure. Updated ScrollView implementation to support contentSizeChange event with an implementation based on onLayout attached to the content view. For RecyclerViewBackedScrollView we need to generate that event directly as it doesn't have a concept of content view.
This greatly improves performance of ListView that uses RecyclerViewBackedScrollView

Reviewed By: mkonicek

Differential Revision: D2679460

fb-gh-sync-id: ba26462d9d3b071965cbe46314f89f0dcfd9db9f
2015-11-20 07:44:31 -08:00
Krzysztof Magiera 7cd7591f04 Use requireNativeComponent in View.js.
Summary: public
In a previous diff I've removed a need for using View attributes in requireNativeComponent. Thanks to that we can now use requireNativeComponent in View module. In a follow up diff I'll be getting rid of ReactNativeViewAttributes.

Reviewed By: sahrens

Differential Revision: D2676088

fb-gh-sync-id: d5d6e50f4629bd7982b90f3496e1fd22078e96a8
2015-11-20 02:09:38 -08:00
Mike Armstrong 3e7db56445 Fix multiple calls to createReactContextInBackground
Reviewed By: astreet

Differential Revision: D2674440

fb-gh-sync-id: f842826516d2b03291ad0c4bf5c8dcbf8ec0f3a9
2015-11-19 08:20:26 -08:00
Mike Armstrong 2a9a5fc9e8 css layout systrace markers
Reviewed By: astreet

Differential Revision: D2668741

fb-gh-sync-id: 043ff740f8cc7c687a79c50c933db99ed67b60e4
2015-11-19 06:52:27 -08:00
Andy Street 530ee3eeac Initialize JS executor and context at loadApp time
Summary: Automatically starts loading the RN instance as soon as loadApp is called instead of waiting for the UI to be constructed and attached to the window. This saves ~75ms of cold start time on GN 2011 phones.

Also, updates the contract for createReactContextInBackground such that it is only called once (so that people don't accidentally initialize more than once).

See http://imgur.com/a/d7qVm for systrace visualization.

public

Reviewed By: kmagiera

Differential Revision: D2652279

fb-gh-sync-id: 6e7b1fa5dea091af0d568834e11ed23eb1a7860e
2015-11-18 12:40:27 -08:00
Martin Konicek 494930afb2 Open source the Android Location module
Reviewed By: foghina

Differential Revision: D2658581

fb-gh-sync-id: e95b21c5c7c06f3332d2a7c9fab8be9a2e6441cb
2015-11-18 10:15:21 -08:00
Krzysztof Magiera 9e670a64fc Fix resetting margins and borders on android.
Summary: public

Instead of using 0 as a default we should use UNDEFINED values. That is because setting 0 for left border in case when the property was deleted will interfere with horizontal border (or margin) value. Setting UNDEFINED makes CSSLayout nodes behave correctly in that case.

Reviewed By: andreicoman11

Differential Revision: D2668669

fb-gh-sync-id: 61ce62081583fc39864268333ac8c1409c276cad
2015-11-18 08:41:28 -08:00
Krzysztof Magiera e6093cff04 Use requireNativeComponent with propTypes for Android components.
Reviewed By: davidaurelio

Differential Revision: D2663502

fb-gh-sync-id: 550e7b7c783ec0463a6beb052c09a768a8086056
2015-11-18 06:36:28 -08:00
Andrei Coman 32c19c1994 Fix setting js responder for null react view for tag
Reviewed By: kmagiera

Differential Revision: D2637015

fb-gh-sync-id: 03af870cee82519ed34a4bbbcbd2c72146fcf00f
2015-11-18 04:28:27 -08:00
Felix Oghină e22fb312d2 reorder dev menu, surface live reload and perf monitor
Differential Revision: D2663707

fb-gh-sync-id: 42663a14e1bda7896867692473ae0bf3753aafe2
2015-11-17 08:14:27 -08:00
Felix Oghină 8491b579c8 fix inspecting text elements
Differential Revision: D2663651

fb-gh-sync-id: 2b583fecf5fa7a88f071a7441d03b95d21b8620f
2015-11-17 07:58:26 -08:00
Andrei Coman fc511f0730 Don't send same text changes from text input
Differential Revision: D2663576

fb-gh-sync-id: 259040eda54982c10374f9f1ee89f67a459937d0
2015-11-17 07:30:31 -08:00
Alexander Blom 532c9112b4 Send HEADERS_RECEIVED and LOADING events on Android
Summary: Send part of the response body every 100 ms if the client has set onreadystatechange. This
is done by using the same events as the iOS code and removing the callback that Android previously
used.

Reconsolidate iOS and Android implementations.

Closes #3772

(The previous commit was reverted)

public

Reviewed By: astreet

Differential Revision: D2658153

fb-gh-sync-id: b1a32d22db7cc2995c673edd31f4bbaf16ca36cb
2015-11-17 06:31:31 -08:00
Krzysztof Magiera 337dc7e093 Cleanup mNativeChildren on react node cleanup.
Differential Revision: D2663443

fb-gh-sync-id: 7e6e7212103b738f6b6f535e54cc8b86e5def685
2015-11-17 05:47:25 -08:00
Krzysztof Magiera bd1885b5d4 Cleanup native view hierarchy when view is dropped.
Differential Revision: D2659738

fb-gh-sync-id: 1c14b8c3c6fabbd0e580777bb94221df6dd98f71
2015-11-17 02:06:28 -08:00
olivier notteghem e4f0971a55 Re-land D2656590 in iOS repo which is the source of truth
Reviewed By: newobj

Differential Revision: D2660019

fb-gh-sync-id: 7cc183888f88d9971f59b23f45a86b5aa0391909
2015-11-16 13:54:30 -08:00
Mike Armstrong 619da521f3 Enable javascript systrace markers via js module
Differential Revision: D2658662

fb-gh-sync-id: 042377551f9dacc0a9d12728edfa54a57c617cf4
2015-11-16 09:46:34 -08:00
Mike Armstrong 2f9e7be04b fix output leaving bad characters in systrace output buffer due to overstepping bytes written
Differential Revision: D2658628

fb-gh-sync-id: e4c9dc66746177d371331d79972f1322239b4ea7
2015-11-16 09:39:31 -08:00
Nathan Spaun 39ec693866 revert D2631410
Differential Revision: D2655673

fb-gh-sync-id: 115247373767690e63a0d6ce812a578d26b47289
2015-11-13 17:51:30 -08:00
Dave Miller a0268a7bfc Initial checkin for Image within Text nodes
Summary: This adds the basic support for embedding an image in a TextView.

Implementation details :

We create a ReactTextInlineImageShadowNode whenever an Image is embedded within a Text context.
That uses the same parsing code as ReactImageView (copied, not shared) to parse the source property to figure out the Uri where the resource is.

In ReactTextShadowNode we now look for the ReactTextInlineImageShadowNode and place a TextInlineImageSpan so that we can layout appropriately

Later at the time we go to setText on the TextView, we update that TextInlineImageSpan so that the proper Drawable (downloaded via Fresco) can be shown

public

Reviewed By: mkonicek

Differential Revision: D2652667

fb-gh-sync-id: 8f24924d204f78b8bc4d5d67835cc73b3c1859dd
2015-11-13 11:16:27 -08:00
Brent Vatne 50b8b00768 Add setPageWithoutAnimation
Summary: In some cases it's desirable to set the page in the ViewPager without animating it -- we have this in ScrollView with `scrollWithoutAnimationTo`. This PR adds `setPageWithoutAnimation` on ViewPager.

cc ide kmagiera
Closes https://github.com/facebook/react-native/pull/3621

Reviewed By: svcscm

Differential Revision: D2652056

Pulled By: mkonicek

fb-gh-sync-id: 6f1f38558c41ffdd863c0ebb2f046c75b5c0392c
2015-11-13 08:05:27 -08:00
Alexander Blom 4d4c48d32b Send HEADERS_RECEIVED and LOADING events on Android
Summary: Send part of the response body every 100 ms if the client has set onreadystatechange. This
is done by using the same events as the iOS code and removing the callback that Android previously
used.

Reconsolidate iOS and Android implementations.

Closes #3772

public

Reviewed By: mkonicek

Differential Revision: D2647005

fb-gh-sync-id: d006e566867fa47d5f8dff71219cb390bcb8e15a
2015-11-13 07:28:28 -08:00
Martin Konicek ab7b3b2dea Open source IntentAndroid
Summary: Move the code to the github folder, add more docs and improve the example.

We might want to merge this with `LinkingIOS` later (it has the same functionality
plus support for deep links) but want to see how people use the `IntentAndroid`
API first (and what other methods we should add) to have more data points.

public

Reviewed By: lexs

Differential Revision: D2646936

fb-gh-sync-id: 751f35784d387efcd031f9b458821cdfde048a54
2015-11-12 12:41:32 -08:00
Andrei Coman 8ca22fc2df Fix typeface getting applied recursively without new style
Differential Revision: D2643562

fb-gh-sync-id: 0db52c223d4941c89f2253bb3f4b2a5af8341ecf
2015-11-11 13:11:28 -08:00
Krzysztof Magiera d8032b1c7d Upgrading okio and fresco.
Reviewed By: foghina

Differential Revision: D2636757

fb-gh-sync-id: 82dee46232ac2654870f727633604c86d569005e
2015-11-11 01:55:30 -08:00
Krzysztof Magiera 5695ebdcf4 Perf improvements to RecyclerViewBackedScrollView.
Differential Revision: D2641500

fb-gh-sync-id: 7ec6e2863bccebc98f75f586c0f17d509808d46b
2015-11-11 01:21:26 -08:00
Andy Street f00e748ebd Cleanup for inlines in D2595474
Differential Revision: D2637224

fb-gh-sync-id: 6947a06e2f2b9606fff84addec69dbc51cee84da
2015-11-10 10:24:29 -08:00
Krzysztof Magiera caf111eb23 Update okhhtp version to 2.5
Reviewed By: andreicoman11

Differential Revision: D2636394

fb-gh-sync-id: 1f4df9ae879e16f13c5343baed85a91469d88cff
2015-11-10 03:20:29 -08:00
Felix Oghină 0c27c3fde9 A bit of JavaClass refactoring
Differential Revision: D2636047

fb-gh-sync-id: 72e06634ca94f03a6ec6d4aa733be38e7157cf8a
2015-11-09 22:05:29 -08:00
Felix Oghină dd8ee4ad75 remove extraneous dimension conversion
Differential Revision: D2635753

fb-gh-sync-id: dd7d965ceb90c2c4771d4d28bbc6ec9ef97eca0c
2015-11-09 19:47:29 -08:00
Peter Lai de4cb7d403 Fix crash when double launching activity
Reviewed By: AaaChiuuu

Differential Revision: D2633573

fb-gh-sync-id: c47bec903d54c12f4d9e576ad1aaf16d4bd68f30
2015-11-09 14:56:27 -08:00
Krzysztof Magiera c6532a94a6 Fix default values for translateX/Y props.
Reviewed By: andreicoman11

Differential Revision: D2631186

fb-gh-sync-id: 8f898b11be31b253780474d1cf328d7d109decbb
2015-11-09 07:55:27 -08:00
Dmitry Gladkov b12117a038 Fix View translations in Android
Summary: Fixes regression in bf59864

Closes #3773
Closes https://github.com/facebook/react-native/pull/3954

Reviewed By: svcscm

Differential Revision: D2631180

Pulled By: kmagiera

fb-gh-sync-id: 09a1a2e48fd6fff37d1491c120a28221cdc1b163
2015-11-09 00:02:19 -08:00
Pasquale Anatriello bfeaa6a4f5 Custom fonts support added
Reviewed By: andreicoman11

Differential Revision: D2629077

fb-gh-sync-id: 8d647aff13f97d90c5047ad0ddbcae90215ca4ca
2015-11-06 18:15:31 -08:00
Andy Street 853d249468 Add Systrace support for API 18+ in OSS
Differential Revision: D2627757

fb-gh-sync-id: a01347800d8e9ffda8759cc17df04f7cd139b17c
2015-11-06 14:02:35 -08:00
Adrov Igor b6340ee2b0 implement android maxlength prop
Summary: Fixes https://github.com/facebook/react-native/issues/3864
But I don't sure that this code is correct.

But it works and works same as in iOS.
Closes https://github.com/facebook/react-native/pull/3873

Reviewed By: mikearmstrong001

Differential Revision: D2626122

Pulled By: andreicoman11

fb-gh-sync-id: 316915c99b218ed5f32ca90fd72ce9810571383a
2015-11-06 13:25:34 -08:00