Commit Graph

2791 Commits

Author SHA1 Message Date
Ram N c31f79fe47 Remove class loads for CoreModulesPackage
Summary: CoreModulePackages was following the old way of adding Native Modules to the Array list. This diff changes it to use names instead of class.

Reviewed By: achen1

Differential Revision: D9996803

fbshipit-source-id: a6c3daf2193a2559db0908f9e26e339e03e4f8c7
2018-09-21 21:17:57 -07:00
Janic Duplessis a6f47d46ca Decode gzip body if not handled by okhttp (#21187)
Summary:
When looking at enabling gzip content encoding on Android I stumbled on this old issue where the body content is not decoded. It happens because okhttp only handles gzip decoding if the user does NOT provide an accept-encoding header. This is pretty confusing because on iOS we need to pass the header manually if we want to receive a gzipped response. I think it makes sense to handle the decoding no matter what.

See the comment in code for more details.

Fixed #5297
Pull Request resolved: https://github.com/facebook/react-native/pull/21187

Differential Revision: D9978889

Pulled By: hramos

fbshipit-source-id: b86791fb7d3157f325a0904225d2f63d166080d5
2018-09-20 15:07:02 -07:00
Héctor Ramos 5068dfcad3 Use Android SDK 27 in React Native
Summary:
Upgrade React Native to Android SDK 27 again, following the reversal in D9886607 (68c7999c25).

The SDK 27 is actually available internally in an alternate location that is suitable for use cases like React Native's. For future reference, SDK 28 is also available for use in this location.

Reviewed By: axe-fb

Differential Revision: D9929066

fbshipit-source-id: 9413f891d5587293a30544351340e9407a2dce55
2018-09-20 07:56:23 -07:00
Ram N 8bd570b7ba Initialize Native Modules in a separate thread
Reviewed By: achen1

Differential Revision: D9693326

fbshipit-source-id: 1ccefa4a7a320a6720bbd31f60a96f49ec5f8974
2018-09-19 23:17:34 -07:00
Ram N 0cd3994f1a Channge interface to getNativeModule to use strings instead of classes
Summary: Now that NativeModules are stored based on String keys instead of classnames, the old innterface to getNativeModules(Class moduleInterface) is deprecated. This interface is also incorrect since a native module with the same name may be overridden, causing issues. Getting native modules by name is also similar to what JavaScript does

Reviewed By: achen1

Differential Revision: D9697827

fbshipit-source-id: ff832bd2ea5e1c7cfe7d8c0c3a66f0d755b2c354
2018-09-19 19:53:00 -07:00
David Aurelio 5f31a1082b Support `!`-style fast calls for Android
Summary:
Adds support for `!`-style fast calls in Android versions < 8.

For now, this comes with the following restrictions:

- has to be enabled with a macro
- only supports native functions that return and accept primitive Java types (`jint`, `jdouble`, etc.), and `void`
- this is supposed to map to `CriticalNative` as described in https://source.android.com/devices/tech/dalvik/improvements#faster-native-methods.

Inline documentation in art: http://androidxref.com/6.0.1_r10/xref/art/runtime/jni_internal.cc#2110

Possible follow ups:
- don’t prefix when the Android runtime is too new (to avoid the warning, and future error, see http://androidxref.com/8.1.0_r33/xref/art/runtime/jni_internal.cc#2355)
- shim `CriticalNative` (see https://android.googlesource.com/platform/libcore/+/master/dalvik/src/main/java/dalvik/annotation/optimization/CriticalNative.java)
- test whether we can use `CriticalNative` at all (docs claim classes must be on bootclasspath)
- suppport `FastNative`, i.e. instance methods that can also receive and return `jobject`

Reviewed By: cjhopman

Differential Revision: D9630538

fbshipit-source-id: 0ae86c909b192429d60f8eddb15528cc38610379
2018-09-19 17:32:46 -07:00
David Vacca 6b0512c819 Enable Fabric test using Fabric C++ implementation
Summary:
This diff:
- Disables all tests but one of FabricViewTest
- Disables all tests but one of FabricBenchmarkTest
- Changes ReactAppTestActivity to run with Hermes

The reason there is only one test running in each test class, is because the tear down process of Fabric is still flaky and it produces crashes when restarting RN. We are working on this right now and we will enable the rest of the tests after that's fixed.

Reviewed By: achen1

Differential Revision: D9890700

fbshipit-source-id: a8716481eff15b77bd12b38aaaefd4e282c71f3b
2018-09-19 08:03:21 -07:00
David Vacca 7e7040b7bd Remove Fabric android implementation
Summary: This diff removes the Fabric Android implementation in favor of Fabric C++, as part of another diff I'm going to move the fabricxx package into fabric package

Reviewed By: shergin

Differential Revision: D9841240

fbshipit-source-id: c7922b7bfb9885f33b1f52237ec7cf00c1df96fb
2018-09-19 08:03:20 -07:00
Héctor Ramos 68c7999c25 Downgrade to compileSdkVersion 26
Summary:
Go back to using compileSdkVersion 26 and targetSdkVersion 26, temporarily. We can re-add this once Android SDK 27 becomes available in Facebook's internal repository.

The Android SDK Build Tools 27.0.3 **are** available, so we can continue using those.

Reviewed By: axe-fb

Differential Revision: D9886607

fbshipit-source-id: 6c1c9c1e1309c3a0483cc4c0bd8dcb4a5f29fc7e
2018-09-18 08:02:50 -07:00
David Vacca 9ad193c35b Implement Local Data in Android Fabric C++
Summary: This diff introduces the concept of Local Data in Android Fabric C++ and as an example we uses it to implement Text View.

Reviewed By: shergin

Differential Revision: D9583970

fbshipit-source-id: ab7478b16ef4327ff574ca1467870ab9cb684ea0
2018-09-17 18:49:06 -07:00
David Vacca 5c0da011cb Add support to measure shadow nodes in the FabricUIManager
Summary: In this diff I added support to be able to measure C++ shadowNode in Android. As an example I implemented the measurement of TextViews

Reviewed By: shergin

Differential Revision: D9583972

fbshipit-source-id: 1344782d4c586c94a4576b18a4acfa4775e46952
2018-09-17 18:49:05 -07:00
gengjiawen 4f49404e15 bump android target version to 27 (#20843)
Summary:
bump target version to 27
pass all current ci.
none
[GENERAL] [ANDROID] [FEATURE] - bump android target version to 27
Pull Request resolved: https://github.com/facebook/react-native/pull/20843

Differential Revision: D9845999

Pulled By: hramos

fbshipit-source-id: 3c532a2d5a2b7d201bacab54cf3d60e1efffb653
2018-09-15 05:47:09 -07:00
Dulmandakh ba608a2db7 Consolidate native dependencies versions (#20742)
Summary:
This PR tries to consolidate Android native dependencies versions to make it less error prone to version bumps.
Pull Request resolved: https://github.com/facebook/react-native/pull/20742

Differential Revision: D9818155

Pulled By: hramos

fbshipit-source-id: 9bf631640910edad5731014f4e23dbca45af2b59
2018-09-13 15:49:00 -07:00
empyrical cb87c3f410 Fix failing Android CI (#21083)
Summary:
This PR does 2 things:

 * Have Facebook internal dependencies only be added if `IS_OSS_BUILD` is `True`. This syntax is used in other BUCK files in the codebase.
    * `ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/BUCK`
    * `ReactAndroid/src/androidTest/java/com/facebook/react/testing/rule/BUCK`
* Add a missing Android dependency to this BUCK file:
    * `ReactAndroid/src/main/java/com/facebook/react/BUCK`

As a result, `test_android` is passing again.
Pull Request resolved: https://github.com/facebook/react-native/pull/21083

Differential Revision: D9809808

Pulled By: hramos

fbshipit-source-id: c840ea2892006a88fe13de1b1324746d030ebaf2
2018-09-13 07:48:14 -07:00
Mehdi Mulani 737f93705c Android: Send <Text> metrics in onTextLayout events
Summary:
@public
As we're doing in D9440914 (OSS 64a52532fe), send text metrics in an onTextLayout callback. These can be used by surrounding views for doing complicated layout like:
- displaying a cursor at the end of text
- vertical centering using capheight-baseline

This right now isn't very performant but is only done when `onTextLayout` is set. I plan to optimize it with a capheight and xheight cache in a follow up diff.

Reviewed By: achen1

Differential Revision: D9585613

fbshipit-source-id: aa20535b8371d5aecf15822d66a0d973c9a7eeda
2018-09-12 14:17:27 -07:00
David Vacca 0c576ef84a Expose AllowFileAccess property in WebView
Summary: This diff adds a new property in ReactWebView to be able to configure allowFileAccess

Reviewed By: achen1

Differential Revision: D9789466

fbshipit-source-id: 39d042ac6ef69e44f006a4c4b0c2dd900f84dbc9
2018-09-12 11:49:20 -07:00
Emily Janzer 2869117127 Remove @CountEnum from OSS classes
Summary: Back out D9614432 and partially revert D9623235 to unbreak OSS.

Reviewed By: hramos

Differential Revision: D9779548

fbshipit-source-id: 931c4987ed5acbae3790c42717662fed77599335
2018-09-11 16:31:46 -07:00
Héctor Ramos 1151c096da Update copyright headers to yearless format
Summary: This change drops the year from the copyright headers and the LICENSE file.

Reviewed By: yungsters

Differential Revision: D9727774

fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
2018-09-11 15:33:07 -07:00
Michael Lee c5daf3fed9 Reformat BUCK files to follow new buildifier format
Summary: buildifier was updated and now we sort loads!

Reviewed By: zertosh

Differential Revision: D9771824

fbshipit-source-id: 0001aa5f656d4aa40b3498d5bfd792a3d14e56e1
2018-09-11 15:20:48 -07:00
Jiaqi Wu 1830f9baae Add more systrance on startup
Summary: as title

Reviewed By: achen1

Differential Revision: D9729852

fbshipit-source-id: 15bb2ab4cff7f7fb1730eb354b36d7caf5cbac36
2018-09-09 14:17:00 -07:00
Emily Janzer 2434b965f2 [qpl
Summary: Renaming QPL point to VM_INIT

Differential Revision: D9734261

fbshipit-source-id: daeb339813dfebc80e774e8b64eb5e9ba30f1a2b
2018-09-08 11:48:11 -07:00
Emily Janzer dd627479c2 Add marker point for initializing Hermes
Summary: Adding a QPL point for initializing Hermes to both (MP) HOME_TTI and (RN) CORE.

Reviewed By: yungsters

Differential Revision: D9725795

fbshipit-source-id: 673f54950a2d9ebfa496a000a0d47aabf290bfc8
2018-09-07 17:51:32 -07:00
Jyrno Ader 6bc483c8cc Fix crash on overlayColor usage (#20929)
Summary:
see snack for demo on the issue: https://snack.expo.io/jyrno42/overlaycolor-issue-snack
Pull Request resolved: https://github.com/facebook/react-native/pull/20929

Differential Revision: D9727250

Pulled By: hramos

fbshipit-source-id: 03c95d4b5a38ae51ecebb8615fda1af9599c0508
2018-09-07 14:18:27 -07:00
Daniel Ignat 6e7ffff4a5 If source.method is "post", use HTTP POST method (#21010)
Summary:
The React Native Web View takes a method option to determine if HTTP GET or HTTP POST should be used.
For iPhone this is not case sensitive, meaning that `method: "post"` is allowed.
For Android "post" is not understood and therefore the request will be using HTTP GET.

I suggest we ignore case for the method, or throw an Exception.
Pull Request resolved: https://github.com/facebook/react-native/pull/21010

Differential Revision: D9700895

Pulled By: hramos

fbshipit-source-id: 3fa904e7946dd40958cb44f9a234ee66cb68fab2
2018-09-07 10:26:21 -07:00
Ram N 27348f0f07 Remove getEagerNativeModules()
Summary: An experiment was added to A/B test eager modules. Removing this experiment, as the next diff on this stack has a different way to add eager modules per route.

Reviewed By: achen1

Differential Revision: D9685803

fbshipit-source-id: ca6c91ca377b6dfaf5accda1e1f6bbfe17b1d616
2018-09-07 10:26:21 -07:00
Ram N 6da93a302e Better error message when using getNativeModule(Class)
Summary:
Some of the native modules are accessed using `getNativeModule()` may not have an `ReactModule` annotation. As a result, such native modules cannot be found.

This diff adds a better error message, and also adds the annotation to Mobile Home's `PushNotificationManager` that is accessed using the `getNativeModule()`

Differential Revision: D9697256

fbshipit-source-id: 2e2f7d2f1eb705c9c515ff40d9acbc53055c26d8
2018-09-07 10:26:21 -07:00
Ram N 4b15eb53ec Fix broken systrace message markers
Summary: SystraceMessage needs to have a flush method

Reviewed By: shergin

Differential Revision: D9696709

fbshipit-source-id: 7f8c9422fbc2e3ca8c184015889a4d1aa1500a7c
2018-09-07 10:26:21 -07:00
Andrew Chen (Eng) f38ab24a19 Fix setupReactContext systrace
Summary: setupReactContext wasn't ending because D9664719 added incorrect end markers. Need to use either Systrace.endSection() or SystraceMessage.endSection().flush().

Differential Revision: D9695854

fbshipit-source-id: e0f7d492bc58536ce242962438edac7eec671867
2018-09-07 10:26:20 -07:00
Nicolas Charpentier 0cce0a62c1 Add backface-visibility support on Android (#15970)
Summary:
`backfaceVisibility` was only available on iOS and 3D transformations were lacking on Android.

Backface Visibility is computed from ~the decomposed matrix of transform prop~ the view with their rotation degree values.

~`MatrixDecompositionContext` properties have been made public so we can access to decomposed matrix values from outside (`ReactViewGroup`).~

I'm not sure if this is the best implementation, so if it's not let's discuss it.

cc janicduplessis foghina

Tested in https://github.com/charpeni/react-native-backface-visibility.

| Before | Now |
| - | - |
| <img src="https://user-images.githubusercontent.com/7189823/30123717-e5361598-9300-11e7-8e2e-a87a7a8d896a.gif" width="260" /> | <img src="https://user-images.githubusercontent.com/7189823/30514997-4d203572-9aee-11e7-8542-bfde41678eb6.gif" width="244" /> |

| iOS | Android |
| - | - |
| <img src="https://user-images.githubusercontent.com/7189823/36995899-609513b4-2083-11e8-9834-ee44c1a292e1.gif" width="300" /> | <img src="https://user-images.githubusercontent.com/7189823/36995978-9ed3b158-2083-11e8-841e-b9e3357d2509.gif" width="240" /> |

[ANDROID] [FEATURE] [ReactViewGroup] - Add backface-visibility support on Android
Pull Request resolved: https://github.com/facebook/react-native/pull/15970

Differential Revision: D9411130

Pulled By: hramos

fbshipit-source-id: 62f646a4de37d83922286cb98893a95b55fa889e
2018-09-07 10:26:20 -07:00
Ram N 2f79960a69 Convert ReactPackages in FB4a to switch-case
Reviewed By: achen1

Differential Revision: D9511962

fbshipit-source-id: ea42b25f13b157866057d96d026317098e47ea63
2018-09-07 10:26:20 -07:00
Ram N 875f70b8b6 Refactored NativeModuleRegistryBuilder
Summary: The logic in NativeModuleRegistryBuilder.processPackage was getting pretty complex with lot of branches. Moved the logic to get actual packages into each of the packages, instead of having it in NativeModuleRegistryBuilder.

Reviewed By: achen1

Differential Revision: D9618140

fbshipit-source-id: 4be82ec65b0bd92f11f8b77044004e10c9d3b1a1
2018-09-07 10:26:20 -07:00
Ram N b1d205a28f Add more systrace to RN startup
Summary:
Added systrace to the following sections
1. When Marketplace Home Fragment is created
2. On initialization of Catalyst Instance

Reviewed By: achen1

Differential Revision: D9665376

fbshipit-source-id: e48e9f50dad42c71fb2151538f65bc54939adc1e
2018-09-07 10:26:20 -07:00
Ram N 48169b28e2 Change class names to modules names in packages
Reviewed By: achen1

Differential Revision: D9508095

fbshipit-source-id: e3973ea417c803110eb8612c854a6374a849474b
2018-09-07 10:26:19 -07:00
Andrew Chen (Eng) bbc1af6536 Give a name to the ReactContext thread
Summary: tired of looking around for this thread. named it "create_react_context"

Differential Revision: D9664714

fbshipit-source-id: 8839b5724fe2516fc46de3dd40971c52a5a8168f
2018-09-05 16:33:38 -07:00
Andrew Chen (Eng) cb6196073a Add systrace to UIManagerModule.createConstants
Summary:
- Differentiate when the constants are coming from lazy view managers or not
- Add systrace sections to each reactpackage iteration for lazy view managers

Differential Revision: D9664719

fbshipit-source-id: 3b8c6b3b40667a833471fcb957367501781b0f5d
2018-09-05 16:04:22 -07:00
Dulmandakh 1edeaef6ca FIx Android CI (#20901)
Summary:
This PR fixes Android CI
Pull Request resolved: https://github.com/facebook/react-native/pull/20901

Differential Revision: D9596497

Pulled By: hramos

fbshipit-source-id: 5662243645d5d8e51c6da4cb142ab6665a09daee
2018-09-05 16:04:22 -07:00
Ram N 38bea0bbf3 TM: Create Java implementation of Turbo Modules
Summary: Create a Java implementation for a sample module

Reviewed By: fkgozali

Differential Revision: D9445981

fbshipit-source-id: 7709f7655468dc21abcc42cba1036b8e920b2bdb
2018-09-05 09:20:03 -07:00
Emily Janzer 06bf7b1f00 Adding @CountEnum to simple enums in xplat/js
Summary: Using The Count to transform enums to ints in production builds: https://our.intern.facebook.com/intern/wiki/Android-java-transforms/the-count/

Reviewed By: achen1

Differential Revision: D9614432

fbshipit-source-id: 1b1a197ad8f4962712d6006ab07b3beb3eaf2432
2018-09-04 18:18:05 -07:00
Ram N fed5b6e27a Make C++ RN Modules explicitly specify that they are C++ modules
Summary:
Currently `ReactModuleSpecProcessor` looks at each of the modules, and sees if the module inherits from `CxxModuleWrapper` to see if it is a C++ module or not. With this change, we now require C++ modules to explicitly specify that they are C++ modules, instead of doing annotation processing magic.

Also note that annotation processor do not work with interfaces but with classes only, so this also removes the dependency of the annotation processor from the bridge buck target.

Reviewed By: achen1

Differential Revision: D9597352

fbshipit-source-id: fd847ac382699d2ab78f7d7c6e2dbd7c60d3f0c4
2018-09-04 16:33:15 -07:00
Emily Janzer b5d908bc73 Convert ReactMarkerConsts back to enum, use @CountEnum
Summary: Reverting D9304307 and also adding CountEnum annotation to ReactMarkerConstants. This way we get the typesafety of the enum with the optimization of converting to int in production builds. More on the count: https://our.intern.facebook.com/intern/wiki/Android-java-transforms/the-count/

Reviewed By: achen1

Differential Revision: D9623235

fbshipit-source-id: ab992e7edb6cf999f5f122faee31075a63782411
2018-09-04 10:33:32 -07:00
Taras Tsugrii a8a63b1560 Remove unused loads from build files.
Summary: Unused loads hurt readability and take time to process.

Reviewed By: hramos

Differential Revision: D9494120

fbshipit-source-id: 455b56efadab1cb976344cffcb427772bfda2f71
2018-08-31 18:03:07 -07:00
Sergei Dryganets 09c78fe968 Incorrect ref API usage fixed. (#20913)
Summary:
release method of local_ref and global_ref doesn't call deallocator, in fact, it leaves the caller responsible for deletion of the reference, while otherwise the reference is released on scope left.

Fixes #18292.
Pull Request resolved: https://github.com/facebook/react-native/pull/20913

Differential Revision: D9616237

Pulled By: hramos

fbshipit-source-id: 021aa3e4f039e6b7a98da3e4224c1ee49d5a4921
2018-08-31 12:50:02 -07:00
Jiaqi Wu e04206a88d Add native nav bar with title and button icon
Summary: Add native android nav bar. Title and button info are from FBDynamicNavigationOption. Set through setBarOption.

Reviewed By: achen1

Differential Revision: D9367058

fbshipit-source-id: 0f3f790d2c4d3af97568927993964678bc028bc3
2018-08-30 22:48:02 -07:00
Jonathan Kim a549a5377e Fix loads for OSS builds
Summary: A cell syntax load crept into RN. Remove it so it works with oss

Reviewed By: scottrice

Differential Revision: D9596187

fbshipit-source-id: 1f3138b760f63ae4b1fa23a034e6b9a86396ff50
2018-08-30 15:17:04 -07:00
Oleg Lokhvitsky 5f48d28119 ScrollView snapToStart/snapToEnd
Summary: Added `snapToStart` and `snapToEnd` props to ScrollView which work together with `snapToOffsets` and determine whether the beginning and end of the list automatically count as snap offsets or not. If not, the list is allowed to free-scroll between its start/end and the first/last snap offset.

Reviewed By: sahrens

Differential Revision: D9442386

fbshipit-source-id: 47a5fdb20f884542434b01b1f0a486ed2b478c6e
2018-08-30 13:04:50 -07:00
Oleg Lokhvitsky fd744dd56c ScrollView snapToOffsets
Summary:
* Added snapToOffsets prop to ScrollView. Allows snapping at arbitrary points.

* Fixed pagingEnabled not being overridden by snapToInterval on iOS.

* Fixed Android *requiring* pagingEnabled to be defined alongside snapToInterval.
* Added support for decelerationRate on Android.

* Fixed snapping implementation. It was not calculating end position correctly at all (velocity is not a linear offset).
  * Resolves https://github.com/facebook/react-native/issues/20155
* Added support for new content being added during scroll (mirrors existing functionality in vertical ScrollView).

* Added support for snapToInterval.
  * Resolves https://github.com/facebook/react-native/issues/19552

Reviewed By: yungsters

Differential Revision: D9405703

fbshipit-source-id: b3c367b8079e6810794b0165dfdbcff4abff2eda
2018-08-30 13:04:50 -07:00
Pritesh Nandgaonkar b8f6adf654 Expose printTree property of YGConfig to jni
Summary: Exposes printTree property of YGConfig to jni

Reviewed By: IanChilds

Differential Revision: D9561097

fbshipit-source-id: 1bf86a63ad5e9baa107e36d429209b9061e6676d
2018-08-30 04:47:16 -07:00
David Vacca eb225fa173 Revert changes of the name for AndroidHorizontalScrollView
Summary: This diff reverts the changes in the name for AndroidHorizontalScrollView and AndroidHorizontalScrollContentView that caused a redbox for continuous OTA users

Reviewed By: fkgozali

Differential Revision: D9561972

fbshipit-source-id: 3d8e9ee8bb6081107bc8d315af16885bb003148e
2018-08-29 15:48:59 -07:00
Jonathan Kim 685b15679f @build-break fix usage of old RN DEFS.bzl path
Differential Revision: D9563036

fbshipit-source-id: ab87f479f45209b96ce82c3607c45fdfd622d099
2018-08-29 14:32:24 -07:00
Jonathan Kim 2515e4861a Move RN's DEFS.bzl to tools and rename to rn_defs.bzl
Reviewed By: mzlee

Differential Revision: D9553765

fbshipit-source-id: cb65081668ea2726f24d2c9c02661e859cc7a994
2018-08-29 13:21:52 -07:00