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
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
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
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
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
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
Summary:
Catalyst is the old project name. Rename a few files.
public
Reviewed By: bestander
Differential Revision: D2859553
fb-gh-sync-id: 65a87cc7bcc22f20326971becec02aa1c573e5b9
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
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
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
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
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
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
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
Summary:
this helps with cleaning up some tests
public
Reviewed By: astreet
Differential Revision: D2816285
fb-gh-sync-id: 37c4da7bdb3c8b5439184316bb5a8939160b40a3
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Summary:
public
This adds support for
onScrollBeginDrag/End
onMomentumScrolBegin/End
Reviewed By: astreet
Differential Revision: D2739035
fb-gh-sync-id: 2a49d1df54e5f5cd82008bdb0ffde0881ba39aff
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
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
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
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
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
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
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
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
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
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
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
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
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
Summary: It hasn't been resumed yet when first constructed.
public
Reviewed By: astreet
Differential Revision: D2705635
fb-gh-sync-id: fa90a89524d56fd5e349ebad2820b42deba7f26f
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
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
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
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
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
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
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
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
Summary: This allows an app to configure much more options in Fresco. public
Reviewed By: astreet
Differential Revision: D2700598
fb-gh-sync-id: e1ffff18bff270e14ef82c14f7bfeef984605738
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Summary: This patch adds two pieces of functionality:
- Exposes `JSBundleLoader` to allow a developer to load JavaScript bundles as they choose.
- Adds `ReactBridge.loadScripFromFile` method which loads a JavaScript bundle from an arbitrary file path.
Example usage:
```
JSBundleLoader jsBundleLoader = new JSBundleLoader() {
Override
public void loadScript(ReactBridge reactBridge) {
reactBridge.loadScriptFromFile("/sdcard/Download/index.android.bundle");
}
};
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setJSBundleLoader(jsBundleLoader)
.setJSMainModuleName("") /* necessary due to TODO(6803830) */
.addPackage(new MainReactPackage())
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
```
cc ide
Closes https://github.com/facebook/react-native/pull/3189
Reviewed By: svcscm
Differential Revision: D2535819
Pulled By: mkonicek
fb-gh-sync-id: f319299dbe29bab3b7e91f94249c14b270d9fec3
Summary: This allows the use of different bundle URLs & ports in Dev mode. (ie. ngrok url shared with a team member)
The bundle URL can be changed via the normal Dev Menu, or programmatically by setting the `debug_http_host` shared preference key.
For example, in your apps `MainActivity.java` before creating your `ReactRootView`:
```java
SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(getApplication());
SharedPreferences.Editor editor = mPreferences.edit();
editor.putString("debug_http_host", "my.customurlandport.com:8888");
editor.commit();
```
**Breaking change**: Custom bundle URLs added via the Dev Menu will need to also include the port. This has been noted in the documentation and also on the preference description in the Dev Menu.
Addresses: https://github.com/facebook/react-native/issues/2704
Closes https://github.com/facebook/react-native/pull/2824
Reviewed By: @svcscm
Differential Revision: D2540450
Pulled By: @javache
fb-gh-sync-id: a053de91e3095bb67640bb0f1b8761e55775bc9c
Summary: @public
See the discussion in https://github.com/facebook/react-native/pull/3019
This is temporary Gradle output and can be huge (>100MB).
Reviewed By: @foghina
Differential Revision: D2531612
fb-gh-sync-id: 8874d39b1a9b35dc4b4ce465dd149589db75bb29
Summary: The JavaScript code for Android is same as the iOS counterpart, I just added few new lines and used arrow functions instead of binding `this`.
Closes https://github.com/facebook/react-native/pull/2839
Reviewed By: @svcscm, @vjeux
Differential Revision: D2498703
Pulled By: @mkonicek
fb-gh-sync-id: 3fe958dd5af0efba00df07515f8e33b5d87eb05b
Summary: Also fixed the extra slash before first-party in that path (it was ...//first-party
and is now .../first-party). The $dir funct always produces a result that ends with
a /, so APP_MK_DIR always ends in a / and no extra / is needed when appending to it.
With these two changes all of React Native for Android, including C++, seems to
build OK on Windows 😄
Closes https://github.com/facebook/react-native/pull/2961
Reviewed By: @svcscm
Differential Revision: D2512239
Pulled By: @kmagiera
fb-gh-sync-id: 4fbc9fc85bab455b8ed1e07a8ac299a48921753e
Summary: This adds support for animated GIFs on Android! Looking forward to some meme apps :)
Also, Fresco is awesome.
Closes#2997.
@public
Reviewed By: @mkonicek
Differential Revision: D2477540
committer: Service User <svcscm@fb.com>
Summary: `ScrollView.scrollWithoutAnimationTo` is supported on iOS but not Android. This is an existing API, and this diff adds Android support.
Closes https://github.com/facebook/react-native/pull/2695
Reviewed By: @svcscm
Differential Revision: D2452630
Pulled By: @mkonicek
Summary: but the NDK build command can't be found in that directory. This
more explicit error now shows the full NDK path where it's looking
and (importantly) includes a hint that backslashes need to be escaped
on Windows for ndk.dir. When I built on Windows the first time,
I didn't realize ndk.dir backslashes needed to be escaped and the
generic "not found" error made the root cause harder to track
down. This change should help others that build on Windows & run into
the same.
Closes https://github.com/facebook/react-native/pull/2960
Reviewed By: @svcscm
Differential Revision: D2470761
Pulled By: @kmagiera
This is an early release and there are several things that are known
not to work if you're porting your iOS app to Android.
See the Known Issues guide on the website.
We will work with the community to reach platform parity with iOS.