Граф коммитов

3039 Коммитов

Автор SHA1 Сообщение Дата
Ignacio Olaciregui 7b3c91ef16 Fix inline styles eslint warnings for examples (#22123)
Summary:
Fixes `react-native/no-inline-styles` warning for several examples. I'm limiting the size of this PR to make it simpler to review.
Pull Request resolved: https://github.com/facebook/react-native/pull/22123

Reviewed By: RSNara

Differential Revision: D12929701

Pulled By: TheSavior

fbshipit-source-id: 7a976f2208b557fcfda46d5b586b30652c550eb2
2018-11-08 17:20:33 -08:00
David Vacca 95b21b4828 Refactor 'induce' of events in Fabric Android
Summary:
This diff refactors the exeuction of 'AsyncEventBeat.induce()' as part of the delivery of events of Fabric Android implementation.
The first part of the refactor moves the exeuction of onBatchEventDispatched out of the synchronization block for mEventsToDispatchLock. This lock is accessed from the UI Thread and executing the induce inside this synchronization block will affect UI,
The second part of the refactor is to ensure that the exeuction of the C++ method AsyncEventBeat.induce() always happen in the JS Thread.

Reviewed By: shergin

Differential Revision: D12861387

fbshipit-source-id: e1cd03467274a1c5fcd04b0ac7efdbe7169b14c3
2018-11-08 16:57:46 -08:00
David Vacca fe7eb61989 Force navigation to use root tag
Summary: This diff ensures that JS uses rootTags during navigation. A redbox will be rendered in debug mode when a non-rootTag is used during navigation. This change enables proper navigation for Fabric.

Reviewed By: shergin

Differential Revision: D10855198

fbshipit-source-id: a82aaa706cd62ce92143fa86d0a422c1ae439a50
2018-11-08 16:57:46 -08:00
David Vacca 8329c10932 Stop mounting of Views when there is an exception in Native
Summary: This diff fixes exception handling for Mounting of views, as soon as there is an exception we stop the mounting of views because from that point the UI View tree is going to be inconsistent with the ReactShadow tree from C++. We also stop the mounting of views when the host is paused, this allows us to not keep mounting views

Reviewed By: shergin

Differential Revision: D10510334

fbshipit-source-id: b0d3eba580ff92d8b8400244ec9d7c266db42ff9
2018-11-08 16:57:46 -08:00
Ram N fe498096b6 Replace String with constants for Module names in Fb4aCoreInfraPackage
Summary: Using constants is safer than using strings. More details at D12843649

Reviewed By: sahrens

Differential Revision: D8226521

fbshipit-source-id: 4c78c8dfe0bd658f46c8f81e50ceae9299fc6f3c
2018-11-08 12:29:26 -08:00
Ram N 54e8d6cdc8 Fix args passed when measuring Androidwitch
Summary: The first argument to `View.MeasureSpec.makeMeasureSpec` should be positive, but was being passed WRAP_CONTENT, which is negative. This diff fixes that.

Reviewed By: achen1

Differential Revision: D6601683

fbshipit-source-id: 6d8499830f7b6da40848bab77d5ddbbb8a6fe44f
2018-11-07 20:17:42 -08:00
David Vacca e57ad4ee37 Fix IllegalArgumentException when dismissing ReactModalHostView
Summary: This diff fixes an IllegalArgumentException when dismissing ReactModalHostView. I wasn't able to reproduce this error because this is likely created by a race condition.

Reviewed By: axe-fb

Differential Revision: D12916787

fbshipit-source-id: b071ffc4c251f2a613bb1270de005def56818376
2018-11-07 18:30:53 -08:00
David Aurelio 2a8f6c3028 Add Yoga JNI bindings to libcoldstart
Summary:
Yoga's JNI bindings are usually loaded during class loading, and can stall the UI thread.

Here, we try to mitigate the problem by adding the bindings to libcoldstart.

Reviewed By: michalgr

Differential Revision: D12956818

fbshipit-source-id: 9dda5cb6d26c2bae64606bc2d7c98ab8f7c05a30
2018-11-07 09:35:45 -08:00
Stepan Hruda e02a154787 Allow overriding Metro server host with a system prop
Summary:
Allow a device to override the host to which to connect to for getting dev bundles, debugging etc.

This is read from a system prop so it can be shared across all React Native apps and persists between app installs.

Reviewed By: mdvacca

Differential Revision: D10842213

fbshipit-source-id: d15b7d0255130090744d60ffb239778cba15e49c
2018-11-06 15:35:41 -08:00
Ignacio Olaciregui 8b46c9a40b Fix inline styles in ReactAndroid (#22166)
Summary:
Fix `react-native/no-inline-styles` eslint warning for ReactAndroid module.
Pull Request resolved: https://github.com/facebook/react-native/pull/22166

Differential Revision: D12946925

Pulled By: TheSavior

fbshipit-source-id: f4bc0653bd2971e551bc46d89455c006003947c7
2018-11-06 13:47:46 -08:00
Spencer Ahrens 7b5277bb75 mostly working on Android + OTA
Summary:
It works great on iOS, and mostly works on Android, and is now OTA'able as part of the screen config! Haven't done template view yet. One remaining issue:

Layout is borked on Android. I'm guessing the issue has to do with the timing of setting the constraints in `updateRootLayoutSpecs` and calling `mBinding.startSurface` which actually builds the shadow tree. If I try to call `updateRootLayoutSpecs` earlier, it just crashes immediately. Here's the layout it spits out, which clearly has -440 for the x of 420006, which is the RCTText component, causing it to get cut off on the left of the screen:
```
updateLayoutMountItem for reactTag: 420006 x: -440, y: -13, width: 931, height: 78
updateLayoutMountItem for reactTag: 420010 x: 26, y: 79, width: 0, height: 1651
updateLayoutMountItem for reactTag: 420012 x: 0, y: 26, width: 0, height: 158
updateLayoutMountItem for reactTag: 420016 x: 0, y: 210, width: 454, height: 454
updateLayoutMountItem for reactTag: 420018 x: 454, y: 210, width: 455, height: 454
updateLayoutMountItem for reactTag: 420022 x: 0, y: 690, width: 454, height: 454
updateLayoutMountItem for reactTag: 420024 x: 454, y: 690, width: 455, height: 454
updateLayoutMountItem for reactTag: 420028 x: 0, y: 1171, width: 454, height: 454
updateLayoutMountItem for reactTag: 420030 x: 454, y: 1171, width: 455, height: 454
updateLayoutMountItem for reactTag: 420032 x: 0, y: 1651, width: 0, height: 0
```

Reviewed By: mdvacca

Differential Revision: D12813192

fbshipit-source-id: 450d646af4883ff25184141721351da67b091b7c
2018-11-05 15:43:55 -08:00
Victor Calvello ffd7195543 Remove unused styles (#22083)
Summary:
Removes unused styles.

NOTE: Lint rule `react-native/no-unused-styles` not added because of custom lint rule internally at Facebook that does this.
Pull Request resolved: https://github.com/facebook/react-native/pull/22083

Differential Revision: D12929443

Pulled By: TheSavior

fbshipit-source-id: d42b0be3db745e445447e65df3b78b61f53e4229
2018-11-05 13:57:47 -08:00
nd-02110114 9d132339f7 Remove var in ReactAndroid/src/androidTest (#22135)
Summary:
I removed var in ReactAndroid/src/androidTest.

- [x] npm run prettier
- [x] npm run flow-check-ios
- [x] npm run flow-check-android

[GENERAL] [ReactAndroid/src/androidTest] - remove var
Pull Request resolved: https://github.com/facebook/react-native/pull/22135

Differential Revision: D12921224

Pulled By: TheSavior

fbshipit-source-id: 9a14755944df642f8b82c46c691d6ed6ee8fa623
2018-11-05 00:41:21 -08:00
nd-02110114 6f781d9c25 remove var in ReactAndroid/src/androidTest. (#22137)
Summary:
I removed var in ReactAndroid/src/androidTest.

- [x] npm run prettier
- [x] npm run flow-check-ios
- [x] npm run flow-check-android

[GENERAL] [ReactAndroid/src/androidTest] - remove var
Pull Request resolved: https://github.com/facebook/react-native/pull/22137

Differential Revision: D12921228

Pulled By: TheSavior

fbshipit-source-id: d3b7380b6047fc304265d0f47a53cb1170a6aea6
2018-11-05 00:37:26 -08:00
nd-02110114 0beb1cc55d remove var in ReactAndroid/src/androidTest (#22136)
Summary:
I removed var in ReactAndroid/src/androidTest.

- [x] npm run prettier
- [x] npm run flow-check-ios
- [x] npm run flow-check-android

[GENERAL] [ReactAndroid/src/androidTest] - remove var
Pull Request resolved: https://github.com/facebook/react-native/pull/22136

Differential Revision: D12921227

Pulled By: TheSavior

fbshipit-source-id: 45c03a52a5eafa25965aa785da094421c3df3999
2018-11-05 00:34:04 -08:00
Tim Yung 4d16a0e84e RN: Copyright Header for `ReactInstanceManagerTest.java`
Summary: Missing when D12829677 landed.

Reviewed By: mdvacca

Differential Revision: D12903182

fbshipit-source-id: 1c142acb2a098b1118170f2f8ed8cf719fc14f90
2018-11-03 14:15:55 -07:00
David Vacca 83c7303a19 Trivial cleanup in ReactRootView
Summary: Trivial clanup of imports in ReactRootView

Reviewed By: fkgozali

Differential Revision: D12899430

fbshipit-source-id: 83bb052bbeee9e02e91157305420a2dd799e60e2
2018-11-03 01:14:07 -07:00
David Vacca 38e01a20c3 Fix IllegalStateException when dismissing DialogManager
Summary: This diff fixes a IllegalStateException that can happen because of a race condition when using DialogManager

Reviewed By: fkgozali

Differential Revision: D12899432

fbshipit-source-id: 98fb7c1ee1d292a959628a33c8a2dd5a6d93e328
2018-11-03 01:14:07 -07:00
Spencer Ahrens 2486d12b81 lint autofixes
Summary: `find js/react-native-github | xargs arc lint -a`

Reviewed By: yungsters

Differential Revision: D12902940

fbshipit-source-id: fd1158f7a0ec322cf89bc4f727943bff4600b399
2018-11-02 12:44:59 -07:00
Radovan Šmitala 7f79254cfe Remove AndroidManifest.xml from UIManager (#22044)
Summary:
AndroidManifest.xml file in UIManager only defines minimum SDK version for whole namespace "com.facebook". But it is always redefined by build.gradle file because Gradle file has precedence.

https://github.com/facebook/react-native/blob/master/ReactAndroid/build.gradle#L273

Anyway Gradle is prefered way to define it. So i think it should be removed if it is not used for another purpose.
Pull Request resolved: https://github.com/facebook/react-native/pull/22044

Differential Revision: D12898251

Pulled By: hramos

fbshipit-source-id: 087b5cc45495109b5626c9cb232d0546c53fb709
2018-11-01 20:11:09 -07:00
Ignacio Olaciregui ae8ec39397 Fix linting issues (#22062)
Summary:
Fixes lots of ESLint warnings. Many of them where in PR #20877 by janicduplessis which requested to split the linting fixes from configuration and package changes.

I solved only the issues that I was most certain about but I would love to get hands on all of them with a little bit of input.
Pull Request resolved: https://github.com/facebook/react-native/pull/22062

Differential Revision: D12889447

Pulled By: TheSavior

fbshipit-source-id: 35f7a08104a5b859c860afdde4af2b32c0685c50
2018-11-01 14:29:16 -07:00
Ram N b3b67499dd Add tracing for loading .so files during startup
Summary: During RN's startup, libfbjs-slow.so file is loaded when it is injected into FBReactInstanceHolder. This initialization takes a while, and has usually been showing up as a blank under `FBReactInstanceHolder`. By adding Systrace and QPL, we can estimate how long this takes. Traces will also be useful as we start optimizing this.

Reviewed By: ejanzer

Differential Revision: D5950803

fbshipit-source-id: 711c1d6c16e0f3d5c2dc23606be4e73880152b17
2018-10-31 20:05:31 -07:00
Andrew Chen (Eng) 309f85ace2 Fix ReactRootView mount/unmount race condition
Summary:
There are multiple reports of the NativeViewHierarchyManager trying to remove a root view with id -1. This can occur because of a race condition caused by calls to startReactApplication + unmountReactApplication.

We unfortunately overload overload the id field of the ReactRootView to store its react tag. This id is typically set when the view is attached to the react instance, and reset to NO_ID right before an attach occurs or when the react context is tearing down. If the react context has already been initialized, attaching the root view is synchronous and the id is set immediately. If the context has not been initialized, we save the root view in a mAttachedRootViews list and wait until setupReactContext (where the context is created) to finish attaching the root views.

There were two issues:
1) In setupReactContext, synchronizing on mReactContextLock is not enough to ensure that the root views in mAttachedRootViews have been initialized already
2) In detachRootView, removing the root view from mAttachedRootViews immediately will cause mAttachedRootViews to be out of sync when it is accessed by the time it is accessed in setupReactContext

To address these, the mReactContextLock will synchronize both the creation of the react context AND the initialization of the root views and detachRootView will synchronize on the mReactContextLock before mutating the mAttachedRootViews list.

Reviewed By: mmmulani

Differential Revision: D12829677

fbshipit-source-id: 3f3b0669e5be2b570c9d534503d04e5d0816196b
2018-10-31 16:37:50 -07:00
Scott Rice c1470736b0 Use fb_native_wrapper for all targets
Differential Revision: D12867696

fbshipit-source-id: bd52c1ead04065addece3a3104c4a1a9359ceb95
2018-10-31 11:47:42 -07:00
Tim Yung a689711f68 RN: Missing Copyright Headers
Summary: Adds copyright headers to all files that are missing them.

Reviewed By: hramos

Differential Revision: D12837494

fbshipit-source-id: 6330a18919676dec9ff2c03b7c9329ed9127d930
2018-10-31 01:37:26 -07:00
Ram N c91a2b36d7 Remove view managers from @ReactModuleList
Summary: The annotation ReactModuleList that was processed by ReactModuleSpecProcessor.java does not use ViewManagers. Removing this method from the annotation so that there is no confusion on how view managers are added to individual packages.

Reviewed By: achen1

Differential Revision: D9115363

fbshipit-source-id: 43d12e09b0e9b8e1732533f9a4456327778a0eaf
2018-10-29 12:22:38 -07:00
Kudo Chien a316dc6ec3 Upgrade folly to v2018.10.22.00 for Android (#21977)
Summary:
Fixes #20302 (For Android)

Note:
------
1. New folly will have build break for a gcc-4.9 and gcc-4.9 seems to be deprecated for latest folly.
    As we only use partial folly implementations, I just fixed the build break part.
    To support building RN on Windows, the patches are written by gradle ReplaceTokens.

2. The change for glog copying header into exported/ is to prevent build break for folly.
    `folly/detail/Demangle.h` will try to use libstdc++'s demangle.h. Unfortunately, glog also has a demangle.h in source code. So I copy exported headers and only search headers in exported/ folder during build.
Pull Request resolved: https://github.com/facebook/react-native/pull/21977

Reviewed By: hramos

Differential Revision: D12818133

Pulled By: fkgozali

fbshipit-source-id: 2c1f6f012663204581a86141d0c9ed0eb9d8c698
2018-10-29 12:06:37 -07:00
Alexandre Kirszenberg 1eedf05651 Update the Delta/HMR format
Summary:
Makes the delta bundle data structures more consistent.

The changes are as follows:
* There are now two types of JSON bundles that can be downloaded from the delta endpoint. Base bundles (`Bundle` type), and Delta bundles (`DeltaBundle` type).
* The `reset` boolean is renamed to `base`.
* `pre` and `post` properties are now strings.
* Only `Bundle` can define `pre` and `post` properties.
* The `delta` property is renamed to `modules`.
* Deleted modules are now listed inside of the `deleted` property, which is only defined by `DeltaBundle`.

Reviewed By: mjesun

Differential Revision: D10446831

fbshipit-source-id: 40e229a2811d48950f0bad8dd341ece189089e9b
2018-10-29 08:58:30 -07:00
Dulmandakh 99632e16d9 fix android ci (#21913)
Summary:
This PR adds support-annotations to devsupport buck dependency, which fixes Android CI.
Pull Request resolved: https://github.com/facebook/react-native/pull/21913

Differential Revision: D10842175

Pulled By: hramos

fbshipit-source-id: f3f3e0e6a3a5e9ceb18db11ac67e820a7f10937a
2018-10-24 14:48:42 -07:00
Andrew Chen (Eng) dc74975c5f Remove hard crash when root view is reused
Summary: Alternative to D10499861. If an app does not have an exception handler, context.handleException will still hard crash. Since this error is just saying that we're reusing an unexpected RootView, it might be safe to continue execution. Let's remove the exception for now while we investigate further

Reviewed By: mmmulani

Differential Revision: D10560413

fbshipit-source-id: 6c08a16cd250a019d2aef5afcaf3ba61534d29f7
2018-10-24 13:08:41 -07:00
Max Sherman b141363943 Instrument native library load time
Summary: I'm interested in measuring this.

Reviewed By: alexeylang

Differential Revision: D10510275

fbshipit-source-id: e833153524413bc5ec6159ff100ade92b29e6d0c
2018-10-24 09:00:22 -07:00
Andrew Chen (Eng) f671f8868f Don't crash when ReactRootView's id is already set
Summary:
This is a bandaid fix to address a crash with a stack trace involving

```
com.facebook.react.uimanager.IllegalViewOperationException: Trying to add a root view with an explicit id already set. React Native uses the id field to track react tags and will overwrite this field. If that is fine, explicitly overwrite the id field to View.NO_ID before calling addRootView.
0+com.facebook.react.uimanager.NativeViewHierarchyManager.addRootViewGroup(NativeViewHierarchyManager.java:546) [inlined]
1+com.facebook.react.uimanager.NativeViewHierarchyManager.addRootView(NativeViewHierarchyManager.java:538) [inlined]
2+com.facebook.react.uimanager.UIViewOperationQueue.addRootView(UIViewOperationQueue.java:678) [inlined]
3+com.facebook.react.uimanager.UIImplementation.registerRootView(UIImplementation.java:216) [inlined]
4+com.facebook.react.uimanager.UIManagerModule.addRootView(UIManagerModule.java:355)
5+com.facebook.react.ReactInstanceManager.attachRootViewToInstance(ReactInstanceManager.java:1032)
6+com.facebook.react.ReactInstanceManager.attachRootView(ReactInstanceManager.java:726) [inlined]
7+com.facebook.react.ReactRootView.attachToReactInstanceManager(ReactRootView.java:524)
8+com.facebook.react.ReactRootView.startReactApplication(ReactRootView.java:377)
```

This crash seems to be happening because the root view's id is set to a non NO_ID value, but further up in the stack trace, UIManager.addRootView() is called which always sets the root view's id to NO_ID. It's not clear how this error is happening, but in this code path it's expected that addRootView should always ensure that the id is always reset. In order to avoid crashing for this, let's remove the exception and log the issue instead.

In the future, we should not be overloading the android view id field with these types of react native implementation details. The react tag should be stored as a view tag instead.

Reviewed By: mmmulani

Differential Revision: D10499861

fbshipit-source-id: 4dffedab4e7a34eee7f64bb43ec8209699521c73
2018-10-22 17:28:17 -07:00
David Vacca 6debfdf6d6 RN crash when processing Exception with null message
Summary: This diff fixes a crash that happens when a component throws an exception that contains a null message

Reviewed By: achen1

Differential Revision: D10429661

fbshipit-source-id: 9faed36906844b51f5a3dc2b3cbc80ede6b93457
2018-10-22 01:07:45 -07:00
David Vacca b002df945b Re-introduce UIImplementationProvider
Summary: UIImplementationProvider was removed as part of D8650376, this was a breaking change that caused problems in OSS. This diff introduces the concept of a deprecated UIImplementationProvider again to allow OSS community to upgrade to latest version of RN.

Reviewed By: achen1

Differential Revision: D10456317

fbshipit-source-id: 6817629524f927dfcb5ebc054dbfd983877b7606
2018-10-20 11:27:50 -07:00
Marc Horowitz 6b0e924915 lint fixes
Reviewed By: QueryConnectionException

Differential Revision: D10458992

fbshipit-source-id: f57b0ef3c51a0bcf5703e187d36960aa3b944002
2018-10-19 11:35:06 -07:00
Héctor Ramos 47fb387455 Update copyright headers
Summary: Use MIT License copyright headers in JSI source code.

Reviewed By: axe-fb

Differential Revision: D10454031

fbshipit-source-id: d584073bb885fb7d977df1a45a6666ef6f52dcd6
2018-10-19 11:08:57 -07:00
Marc Horowitz 6370b86c1f Get RNTester to compile and run
Summary:
This diff includes a few changes:
1. Move the headers inside `jsiexecutor` into `jsiexecutor/jsireact`. As far as I'm aware, the Android ndk build system isn't flexible enough to support header namespaces, so we can't just expose the headers inside the `jsiexecutor` directory under the `jsireact` namespace. Therefore, I moved the headers to `jsiexecutor/jsireact`, and added `jsiexecutor` to the header search path.  This was the easiest way to simulate `jsireact` namespace.
2. Setup the Android.mk files to get RNTester compiling and running.
3. Introduce a `jscexecutor` module to make `JSCExecutor.java` execute without throwing.

**Note:** Moving the header files inside `jsiexecutor` probably breaks the iOS builds and internal builds. I'll fix those in subsequent diffs on this stack.

Reviewed By: shergin

Differential Revision: D9995429

fbshipit-source-id: 418a4ee91f585842c5e317af2f300227a51e9ba8
2018-10-18 01:06:24 -07:00
Marc Horowitz 7ffb406517 Remove RN files which use JSC
Summary:
JSI+JSCRuntime replaces direct use of JSC
@public

Reviewed By: danzimm

Differential Revision: D9328235

fbshipit-source-id: a4d0cad8250ef2da058ffffbdedbffa19f96bb12
2018-10-18 01:06:24 -07:00
Marc Horowitz 6796e62bb3 Remove JSC references
Summary:
Removing entire files will be the next diff
@public

Reviewed By: fkgozali

Differential Revision: D9328239

fbshipit-source-id: 083847d3b841a3c7bfa751a82e8cc16bd112bace
2018-10-18 01:06:24 -07:00
Marc Horowitz 53fa8130f5 Switch RN from JSCJavaScriptExecutorFactory to JSCExecutorFactory
Summary:
This removes the dependency on JSCExecutor.  Everything goes
through JSI now.

Reviewed By: RSNara

Differential Revision: D9328240

fbshipit-source-id: c9c085fec1ebd5d0f4679cd70b89cc263ca33ac4
2018-10-18 01:06:24 -07:00
Marc Horowitz 749b18dbc9 Add JSI-based JSExecutor for the bridge
Summary:
This is similar in function to the old JSCExecutor, but uses the more abstract JSI API to interact with the JSVM.
@public

Reviewed By: axe-fb

Differential Revision: D9328241

fbshipit-source-id: 3212ff4f43d0589a70d7bebc4d463d4433590f1d
2018-10-18 01:06:24 -07:00
Mehdi Mulani 1c240ae898 Fix onTextLayout metrics on Android when using alignText
Summary:
With this, we send the correct x position when using center or right aligned text. In order to accomplish this though, we have to pass the text alignment into the Layout object that we create.

Also update RNTester to allow us to try different alignments.

Reviewed By: sahrens

Differential Revision: D10316494

fbshipit-source-id: 11c7d2a59e636528f12211168acb46f16b54a126
2018-10-17 12:55:10 -07:00
JenLindsay bbfff90ab8 remove createReactClass from ScrollViewTestModule.js (#21627)
Summary:
Related to issue #21581
Removed createReactClass from ReactAndroid/src/androidTest/js/ScrollViewTestModule.js
Pull Request resolved: https://github.com/facebook/react-native/pull/21627

Reviewed By: TheSavior

Differential Revision: D10363828

Pulled By: RSNara

fbshipit-source-id: 08c9776060cfdfde3b69f310bca0353d393b67c4
2018-10-16 16:27:56 -07:00
Ronaldo Lima 998d69d12d from ReactAndroid/src/androidTest/js/UIManagerTestModule.js (#21702)
Summary:
Related to #21581 .
Removed createReactClass from ReactAndroid/src/androidTest/js/UIManagerTestModule.js
Pull Request resolved: https://github.com/facebook/react-native/pull/21702

Reviewed By: TheSavior

Differential Revision: D10345717

Pulled By: RSNara

fbshipit-source-id: 280f499abb2e2aa9f8ea25c3f8faaed8162e67d5
2018-10-16 16:21:25 -07:00
Jonathan Lee bb407fa1ec Back out "[react-native][PR] Rounded corner rendering fixed on Android N."
Summary:
Original PR: https://github.com/facebook/react-native/pull/21340

The original PR fixed a bug with border radius on Android 7.0, but caused a new bug where no `ReactART` components would render if they were nested within a View with border radius set.

Differential Revision: D10409352

fbshipit-source-id: 0b4e36ae9d4c3bc2f4884a43909f8efdeeb41b74
2018-10-16 14:45:01 -07:00
Haitao Li b0d68c0bb9 Fix DynamicFromMap object pool synchronization (#17842)
Summary:
DynamicFromMap internally uses SimplePool object to recycle dynamic prop objects. But the pool is not multi-thread safe. Currently the most used dynamic props are size props such as left, paddingVertical, marginTop and so on. These props are only accessed from the layout thread so the pool works fine. If a dynamic prop is needed in UI thread, then the two threads can access the same pool object and cause random errors. This PR make the pool object thread local to avoid synchronization. After this change there are two pool objects created in the process.

Tested in official Airbnb app after updating accessibilityComponentType to be dynamic.

Once this is merged, I'll send another PR to support "disabled" state in `accessibilityComponentType`.

[ANDROID] [BUGFIX] [DynamicFromMap] - Fix a crash caused by dynamic props.
Pull Request resolved: https://github.com/facebook/react-native/pull/17842

Differential Revision: D10374238

Pulled By: hramos

fbshipit-source-id: 7ebf89c5abf06bd5fb43b205348ba4dc7e19517d
2018-10-13 17:42:44 -07:00
Ram N 5e7c774d64 Initialize the Choreographer in ReactChoreographer lazily
Summary:
Today, ReactInstanceManager calls `ReactChoreographer.initialize()` in its constructor. Since `ReactChoreographer` also needs to run on the UI thread, this forces the entire `ReactInstanceManager` to run on the UI thread.

By moving `ReactChoreographer` to lazily set up its Choreographer, we can make `ReactInstanceManager` run on any thread

Reviewed By: mdvacca

Differential Revision: D10097432

fbshipit-source-id: eb8c80aafcba745ea15c86296d11c487329b1df0
2018-10-12 19:37:42 -07:00
David Vacca 082a869dae Cleaning up imports in ViewGroupManager
Summary: Trivial cleanup of imports in ViewGroupManager class

Reviewed By: shergin

Differential Revision: D10343029

fbshipit-source-id: 0b049df545a4101f11dd67809c9a96723e746945
2018-10-12 18:41:51 -07:00
David Vacca ca3a6e8f13 Uninstalling native FabricUIManager when reloading RN screen
Summary: This diff makes sure the native side of the UILayer of RN is deallocated when the a RN screen is reloaded.

Reviewed By: shergin

Differential Revision: D10343030

fbshipit-source-id: 7add841b8875d28fe527f20b96f799733769b11a
2018-10-12 18:41:51 -07:00
David Vacca 9817f85def Avoid cleaning up ReactRootView content when reactContext is destroyed
Summary: This diff avoids deleting all the views of ReactRootView when the ReactContext is destroyed (ONLY FOR FABRIC). In Fabric these views are removed and deleted by the framework when the ReactShadowNode is destroyed.

Reviewed By: shergin

Differential Revision: D10319737

fbshipit-source-id: 2e2d2599006cd8205e0153c18cd75383387ce1df
2018-10-12 18:41:51 -07:00
Dulmandakh 10fc548809 bump okhttp3 to 3.11 (#21626)
Summary:
OkHTTP3 3.11 version includes many bug fixes, and few new features. Also it embed R8/ProGuard rules in the jar, which will help reduce APK size.

Changelog https://github.com/square/okhttp/blob/master/CHANGELOG.md
Pull Request resolved: https://github.com/facebook/react-native/pull/21626

Differential Revision: D10367048

Pulled By: RSNara

fbshipit-source-id: b168138178f96eeefba493002f7b6a2e921a531d
2018-10-12 15:00:17 -07:00
Emily Janzer f1b4daf51f Start core marker earlier
Summary: Moving up when we start the CORE marker to `FbReactFragment.onFragmentCreate` on FB4A. Right now the CORE marker gets started with CREATE_REACT_CONTEXT_START, since it's possible for the instance manager to be created before TTI begins. We address this in HOME_TTI by collecting the getInstanceManager time, comparing to TTI start, and using that as bridgeStartupStartTime. Ideally, though, we'd just start the CORE marker at the right time so we can use it independently to measure RN startup. This diff moves up CORE start time to `onFragmentCreate` (even before `getReactInstanceManager`)

Reviewed By: alexeylang

Differential Revision: D10094921

fbshipit-source-id: 77986535915f8e81d4d2c5b9108cbed40d1a75be
2018-10-12 10:10:09 -07:00
Oleg Lokhvitsky 6eeff75849 Android ScrollView fix for snapToInterval not snapping to end
Summary:
The end-of-scrollable-range offset was not clipped before the nearestOffset calculation causing the ScrollView to not snap to the end of the view when the width of the ScrollView was not an exact multiple of snapToInterval.

Addresses https://github.com/facebook/react-native/issues/21116#issuecomment-427944838

Reviewed By: yungsters

Differential Revision: D10248545

fbshipit-source-id: 2bdc94ea0a9d9f063769f2c5da4c33d4872b1db2
2018-10-11 10:01:30 -07:00
Emily Janzer 01a1004808 Fix for InterpolatorType crash
Summary:
We're currently getting a redbox in Turkish when we try to convert the string 'easeInEaseOut' to an InterpolatorType. This is because I use toLowerCase() to compare the string without setting a locale; in Turkish, the capital letter 'I' doesn't convert to 'i' when you lowercase it, but rather to 'ı' (http://www.i18nguy.com/unicode/turkish-i18n.html).

Passing in a locale param to `toLowerCase()` fixes it. Also updating the test.

Differential Revision: D10315474

fbshipit-source-id: 54be3ff1d3f91cb2ec765ff705ac364b976b8c6f
2018-10-10 15:31:20 -07:00
Lorenzo Sciandra 15c05988e9 Update to Detox 9 (#21570)
Summary:
Updating to Detox 9 - this should help with better Xcode 10 support, and should fix https://github.com/facebook/react-native/issues/21539.

I've updated to fixed `9.0.4` since it seems that each version is fairly different from the next, and I've followed the [migration guide](https://github.com/wix/detox/blob/master/docs/Guide.Migration.md#migrating-from-detox-8xx-to-9xx) for the android native dependencies.

Release Notes:

[INTERNAL] [ENHANCEMENT] [DETOX] - Update to version 9.0.4

Pull Request resolved: https://github.com/facebook/react-native/pull/21570

Reviewed By: TheSavior

Differential Revision: D10242373

Pulled By: RSNara

fbshipit-source-id: bd29d554e0972f16d96b9b39b86c7143941d5b7c
2018-10-10 10:01:21 -07:00
Radovan Šmitala 4b6f02ea75 Normalize scheme for URL on Android (#21561)
Summary:
Android requires lowercase for URL scheme. This commit d00bdb9bb8 fixed it but on React Native side.
Because it is Android specific, it should be fixed on Android side.

Android has method to normalize url scheme: https://developer.android.com/reference/android/net/Uri.html#normalizeScheme()
Pull Request resolved: https://github.com/facebook/react-native/pull/21561

Differential Revision: D10287868

Pulled By: hramos

fbshipit-source-id: f5e474164fdb2cfd49bd8ee51da17de3f1341a9c
2018-10-09 23:32:24 -07:00
David Vacca 397573ffed Fix onPress for TextView containing just RawText
Summary: This diff enables the onPress event for TextViews that render RawText

Reviewed By: shergin

Differential Revision: D10222183

fbshipit-source-id: 4b6a6ad548286453f7dd3a14a5e4ee453a55b923
2018-10-09 16:47:28 -07:00
David Vacca 95afdd8bb3 Introducing "collapsable" prop as part of ViewProps
Summary: This diff introduces the collapsable props in the viewProps. This prop is used in product code to prevent specific Views to be removed from the view hierarchy

Reviewed By: shergin

Differential Revision: D10254679

fbshipit-source-id: 637665b8998a86e29e839eb6d405a0fac354c8d3
2018-10-09 16:47:27 -07:00
Emily Janzer b7526b2095 Add test for InterpolatorType
Summary: Adding a test for the newly added InterpolatorType.fromString()

Reviewed By: axe-fb

Differential Revision: D10203814

fbshipit-source-id: f3c70db1a5754c79b1bdd881d266bec110934494
2018-10-08 11:31:18 -07:00
Rick Ratmansky b3f4872659 Adding new Buck targets
Summary: This will facilitate various cleanups

Differential Revision: D10145594

fbshipit-source-id: 3a360684ba96d5e0466a3e3dc2306c59e6fb50bd
2018-10-08 09:16:30 -07:00
Emily Janzer b8cb8d50a5 Update copyright for yoga files
Summary: Appeasing lint

Reviewed By: hramos

Differential Revision: D9819535

fbshipit-source-id: 0080f17a62291291a0ea90942af4b38588e9057f
2018-10-05 18:48:50 -07:00
Marc Horowitz bb9b9a8b9d When converting arguments JS->Java, handle integers correctly
Summary:
If a folly::dynamic contains a double when a Java method is
declared to take an int, getInt() will be called, and a C++ exception
will be thrown.  This change uses similar logic to
NativeReadableMap.getInt() to convert a folly::dynamic double to a
jint.  This will still throw an exception if the JS value cannot be
represented as a jint without loss.

Reviewed By: fromcelticpark

Differential Revision: D10209492

fbshipit-source-id: fd96416200c6b283ce5c8f8fa4c227ceb8f43054
2018-10-05 16:21:33 -07:00
Emily Janzer c5186aeb46 Simplify OSS enums
Summary: Simplifying our OSS enums (remove private variables and methods) so that redex can more easily optimize them for us.

Reviewed By: achen1, Feng23

Differential Revision: D9812796

fbshipit-source-id: 11a8272db41ff04399d1cdf366e28ddf1b07b7be
2018-10-03 18:47:39 -07:00
Andrew Chen (Eng) fa6035bda6 Fix accessibility role/label
Summary: D10138128 had some shamefully wrong boolean logic to determine whether we should customize the accessibility delegate. Previously, we did it if BOTH the accessibility label AND role were present. We should actually do it if EITHER are present.

Reviewed By: mdvacca

Differential Revision: D10182135

fbshipit-source-id: 209a8ab43f5869762843fe878cfd59a7b9b5ab1a
2018-10-03 18:40:12 -07:00
Ram N 7f6254be43 Cache the instance of `ChoreographerCompat`
Summary:
Since `ChoreographerCompat.getInstance()` is a singleton, we cache its instance.

This will be important in a subsequent diff where we ensure that `ChoreographerCompat.getInstance()` is only called on the UI thread

Reviewed By: achen1

Differential Revision: D9169298

fbshipit-source-id: 2067a50770dd41f5b1a12b62b6a9f8fea83d91e8
2018-10-03 13:40:36 -07:00
Ram N a5f3571770 Refactor the usages of ChoreographerCompat
Summary:
Reducing the places where we directly access `ChoreographerCompat.getInstance()`.

Since this is a singleton anyway, there was no need to pass this as an argument. In subsequent diffs, we will also ensure that `ChoreographerCompat.getInstance()` runs on the UI thread, so that the `Choreographer` it gets is based on the `Looper` of the main thread.

Reviewed By: achen1

Differential Revision: D10136624

fbshipit-source-id: ad18f7b61eb8b05094aff310f2eb90eb225427dc
2018-10-03 13:40:35 -07:00
Ram N 8b487d4d5a Create Handler lazily in DevServerHelper
Summary: Creating this Handler in the constructor implies that the constructor needs to run on the UI Thread. Since DevSupportManager is also initialized with ReactInstanceManager,

Reviewed By: mdvacca

Differential Revision: D10094981

fbshipit-source-id: b724b05ddbd6af68da1111a1a004491835f7a35a
2018-10-03 09:19:14 -07:00
David Vacca 001b04f983 Cleanup FabricBinding class
Summary: This diff removes unused method on the FabricBinding class, these methods were being used as part of the Fabric Android implementation, but they are not necessary anymore.

Reviewed By: shergin

Differential Revision: D10128636

fbshipit-source-id: 5afef4c2e9f4955af008200c5bdd2b6acc7ef333
2018-10-02 15:09:05 -07:00
David Vacca 9e7d918365 Introduce EventBeatManager and enable events
Summary: This diff introduces the concept of EventBeatManager, this is a class that acts as a proxy between the list of EventBeats registered in C++ and the Android side.

Reviewed By: shergin

Differential Revision: D10127857

fbshipit-source-id: a1956ca42d4c470fbc11cc9f30336a182fe7910c
2018-10-02 15:09:04 -07:00
Andrew Chen (Eng) 5be0dff433 Avoid view manager class loads (take 2)
Summary:
Second attempt at landing D9930713. Notes about the previous issue is mentioned as an inline comment below.

===========

We are currently iterating through each view manager to get its class name to pass to JS. JS uses this list to define lazy property accesses for each view manager to grab the constants synchronously. This results in each view manager's class loading immediately -- causing a small perf hit.

Let's avoid this view managers list entirely. JS is able to access each view manager directly by calling getConstantsForViewManager(name)

Reviewed By: axe-fb

Differential Revision: D10118711

fbshipit-source-id: 78de8f34db364a64f5ce6af70e3d8691353b0d4d
2018-10-02 14:03:24 -07:00
Andrew Chen (Eng) d3f2f96f93 Fix default accessibility delegate
Summary:
The current accessibility implementation tries to generalize every view's accessibility node info by setting an accessibility delegate on every view -- regardless of whether or not any accessibility properties are set. This delegate however doesn't correctly set the appropriate accessibility node fields for every view. For example, ScrollViews needs AccessibilityNode.setScrollable(true) set, but the generic delegate does not account for this. For now let's avoid unnecessarily
setting an accessibility delegate on views that don't have any accessibility props set, which will likely fix the majority of these issues.

Reviewed By: mdvacca

Differential Revision: D10138128

fbshipit-source-id: b999b41e7256e3dce94cd70e9b944979d52f74fd
2018-10-01 18:47:29 -07:00
Andrew Chen (Eng) 4ac500a337 Don't access ReadableNativeArray on UI thread
Summary: ReadableNativeArray initializes the ReactBridge which loads a bunch of c++ classes. Let's avoid doing this on the UI thread.

Reviewed By: mdvacca

Differential Revision: D10108380

fbshipit-source-id: ab4520535288ce450a865952e996b716d571df7f
2018-10-01 16:49:10 -07:00
Alexander Khaylo 4768bea0cf Fix CameraRoll.getPhotos() crash on Android if device has a problematic video asset (#21438)
Summary:
Changed catching IOException to Exception
Fixes #20112
Pull Request resolved: https://github.com/facebook/react-native/pull/21438

Differential Revision: D10132453

Pulled By: hramos

fbshipit-source-id: c68fa8c45d43e4f2d116b8084ffd731ad6bf5aec
2018-10-01 14:32:27 -07:00
Ram N ee74135a46 Add tracing to when SO libraries are loaded
Summary:
Currently, loading SO libraries is pretty expensive. While they are triggered due to accessing `ReadableNativeArray`. However, with preloader experiments, this block seems to move around and is loaded when the first dependent class loads it.

Also, as a part of D10108380, this will be moved again.

Adding a trace to keep track of where it moves.

Reviewed By: achen1

Differential Revision: D9890280

fbshipit-source-id: 4b331ef1d7e824935bf3708442537349d2d631d0
2018-10-01 14:08:29 -07:00
Héctor Ramos e28d8f6eeb Fix copyright headers
Summary:
Update several files to use the proper copyright header:

```
//  Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
```

In the case of Xcode project files, I used the shortform version, `Copyright (c) Facebook, Inc. and its affiliates.`

Reviewed By: axe-fb

Differential Revision: D10114529

fbshipit-source-id: a1f2d5a46d04797c1cf281ea9ab80d3a2caa6fb4
2018-09-28 17:33:12 -07:00
chenwenyu ea53727e16 Android: fix cookies lost on Android 5.0 and above (#19770)
Summary:
This fixes cookie missing bug on Android 5.0 and above.
On Android 5.0 and above, after the app successfully obtains the cookie, you kills the App within 30 seconds and restarts the App. It accesses the interface that needs to carry the cookie and finds that the cookie does not exist.

Updated tests for the addCookies function to include test cases specifying Android version, and tested on the command line in my app to make sure it has the expected behavior.

Updated tests for the addCookies function to include test cases specifying Android version, and tested on the command line in my app to make sure it has the expected behavior.

[ANDROID] [BUGFIX] [Cookie] - Fix cookies lost on Android 5.0 and above
Pull Request resolved: https://github.com/facebook/react-native/pull/19770

Differential Revision: D10114102

Pulled By: hramos

fbshipit-source-id: 5b4766f02f70541fd46ac5db36f1179fe386ac7a
2018-09-28 16:02:35 -07:00
Artur Chrusciel af181fb192 Check if child view != null before dropping (#20465)
Summary:
Fixes our top crash when framework try drop a view from parent, but it's a null (already removed etc.).

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

Differential Revision: D10113976

Pulled By: hramos

fbshipit-source-id: 34f5654f3bdbc63eb7f7d0b5c94885576fc3cdcd
2018-09-28 15:47:25 -07:00
Andrew Chen (Eng) e082a61324 Revert D9930713: Avoid view manager class loads
Differential Revision:
D9930713

Original commit changeset: 4aa013f8398d

fbshipit-source-id: 1fed02b41fa9d91f54d1a19f710bdb666701a4a0
2018-09-28 15:20:35 -07:00
Timothy Kukulski 97f0e43710 allow zero offset when shadow radius is nonzero
Summary:
update creation logic for text shadow: allow shadows with zero offset when the radius is nonzero

(?should we also add a check to drop the node as a no-op when color.alpha == 0 ?)

Reviewed By: yungsters

Differential Revision: D10017778

fbshipit-source-id: 0168ac6db5ad22a5d7eb32dcd184aede361d6651
2018-09-28 13:02:20 -07:00
Krzysztof Magiera 02ad56f541 Expose a getter for overflow setting in ReactViewGroup (#21398)
Summary:
This change adds getter for overflow attribute in ReactViewGroup class. Overflow setting can affect how view children are drawn but also how hit testing behaves when receiving touch. Exposing this setting makes it possible for gesture-handler library to implement proper hit testing that takes into account overflow property of a view.
Pull Request resolved: https://github.com/facebook/react-native/pull/21398

Differential Revision: D10105398

Pulled By: shergin

fbshipit-source-id: 15ae2b31be3bf80e7e1d28b87ce4474af0f486f5
2018-09-28 09:36:54 -07:00
Andrew Chen (Eng) 95174d4ea8 Avoid view manager class loads
Summary:
We are currently iterating through each view manager to get its class name to pass to JS. JS uses this list to define lazy property accesses for each view manager to grab the constants synchronously. This results in each view manager's class loading immediately -- causing a small perf hit.

Let's avoid this view managers list entirely. JS is able to access each view manager directly by calling getConstantsForViewManager(name)

Reviewed By: TheSavior

Differential Revision: D9930713

fbshipit-source-id: 4aa013f8398d4f51b7eef07937d2977ba1950726
2018-09-27 16:03:24 -07:00
Andrew Chen (Eng) 230b7b0e72 Introduce ReactNativeConfiguration to manage experimentation
Summary: Similar to ComponentsConfiguration used by Litho. Allows us to abtest without having to pipe everything through ReactInstanceManager

Reviewed By: axe-fb

Differential Revision: D9930707

fbshipit-source-id: 43edf7d8fa2bab7b7888df57ea1bec2b4726f51b
2018-09-27 16:03:23 -07:00
Andrew Chen (Eng) aac7c4d5d2 Refactor UIManager view manager accesses
Summary: Replaced each view manager access with a getViewManager() function call. This will later be used to lazily load view manager classes by allowing java to avoid sending the entire list of view managers to JS.

Reviewed By: QueryConnectionException

Differential Revision: D9695788

fbshipit-source-id: 949858aa2f0b0b00b68e260461ba8f1d085cf07f
2018-09-27 16:03:22 -07:00
Sergei Dryganets 748cf82c97 Rounded corner rendering fixed on Android N. (#21340)
Summary:
On Android N (API 24) rounded corners rendering has issues in case scale factor is set for the view.
Pull Request resolved: https://github.com/facebook/react-native/pull/21340

Differential Revision: D10084318

Pulled By: hramos

fbshipit-source-id: 53ae5a32b96cc7ee7eba084330682239d8beb85d
2018-09-27 08:17:21 -07:00
Ram N 62829a7a69 Initialize getConstantsForViewManagers eagerly
Summary: During the JS run, the view managers used on a React Native screen eventually call the native methods for `UIManagerModule.getConstantsForViewMangers(viewManagerName)`. This blocks the JS thread. This diff tries to cache the values of those calls and return them when JS needs it, ensuring that JS is not blocked as much.

Reviewed By: achen1

Differential Revision: D9985817

fbshipit-source-id: 36feabc8a386956f8a6474f6e7978285d31f24dd
2018-09-26 18:17:13 -07:00
David Aurelio 6bcc1dfcc8 Set up Yoga experiment
Reviewed By: priteshrnandgaonkar

Differential Revision: D9943869

fbshipit-source-id: 6b6550f453ab4e0ab8305401b299f2d0ed415f72
2018-09-25 15:48:03 -07:00
David Aurelio 27a3bdb886 Adapt methods for fast calls
Summary:
Changes all possible native JNI methods to critical methods.

For now, this only changes Android up and including v7. In order to be prepared for the `CriticalNative` annotation in Android v8, the following restrictions apply:

- Qualifying methods must be static (this is also enforced for Dalvik / Android v4)
- Method implementations can only consume primitive JNI types (`boolean`, jchar`, etc.)

Reviewed By: priteshrnandgaonkar

Differential Revision: D9943868

fbshipit-source-id: 728817eb37822b717fd3daf94cd9f02b42c17db6
2018-09-25 15:48:03 -07:00
David Aurelio ee6c1ecef0 Make native method binding configurable
Summary:
Moves binding of native methods into a separate native method that can be parameterized.

This will be used to experiment with JNI-related technology.

Reviewed By: priteshrnandgaonkar

Differential Revision: D9943870

fbshipit-source-id: 661f15537d5bbf7a3eef7717e3d99fed2de23904
2018-09-25 15:48:03 -07:00
Matias Colotto 201f2f189f ReactScrollView should account for `overflow: scroll`
Summary:
Support for `overflow: visible` was recently added to Android ScrollView.
However, it didn't account for `overflow: scroll` and changed the behavior, causing content to render
when before it would be clipped.

Reviewed By: achen1

Differential Revision: D10036807

fbshipit-source-id: e44a79b18eecbc7d64621f7cf5d800a00a121b13
2018-09-25 15:04:01 -07:00
Andrew Chen (Eng) 59aada873e Remove overflow hidden killswitch
Summary: There hasn't been any reports of overflow issues since the last issue was fixed in v183 (July 30th). Let's remove this flag

Reviewed By: yungsters

Differential Revision: D10020006

fbshipit-source-id: 593c7d2c2bef5f0bd60d5de1941cd58f7fd6ccc7
2018-09-25 11:52:19 -07:00
David Vacca b41ce43c07 Move folder and packages from 'fabricxx' to 'fabric'
Summary: This diff renames fabricxx into fabric

Reviewed By: achen1

Differential Revision: D10013410

fbshipit-source-id: 75d73ace6957d706d39bb87118140bb642bed747
2018-09-25 02:30:04 -07:00
David Vacca a5f1d79adf Move fabric dependecies out of OSS instrumentation tests (#21306)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/21306

This diff moves fabric dependencies out of OSS instrumentation tests (js/react-native-github/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK), this will un-break build of OSS project in CI.

Reviewed By: rsnara

Differential Revision: D10020517

fbshipit-source-id: e2cf23afeeecf4cfb41345742f59c16af6b108d0
2018-09-25 02:30:04 -07:00
gengjiawen 0a2825f8b3 add x86_64 arm64-v8a support. Fixes #2814 (#18754)
Summary:
add arm64 support, related issue : https://github.com/facebook/react-native/issues/2814.
If we are okay with binary aar android-jsc, then the pr can be directly merged. Otherwise merge facebook/android-jsc#30 first and do a new release.

RNTester all variant works. You can also test the apk from here: https://github.com/gengjiawen/react-native/releases/tag/v0.56beta.

https://github.com/facebook/android-jsc/pull/30.

 [ANDROID] [ENHANCEMENT] [ABI] - add x86_64 arm64-v8a support.

Differential Revision: D9491481

Pulled By: hramos

fbshipit-source-id: d6ec6992768eb0c0866a0317273e09fae5b8935e
2018-09-24 11:32:56 -07:00
David Vacca ef863c0679 Remove unused parameters in ReactInstanceManager methods
Summary: Just a small diff to remove some unused parameters in some methods of the ReactInstnaceManager class

Reviewed By: achen1

Differential Revision: D10011168

fbshipit-source-id: 2247ecd01bfc63c27837c6abad4bff1b4e590ac0
2018-09-24 11:17:59 -07:00
Oleg Lokhvitsky e0170a9445 Android ScrollView fix for pagingEnabled
Summary:
The snapToOffsets changes improved the flinging algorithm for snapToInterval/snapToOffsets but actually broke it for pagingEnabled because it's meant to only scroll one page at a time.

First, I just brough back the old algorithm, but noticed that it has a bunch of issues (e.g. #20155). So, I tried to improve the algorithm to make sure it uses the proper target offset prediction using the same physics model that Android uses for it's normal scrolling but still be limited to one page scrolls.

This resolves #21116.

Reviewed By: shergin

Differential Revision: D9945017

fbshipit-source-id: be7d4dfd1140f4c4d32bad93a03812dc80286069
2018-09-24 10:22:23 -07:00
Oleg Lokhvitsky 4af4da9089 Android ScrollView support for `overflow: visible`
Summary:
ScrollView always clipping children on Android even when `overflow: visible` was specified.
This change just omits the clipping during draw if `overflow: visible` is passed in.
The default is not changed (from hidden to visible) in case there is a performance impact.
Android now matches iOS in behavior. This helps with issue #21116 and resolves #14416.

Reviewed By: shergin

Differential Revision: D9952096

fbshipit-source-id: 367afe33ee7ff0fdc5aa1074d239883aa289888a
2018-09-24 10:22:23 -07:00
Kevin Leung 65e4e674fc Android subpixel text (#19043)
Summary:
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Fixes inconsistency in custom font rendering in android. See explanation below.

<!--
  Required: Write your test plan here. If you changed any code, please provide us with
  clear instructions on how you verified your changes work. Bonus points for screenshots and videos!
-->

I tested the following on my physical device (Sony Z5C) and on Android emulator on Mac.
The test app contains various fonts in the AvenirNext family, which are added to the app as `.ttf` format.

Note that the character "thickness" is inconsistent. Some characters looks thicker than other. See the screenshots below as an example:
- Looks thicker: right half of the `g` and `&` as in "Region & Language" (list-view screen)
- Looks thicker: `w` as in `Change Password` (list-view screen)
- Looks vertically compressed: `a` and `e` as in "Message" in the bottom bar (list-view screen)
- Looks thicker: `A`, `N`, `V`, `v` (paragraph screen)
- Looks thinner: `i` (paragraph screen), it leaves extra space on its right hand side

![screenshot_20180427-151129](https://user-images.githubusercontent.com/1103788/39350754-ae9fafe2-4a31-11e8-8835-97280783bb95.png)
![screenshot_20180427-151419](https://user-images.githubusercontent.com/1103788/39350755-aecc9bba-4a31-11e8-8128-2d230f003dfa.png)

Every characters has consistent "weight" and looks nice:

![screenshot_20180427-150835](https://user-images.githubusercontent.com/1103788/39350753-ae698728-4a31-11e8-8a55-4e161c559b95.png)
![screenshot_20180427-151639](https://user-images.githubusercontent.com/1103788/39350756-aef95d44-4a31-11e8-820b-1a7dee77fabe.png)

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

None

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[ANDROID] [ENHANCEMENT] [CustomStyleSpan] - Enable subpixel text rendering

<!--
  **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

    CATEGORY
  [----------]      TYPE
  [ CLI      ] [-------------]    LOCATION
  [ DOCS     ] [ BREAKING    ] [-------------]
  [ GENERAL  ] [ BUGFIX      ] [ {Component} ]
  [ INTERNAL ] [ ENHANCEMENT ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {Message} |
  [----------] [-------------] [-------------]   |-----------|

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/19043

Differential Revision: D10008155

Pulled By: hramos

fbshipit-source-id: 7fe9bb0f9be80380947ff80eac522e3cfd6b22cf
2018-09-24 02:03:31 -07:00
Krzysztof Ciombor 4d71b1525d Fix event handlers for DPad arrows on Android TV (#21143)
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Fixes #20924
DPad arrow events were missing from `KEY_EVENTS_ACTIONS` which meant that they were not broadcasted by `TVEventHandler`.
Pull Request resolved: https://github.com/facebook/react-native/pull/21143

Differential Revision: D10007851

Pulled By: mdvacca

fbshipit-source-id: 9a03cad249a4a1917975d1de10b6112e69d32a72
2018-09-24 00:47:07 -07:00
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
Andrew Chen (Eng) afe0843bee Move ReactNativeTestRule to OSS
Summary: And migrated ReactRootViewTestCase to use ReactNativeTestRule.

Reviewed By: mdvacca

Differential Revision: D9557362

fbshipit-source-id: 1469d0ad8c125b5ea729371d81956e61780c56cf
2018-08-29 12:54:13 -07:00
Andrew Chen (Eng) 251cbb3871 Eagerly initialize FrescoModule
Summary: It's unclear if this was a recent regression or not (too lazy to find out), but instrumentation tests are failing because FrescoModule is never initialized (see task for trace). Based on the initial introduction of this class (D2448321) it appears that FrescoModule was always intended to be initialized on startup. Let's eagerly init Fresco in that case.

Reviewed By: fkgozali

Differential Revision: D9556864

fbshipit-source-id: 0b670dec46f5087b3794330931ddf5d7782c8367
2018-08-29 10:03:26 -07:00
David Vacca 8b5e3fc16b Update size of Root ShadowNode when RootView changes its size
Summary: This diff updates the size of RootShadowNode and re-render RN views when the Size of the Android React View changes

Reviewed By: achen1

Differential Revision: D9173758

fbshipit-source-id: 7cc6bbfb646025c3ec1773ab041eb9207623af71
2018-08-28 23:03:34 -07:00
David Vacca 575f7d478d Implement HorizontalScrollView component
Summary: This diff implements the HorizontalScrollView component for Android Fabric C++, as part of this diff I also re-named the components AndroidHorizontalScrollContentView for RCTAndroidHorizontalScrollContentView and AndroidHorizontalScrollView for RCTAndroidHorizontalScrollView. This might sound against our plan of removing the RCT preffix, but it is to make it simpler to map components between current implementation of RN and Fabric (otherwise we don't know when to add the RCT preffix in Android side to find the right View Manager), later we can just remove the preffix from C++, Android, iOS and JS.

Reviewed By: shergin, achen1

Differential Revision: D9122729

fbshipit-source-id: e9299552857c6dd0c18abfa5fa49a3d50e221729
2018-08-28 23:03:33 -07:00
Ram N 01580de613 Move interfaces from Bridge to a new buck target
Reviewed By: achen1

Differential Revision: D9513130

fbshipit-source-id: f23e3274eed5f0adcffdc3e10d20a4d49e81bca5
2018-08-28 22:49:07 -07:00
Peter Argany 58409be6b4 Eagerly create FBMarketplaceNativeModule [2/N]
Summary:
The full idea for eagerly creating Native Modules is articulated here https://fb.quip.com/vWcLAup3a6kR

TLDR:
1) Move lazy native module work from the mqt_js thread to the background thread which processes packages. This also moves it from post-network to pre-network.
2) For a quick test, decide which modules to eagerly create with a QE flag.
3) Eagerly create the modules by opting-out of the ReactModuleInfo pipeline which was built for lazy native modules.

Reviewed By: achen1

Differential Revision: D9503934

fbshipit-source-id: 0cd8337ad294cd0f8be692fecbf4292d204f3ec4
2018-08-28 11:02:52 -07:00
David Vacca e8c7cb1c04 Revert D9105838: [react-native][PR] Fix view indices with Android LayoutAnimation (attempt 2)
Differential Revision:
D9105838

Original commit changeset: 5ccb0957d1f4

fbshipit-source-id: f679eceac47c95d9138f1a91a77cc20a74e64e04
2018-08-27 20:19:15 -07:00
Andrew Chen (Eng) 1f96ff62cf Fix accessibilityRole value lookup
Summary:
Accessibility roles are enums that are looked up by matching a string accessibility role from JS to the enum's name using .toUpperCase(). .toUpperCase() causes issues in certain languages such as Turkish because the "i"s translate to "?".

D9402330 tried to address this by forcing the .toUpperCase to use Locale.US, but now it sometimes translates to "?"

Use .equalsIgnoreCase() instead to avoid translations.

Reviewed By: mdvacca, mmmulani

Differential Revision: D9497494

fbshipit-source-id: 0f8b7f2071b08ccb86655fee7bfd2d009ddde8eb
2018-08-24 13:21:21 -07:00
gengjiawen 6e356895e7 bump android gradle to 3.1.4 (#20767)
Summary:
Bump android gradle plugin to 3.1.4. We have been stay to 2.x too long. With 3.x we can have instant run and great performance and new features brought by google.

Also thanks to CFKevinRef great pr to make this possible.
pass all current ci. I have also tested RNTester release version works without crash.
https://github.com/facebook/react-native/pull/17967.
 [GENERAL] [ANDROID] [FEATURE] - bump android gradle to 3.1.4
Pull Request resolved: https://github.com/facebook/react-native/pull/20767

Differential Revision: D9437576

Pulled By: hramos

fbshipit-source-id: 6084056a1390582a75a879918f2538b0480f6299
2018-08-22 23:19:42 -07:00
Dulmandakh 044b399e65 Bump compileSdkVersion to 27 and buildToolsVersion to 27.0.3 (#20777)
Summary:
I found that android support library 27.x (874cca1ac2) requires compileSdkVersion to be 27. Also found that many FB projects use SDK 27.
Pull Request resolved: https://github.com/facebook/react-native/pull/20777

Differential Revision: D9478431

Pulled By: hramos

fbshipit-source-id: ca100f6b5b39e7d112926124423f9510a0efc291
2018-08-22 23:19:42 -07:00
Sergei Dryganets 79fe925f1d Android. OkHttp crash fixed on upload re-try. (#20802)
Summary:
This change fixes this issue:
https://github.com/facebook/react-native/issues/10423
Pull Request resolved: https://github.com/facebook/react-native/pull/20802

Differential Revision: D9478422

Pulled By: hramos

fbshipit-source-id: ce3a098a71c8f50a62b011a2a277004ab7a7b655
2018-08-22 23:04:56 -07:00
Emily Janzer bce77c8b3b Convert ReactMarkerConstants enum to consts
Summary: Converting ReactMarkerConstants enum to consts + stringdef annotation

Reviewed By: mdvacca

Differential Revision: D9304307

fbshipit-source-id: db9d170e80593131bd4ebd6937d2f6ce6e694e4e
2018-08-22 14:02:56 -07:00
Dulmandakh 7ff9352a88 Remove TextLayoutBuilder from ReactAndroid dependency (#20600)
Summary:
This PR removes TextLayoutBuilder, which is not used anywhere.
Pull Request resolved: https://github.com/facebook/react-native/pull/20600

Reviewed By: achen1

Differential Revision: D9367345

Pulled By: hramos

fbshipit-source-id: 407a6a80f5c69650fcc7167b28214f7315beed2f
2018-08-22 13:48:53 -07:00
Dulmandakh f884a1be69 use latest infer-annotations from maven (#20599)
Summary:
This PR removes infer-annotation from the repo and uses latest version of it from maven.
Pull Request resolved: https://github.com/facebook/react-native/pull/20599

Differential Revision: D9437594

Pulled By: hramos

fbshipit-source-id: 93c33041dd8a61b220c352fb187a23bb2dd1b4db
2018-08-22 12:31:19 -07:00
Andrew Chen (Eng) 833954a669 Append LayoutUpdateListener to UIViewOperationQueue
Summary:
There are multiple UI thread passes during the layout process. The first is with all of the operations from React (createView, manageChildren, etc). The second is during onCollectExtraUpdates after the layout pass, when things like Text need to be precomputed before later being sent over to the views.

The onLayoutUpdateListener needs to run AFTER onCollectExtraUpdates operations are executed, so this is now queued up in the UIViewOperationQueue

Reviewed By: mdvacca

Differential Revision: D9416260

fbshipit-source-id: d1a4eaf38a4f6c82d41def34ffb94d303e8f50d4
2018-08-22 12:31:18 -07:00
Dulmandakh 874cca1ac2 Bump Android Support Library to 27.1.1 (#20586)
Summary:
This PR bumps Android Support Library version to 27.1.1.

FYI, originally was a part of https://github.com/facebook/react-native/pull/20026.
Pull Request resolved: https://github.com/facebook/react-native/pull/20586

Differential Revision: D9414901

Pulled By: hramos

fbshipit-source-id: 580338e62a924c214accc5d944f17c81ad9e3f9f
2018-08-20 18:08:52 -07:00
Haseeb Saeed 139559fc07 Fix accessibility role crash
Summary: We were using a locale-specific `toUpperCase()` for accessibility roles. In the Turkish locale, `"image".toUpperCase()` does not become `"IMAGE"`; it becomes some weird turkish alphabet word, and we throw an error. This diff uses US-locale to avoid the error.

Reviewed By: YaoPersonal

Differential Revision: D9402330

fbshipit-source-id: a3fd7c54eec4b313c7e9df9236adb7ae42854ed8
2018-08-20 12:17:59 -07:00
Tim Yung 735be8b24d RN: Support Cached Bundles in Systrace
Summary:
When running Systrace, we currently only surface the JavaScript bundle that is pre-packaged in the binary.

This changes `ReactInstanceManager` so that we prefer a cached bundle if one exists. This allows running Systrace with local changes (as long as you load them into the client before running Systrace).

Differential Revision: D9389704

fbshipit-source-id: 031321b2e07539efc7f47a7c6947ab7b82dc7dfc
2018-08-17 23:16:46 -07:00
David Vacca f9c86f05e9 Implement remove root view operations
Summary: This diff implements the removal of react root view inside fabric cxx implementation

Reviewed By: shergin

Differential Revision: D8939942

fbshipit-source-id: 69835b55c80e2970d65220d947489bc1af4b125d
2018-08-16 16:52:42 -07:00
David Vacca 596f17efda Initialize FabricXX C++ code and register rootview
Summary: This diff initializes Fabric C++ UIManager code from java, it also registers android RootViews inside C++.

Reviewed By: shergin

Differential Revision: D8878148

fbshipit-source-id: 8b7924f715b135eda37bb2683206d3e321a2b7b2
2018-08-16 16:52:42 -07:00
David Vacca fd29878a8b Create CXX Binding
Summary: This diff creates the C++ base classes for Fabric and it integrates them into the starting process of Fabric inside Catalyst App

Reviewed By: shergin

Differential Revision: D8878123

fbshipit-source-id: ce41ad6addfdfb58e602b2dbafebd8f05847e69f
2018-08-16 16:52:42 -07:00
Marc Horowitz f71c6b6feb Expose executor name in ReactInstanceManager
Reviewed By: achen1

Differential Revision: D9231741

fbshipit-source-id: 34e616844c35b8cf8c7fb9760669a8905c3b86c5
2018-08-16 16:52:42 -07:00
Stephen Cook 22cf5dc566 Android textTransform style support (#20572)
Summary:
Issue https://github.com/facebook/react-native/issues/2088 (closed, but a bit pre-emptively imo, since Android support was skipped)

Related (merged) iOS PR https://github.com/facebook/react-native/pull/18387

Related documentation PR https://github.com/facebook/react-native-website/pull/500

The basic desire is to have a declarative mechanism to transform text content to uppercase or lowercase or titlecase ("capitalized").
Pull Request resolved: https://github.com/facebook/react-native/pull/20572

Differential Revision: D9311716

Pulled By: hramos

fbshipit-source-id: dfbb855117196958e7ae5e980700d31be07a448d
2018-08-13 21:31:57 -07:00
Alex Dvornikov 1cd9aa2dea Add REGISTER_JS_SEGMENT perf markers
Reviewed By: cwdick

Differential Revision: D9244289

fbshipit-source-id: 9004a0405f9622cbd0bbb837b99df32454f35bb8
2018-08-10 09:37:42 -07:00
Linus Unnebäck e6b305b722 Properly escape JavaScript code on Android (#20366)
Summary:
These changes will fix executing javascript with any special characters, by making use of the `evaluateJavascript` function on Android 4.4+, and by properly escaping the URI on Android <4.4.

Fixes #19611Fixes #20365Fixes #9749Closes #19655Closes #12321

This PR supersedes #19655 by patching the same problem in all the places, and fixing it for Android <4.4 as well.
Pull Request resolved: https://github.com/facebook/react-native/pull/20366

Differential Revision: D9242968

Pulled By: hramos

fbshipit-source-id: f2e1abc786ba333dbd8aaa8922e716fd99ec26e0
2018-08-09 11:16:59 -07:00
Wayne Cheng f536a0c268 Adding flow strict local to remaining possible files in xplat/JS
Summary:
ag -L --ignore __snapshots__ 'flow strict|noflow|generated|The controller you requested could not be found.' | ag '\.js$' | xargs ag -l 'flow' | sort > ~/temp
  cat ~/temp | xargs ag -L 'flow strict' | xargs sed -i '' 's/flow$/flow strict-local/'
  until flow check; do flow check --json | jq -r '.errors[].message[0].path' | sort | uniq | xargs hg revert; done

allow_many_files
The controller you requested could not be found.
The controller you requested could not be found.

Reviewed By: TheSavior

Differential Revision: D9004573

fbshipit-source-id: 936bd5741706b781be06bf08b6ad805a69407dfd
2018-08-09 08:54:44 -07:00
Ram N 617e25d9b5 Explicitly make UIManagerModule use OnBatchComplete on Android
Summary:
Currently, we scan all native modules to see if they implement the OnBatchCompleteListerner. If they do, we add those modules to a list, and when C++ calls OnBactchComplete is called, we execute the callback on each of the modules.
The only native module implementing this callback today is the UIManagerModule. With Fabric, UIManager will also not be a native module anymore. This diff removes all the work done for creating the list and assumes that UIManagerModule is the only place that is interested in OnBatchComplete call - and calls it directly.

Reviewed By: achen1

Differential Revision: D9186651

fbshipit-source-id: 473586b37c2465ccd041985dcdd56132026f34f1
2018-08-08 14:18:07 -07:00
Dulmandakh 69912495f9 Bump imagepipeline-okhttp3 to 1.10.0 (#20580)
Summary:
This is a small missing piece from b6f2aad9c0 and will complete fresco version bump.
Pull Request resolved: https://github.com/facebook/react-native/pull/20580

Differential Revision: D9228658

Pulled By: hramos

fbshipit-source-id: 9cf1509a590cedfe4c3358006cfb62533058e946
2018-08-08 14:02:26 -07:00
Ziqi Chen d3f0919816 added accessibilityHints implementation on Android
Summary:
Implemented a version of accessibility Hints on android by adding hint text to the end of contentDescription. There is already an existing prop on js and iOS implementation.

Changes involve:
* adding a prop on native android code for accessibilityHints
* setting the accessibilityDelegate after the props are all loaded.
* Instead of directly updating the accessibility delegate, the prop setters now update state by setting the values of the variables. Once all props are set, the accessibility delegate is set based on the props
   * BaseViewManager keeps track of whether or not accessibility props have been set
   * AccessibilityDelegateUtil keeps track of what the props have been set to. (Renamed AccessibilityRoleUtil to AccessibilityDelegateUtil)

Currently, this is the easiest way of emulating the way accessibility hints work on iOS, and I think having an android counter part is better than having nothing.

It's different from iOS in that it will announce the hint before the role, and also cannot be turned off.

Ex:

if I set the accessibility like this:
```
      <View
        style={styles.container}
        accessible={true}
        accessibilityLabel="accessibility label"
        accessibilityRole="button"
        accessibilityStates={['selected']}
        accessibilityHint="accessibility Hint">
        <Text> Tester </Text>
      </View>
```

Talk back will read:
`accessibility label, accessibility Hint, button, selected`

In the future for next steps, I plan on investigating the process of making a second announcement after the first

Reviewed By: achen1

Differential Revision: D9037226

fbshipit-source-id: 8d484e1114eb69aa5f5314b3755b351b8ea80b09
2018-08-08 01:02:24 -07:00
David Aurelio 151ec411aa Back to JNI storage
Summary:
@public

This reverts the Yoga/Java storage experiment. I will follow up with any learnings.

Reviewed By: pasqualeanatriello

Differential Revision: D9168405

fbshipit-source-id: fb227fb9353bd4c4e3bebbe9b04eec1132e532e8
2018-08-06 02:16:22 -07:00
David Aurelio 73d5746122 Add `Unsafe` based storage backend
Summary:
@public

Adds another version of property storage for `YogaNode`, using `sun.misc.Unsafe`.

Adopts the stub concept from Litho for `Unsafe`, as it is hidden by the Android SDK.

Reviewed By: pasqualeanatriello

Differential Revision: D9140103

fbshipit-source-id: a4b376eca341b724a00f873467ae8bf8eaac69f4
2018-08-05 16:46:26 -07:00
Ram N 407e033b34 Remove the flag about Lazy native modules
Summary: The method removes all settings for mLazyReactModules since Lazy and non lazy modules can exist in a single application now

Reviewed By: achen1

Differential Revision: D9012312

fbshipit-source-id: 0420149654f8146453250d83d4de4b4c2fd31e9f
2018-08-02 16:02:36 -07:00
Ram N 42146a7a4a Fix LazyReactPackage in OSS
Summary:
In OSS, during gradle build, the ReactModuleSpecProcess annotation-processor does not run. As a result, the `ReactModuleInfo` that we need for CoreReactPackage is not generated, resulting in a runtime error.

The fix is to make LazyReactPackage revert to what it was doing earlier. In `NativeModuleRegistryBuilder`, if we dont find `ReactModuleInfo` for any `ModuleSpec`, we eagerly instantiate the module and get all the `ReactModuleInfo` from it. By returning an emoy collection if the class is not available, we force the modules in `CoreReactPackage` to use this codepath instead.

The alternate fix would be to ensure that the annotation processor runs in gradle/OSS. However, the annotation processor will be removed eventually in the future, and we will also be move to generating them for JS, so that work will soon be irrelevant.

Reviewed By: fkgozali, achen1

Differential Revision: D9130517

fbshipit-source-id: 469cf0e32a2f3650f098547667b3cd09a63eb1a0
2018-08-02 12:16:38 -07:00
Leo Nikkilä 1f88a7111d Fix view indices with Android LayoutAnimation (attempt 2) (#19775)
Summary:
/cc janicduplessis mdvacca

This addresses the same issue as #18830 which was reverted since it didn’t handle `removeClippedSubviews` properly.

When subview clipping is on, ReactViewGroup keeps track of its own children directly and accounts for the offset introduced by clipped views when calling ViewGroup methods that modify children.

Instead of accounting for just clipped children (views with no parent), it should account for any children that aren’t in the ViewGroup which also includes children that are being transitioned. If you look at the ViewGroup source code, [it explicitly retains the view parent until the transition finishes](https://github.com/aosp-mirror/platform_frameworks_base/blob/oreo-release/core/java/android/view/ViewGroup.java#L5034-L5036) which caused the `getParent()` checks to pass, even though those views should be ignored. I added a new `isChildInViewGroup` method that handles both clipped and transitioning views to fix this.

I reproduced the [earlier crash](https://github.com/facebook/react-native/pull/18830#issuecomment-382798628) by enabling clipping in [this test app](https://github.com/facebook/react-native/pull/18830#pullrequestreview-111758886) and adding a “clear views” button that resets the state to an empty items array with an animation.

- #18830

[ANDROID] [BUGFIX] [LayoutAnimation] - Removal LayoutAnimations no longer remove adjacent views as well in certain cases.
Pull Request resolved: https://github.com/facebook/react-native/pull/19775

Differential Revision: D9105838

Pulled By: hramos

fbshipit-source-id: 5ccb0957d1f46c36add960c0e4ef2a545cb03cbe
2018-08-02 07:01:42 -07:00
David Aurelio b91184885f Fix behaviour of `freeNatives()`
Summary:
@public

Prevents repeated deallocation of weak references.

Reviewed By: pasqualeanatriello

Differential Revision: D9131551

fbshipit-source-id: bc79596e056ae0657a55146ad786422fd0f5badc
2018-08-02 04:02:09 -07:00
David Aurelio cdf9b84dd0 Adapt micro benchmark
Summary:
- adds more property assignments
- reduces the number of layout roots that exist simultanously

Reviewed By: pasqualeanatriello

Differential Revision: D8989389

fbshipit-source-id: 6a0ac800a4caad61a2f4bf98caa314855b70875f
2018-08-02 04:02:08 -07:00
Himabindu Gadupudi 9f8b5a9ed5 If source is null , source uri is null or source is not an array should respect style
Summary: If source is null , source uri is null or source is not an array should respect style like in iOS

Reviewed By: yungsters

Differential Revision: D9018005

fbshipit-source-id: 5f695e8e3007c96e6004973e7fcbc6b57cc15249
2018-07-31 12:02:10 -07:00
gengjiawen b6f2aad9c0 Upgrade to soloader 0.5.1 (#20325)
Summary:
Upgrade to soloader 0.5.1. Fixes #20323.

pass all current ci.

none

 [GENERAL] [BUGFIX] [ANDROID] - Upgrade to soloader 0.5.1
Pull Request resolved: https://github.com/facebook/react-native/pull/20325

Differential Revision: D9060688

Pulled By: hramos

fbshipit-source-id: 614c0c1e3cd3981a0acb2effab7ddd4e4508cbcd
2018-07-31 01:32:30 -07:00
Dulmandakh 3ea803a814 bump mockito to 2.19.1 (#20317)
Summary:
This PR will bump mockito to 2.19.1, which has many enhancements over 1.x version. Read https://github.com/mockito/mockito/wiki/What%27s-new-in-Mockito-2. Also bumps jsr305 to 3.0.2.
Pull Request resolved: https://github.com/facebook/react-native/pull/20317

Differential Revision: D9071184

Pulled By: hramos

fbshipit-source-id: 109c8adde7dabdb25ddc329ff84ee40c9a0a5e3d
2018-07-30 15:31:38 -07:00
Dulmandakh 6117a6c720 Bump Android NDK to r17b (#20357)
Summary:
This PR bumps Android NDK version to r17b (latest). Cleaned up redundant **LOCAL_EXPORT_CPPFLAGS** rules in .mk files
Pull Request resolved: https://github.com/facebook/react-native/pull/20357

Differential Revision: D9068424

Pulled By: hramos

fbshipit-source-id: 8578637e38e807288b819a36cb75ea9feefcc09f
2018-07-30 14:02:11 -07:00
Daniel Cochran 1b09bd7fba make AsyncStorage serially execute requests (#18522)
Summary:
This patch is a bit of a hack job, but I'd argue it's necessary to dramatically improve the dev UX on Android devices. Somewhere in react-native, there's a shared SerialExecutor which AsyncStorage uses that is getting blocked, causing remote debugging to occasionally hang indefinitely for folks making AsyncStorage requests. This is frustrating from a dev UX perspective, and has persisted across several versions as far back as RN 0.44, and still remains on RN 0.54.

The issue seems to only happen on Android > 7+, which is likely because the ThreadPoolExecutor behavior changed in this version:
https://stackoverflow.com/questions/9654148/android-asynctask-threads-limits

Fixes #14101

We've been using this patch in production for the past 4 months on our team by overriding the AsyncStorage native module. We use AsyncStorage extensively for offline data and caching.

You can test by compiling this commit version into a test react native repository that is set to build from source:

```sh
git clone https://github.com/dannycochran/react-native rnAsyncStorage
cd rnAsyncStorage
git checkout asyncStorage
cd ..
git clone https://github.com/dannycochran/asyncStorageTest
yarn install
cp -r ../rnAsyncStorage node_modules/react-native
react-native run-android
```

No documentation change is required.

https://github.com/facebook/react-native/pull/16905

[Android] [BUGFIX] [AsyncStorage] - Fix AsyncStorage causing remote debugger to hang indefinitely.
Pull Request resolved: https://github.com/facebook/react-native/pull/18522

Differential Revision: D8624088

Pulled By: hramos

fbshipit-source-id: a1d2e3458d98467845cb34ac73f2aafaaa15ace2
2018-07-30 12:03:14 -07:00
David Aurelio 23657ccf5b Add `YogaNodeProperties` implementation with `ByteBuffer` based setters
Summary:
@public
Adds an implementation of `YogaNodeProperties` that sets style properties using a `ByteBuffer` rather than JNI calls.
We hope for a speed improvement.

Reviewed By: pasqualeanatriello

Differential Revision: D9042225

fbshipit-source-id: c7f2b24eaeddd1190755bec85a5034079bd2f492
2018-07-30 09:33:10 -07:00
David Aurelio 0c97e75dfe Add `YogaNodeProperties` implementation based on `ByteBuffer`
Summary:
@public
Adds an implementation of `YogaNodeProperties` that accesses style and layout properties using a `ByteBuffer` rather than JNI calls.
We hope for a speed improvement.

This needs further cleanup after experimenting, e.g. to codegen the offsets.

Reviewed By: pasqualeanatriello

Differential Revision: D8911723

fbshipit-source-id: 3c24b57eb545155878896ebb5d64d4553eb6bedc
2018-07-30 09:33:10 -07:00
David Aurelio 930bf1614c move property storage into sub-object
Summary:
Here we introduce an abstraction over node property storage, in order to experiment with different approaches for Java/C integration.

- interface `YogaNodeProperties` as abstraction
- current JNI code factored into `YogaNodePropertiesJNI.java`
- `YogaNode` delegates all calls, no API changes

Reviewed By: astreet

Differential Revision: D8769448

fbshipit-source-id: e67327ce41fa047a51a986c652b3d59992a510e2
2018-07-30 09:33:10 -07:00
Ram N c383138842 Use string class names for native modules
Summary: Using strings as keys for module names instead of actuall `.class` prevents additional class loading

Reviewed By: achen1

Differential Revision: D8955006

fbshipit-source-id: 12e6ad35fc35c969c05ca081976cc05b054f6821
2018-07-28 00:16:16 -07:00
Ram N c8e000b19a Prevent class loading for lazy native modules
Summary:
When native modules use `LazyReactPackage`, the modules themselves are not initialized. However, they still use the class names, causing the classes to load. This diff removes the need to perform any class loads. Any properties of the classes that are required are now populated in the `ReactModuleInfo` of that class.

Note that this diff itself does not prevent class loading since any references to `*.class` in `LazyReactpackage` needs to be removed in a consequent diff

Reviewed By: achen1

Differential Revision: D8950025

fbshipit-source-id: 80ddf7e1f33bf2af0db1bd262069795de77ec611
2018-07-27 23:47:28 -07:00
Ram N d891ee1dee Make ReactModuleInfoProvider use string keys
Summary: `ReactModuleInfoProvider` was using `Class` as the keys. This would make the classes to load. This change makes the map use canonicalName Strings of the classes, removing the need for the classes to load at this point.

Reviewed By: achen1

Differential Revision: D8944078

fbshipit-source-id: 4aa562d74d6ad3ebb9962b581d4e2f5e89d47ca6
2018-07-27 22:48:11 -07:00
Ziqi Chen 40f6998b67 added a null check on accessibilityStates
Summary:
Added a check for null on `accessibilityStates`.
Now, if a null value is passed in to the prop, it simply does not do anything.

Reviewed By: achen1

Differential Revision: D9034714

fbshipit-source-id: caffa41a1d8b08d5358d085e4e268e8e6f1c9344
2018-07-27 15:18:37 -07:00
Andrew Chen (Eng) 27b3aecb3d Fix RN Litho invalidations
Summary:
We were seeing a bug where embedded feed stories showed the loading spinner forever until a scroll event occurred. Embedded feed stories are built on top of our RN + Litho integration which requires additional logic to support remeasuring the shadow tree when the intrinsic size of the litho component changes (aka wrap_content). Previously, we simply overrode requestLayout() of ReactLithoView to inform the shadow tree that that node needs to be dirtied -- in which case a
subsequent layout pass would resolve these changes. This worked fine in dev builds, but it turns out that release builds never received a subsequent layout pass. Dev builds apparently have a loop that dispatches view updates every second or so while release doesn't (not sure why), but that was the reason why the dev version eventually invalidated the views. The solution here is to simply always invoke a view update when any embedded Litho component requires a relayout.

Reviewed By: mdvacca

Differential Revision: D8983995

fbshipit-source-id: 53c528b3c00aad2bbe8e7f6360dc8e1594da1298
2018-07-27 14:16:33 -07:00
Ram N 059fb2fd81 Make Catalyst support lazy and non-lazy native modules
Summary:
An application could either have lazy, or non-lazy modules. This diff simply lets the individual reactPackages decide if they should be lazy or not, based on the variable in `ReactInstanceManagerBuilder`.

This diff also removed the method `setLazyNativeModules()` since an app can now have both native and non-native modules.

Reviewed By: achen1

Differential Revision: D8940026

fbshipit-source-id: 0399f4f39ad57f2b03e4dce117a9e2c28c4ed2b1
2018-07-27 12:02:09 -07:00
Zhaojun Zhang 6b5343019c Remove clang compiler warnings for Android: -Wno-unused-parameter
Summary: att

Reviewed By: gkmhub

Differential Revision: D8972835

fbshipit-source-id: c8b893eefec6ccb5d8506c959bcf5c3f43701e81
2018-07-27 11:03:32 -07:00
Build Service fd30cf8308 translation auto-update for i18n/instagram-directapp.config.json on master
fbshipit-source-id: 6ea5ace7986919af565061e24f923efa1221ad17
2018-07-26 21:32:51 -07:00