Commit Graph

2793 Commits

Author SHA1 Message Date
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
Build Service a414a3b47d translation auto-update for i18n/fb4a.config.json on master
fbshipit-source-id: 8ab20fd38a37a5ba7f183e1664356e469dca55ad
2018-07-26 21:32:50 -07:00
Build Service 2dc53b0285 translation auto-update for i18n/expresswifi.config.json on master
fbshipit-source-id: ac1a06371a5b0309df0cb0d2485e3a192c8852e1
2018-07-26 21:32:50 -07:00
Build Service f68f1adcfd translation auto-update for i18n/creatorapp.config.json on master
fbshipit-source-id: 05c5d8510fa4ba69bd31eb8ebf9fd00c62350958
2018-07-26 21:32:50 -07:00
Build Service df10d0c4a5 translation auto-update for i18n/analyticsapp.config.json on master
fbshipit-source-id: ae87f5a5b499b5c6990ad2e9e2e8ca634cc2f8ca
2018-07-26 21:32:50 -07:00
Build Service 876d82c77b translation auto-update for i18n/adsmanager.config.json on master
fbshipit-source-id: 594329624d7db939ec5bde5c6e878dac9834fff6
2018-07-26 21:32:50 -07:00
Ziqi Chen 48b3d1322b Made strings in the uimanager resource folder non translatable
Summary:
In D8884991, I added a strings.xml file to react-native-github UI Manager resources.
Because this gets deployed to open source, and not all apps have the same Locale support that Facebook has, we temporarily don't want these strings to be translated.

I added `translatable = false` to the strings in this diff.

Reviewed By: fkgozali

Differential Revision: D9018766

fbshipit-source-id: 04d06478d0ac665fa02387e6df035c31522fdea6
2018-07-26 16:01:28 -07:00
Build Service 52a55fd8d1 translation auto-update for i18n/fb4a.config.json on master
fbshipit-source-id: 3cedbf3b0adee97cc3c33c9c3de88ea4dcf94548
2018-07-26 06:07:09 -07:00
Build Service 4fe5acc570 translation auto-update for i18n/expresswifi.config.json on master
fbshipit-source-id: a22833a1a3eeab52e41e136fe16ed2f4a98d05cb
2018-07-26 06:07:08 -07:00
Build Service 00b4c7da09 translation auto-update for i18n/creatorapp.config.json on master
fbshipit-source-id: a6651b67b5e82543fa846bfddb4553a1202fbf2b
2018-07-26 06:07:07 -07:00
Build Service da5c202fdc translation auto-update for i18n/adsmanager.config.json on master
fbshipit-source-id: 271e127b935afb22acdec01b5477ed6f30910ec0
2018-07-26 06:07:07 -07:00
Build Service 2472c8e392 translation auto-update for i18n/fb4a.config.json on master
fbshipit-source-id: a0029007ee29dc6281d75aa2db5d93119b027709
2018-07-25 21:19:55 -07:00
Build Service 581d87c498 translation auto-update for i18n/creatorapp.config.json on master
fbshipit-source-id: f1b00452ca258faad0a8e26c1b8c6db8c7e99bee
2018-07-25 21:19:55 -07:00
Build Service 50b5be9e16 translation auto-update for i18n/adsmanager.config.json on master
fbshipit-source-id: 46d36267672d931519a6ffca90a1953d643c63da
2018-07-25 21:19:55 -07:00
Build Service 12e15e4fdf translation auto-update for i18n/adsmanager.config.json on master
fbshipit-source-id: 898dfa57c675ca4e1bbbb89046c124c4efcba576
2018-07-25 11:19:49 -07:00
Build Service c3d31cd1de translation auto-update for i18n/instagram-directapp.config.json on master
fbshipit-source-id: 8364dc804cfcc22e765c57ace66150a3123261a0
2018-07-25 02:02:42 -07:00
Build Service 16b169eb7a translation auto-update for i18n/fb4a.config.json on master
fbshipit-source-id: 0253d535046458f83e7df40d28cbf1d47a7b6c6d
2018-07-25 02:02:42 -07:00
Build Service afa58a2f44 translation auto-update for i18n/expresswifi.config.json on master
fbshipit-source-id: 2250f8f41db0be084e9fd136d033a13d65dda1b3
2018-07-25 02:02:42 -07:00
Build Service 924f49bcef translation auto-update for i18n/creatorapp.config.json on master
fbshipit-source-id: b588c750185c4b20b2cdacdc702285b1f2f06665
2018-07-25 02:02:42 -07:00
Build Service c8c2fece88 translation auto-update for i18n/analyticsapp.config.json on master
fbshipit-source-id: 46ce06cbe9e11893c7fdba4b5a33146acbda0818
2018-07-25 02:02:42 -07:00
Build Service 44734a28a1 translation auto-update for i18n/adsmanager.config.json on master
fbshipit-source-id: 2ca74c012a56fe460ae0ffab898949e7e98da334
2018-07-25 02:02:42 -07:00
Ziqi Chen 9f01e4ccff Added logic to only override role description that is said on TalkBack if it's in english.
Summary:
Context:
On Android, I am currently overriding the role description for TalkBack on certain Roles. Currently, these are done only in English.
I needed to add a checker that only overrides these role descriptions if the language of the phone is set

Changes:
* Added a language checker before I call setRoleDescription
* Put the strings into variables.

Note:
This is done to prioritize a codemod for accessibilityRole. Eventually, we hope to add support for other languages on these roles.

Reviewed By: blavalla

Differential Revision: D8884991

fbshipit-source-id: 3182eb5856ea57939fb25b17522d4b79ef2078e3
2018-07-24 16:47:31 -07:00
Simon Jensen 17485e8ed4 Fix conversion from double to int16_t in JSC bindings
Summary:
Converting from double to int16_t is undefined behavior if the value
doesn't fit in int16_t.

Reviewed By: tmikov

Differential Revision: D8925246

fbshipit-source-id: 4cf57631686a4ce05546f8d30a46e3f9def3aee2
2018-07-24 12:03:30 -07:00
Bhavik Patel 1a6666a116 Check if config contains a key before fetching. Default to 0 (#19808)
Summary:
Potential Fix to #19793

modified the code and tried to recreate the bug and was unable to. The red screen never popped up and nothing else seemed to be affected in a negative way.

[ANDROID] [BUGFIX] [FrameBasedAnimationDriver.java] - Safely unwrapping ReadableMap by defaulting to 0 if key not present.
Pull Request resolved: https://github.com/facebook/react-native/pull/19808

Differential Revision: D8960388

Pulled By: hramos

fbshipit-source-id: 400cc0467e041dfcf2d6b1ec0b61d716c2de159f
2018-07-23 17:02:51 -07:00
Dulmandakh ccdd450b12 bump NDK toolchain to 4.9 (#19945)
Summary:
This PR will bump NDK_TOOLCHAIN_VERSION to 4.9 or use GCC 4.9 to build C++ code. Once merged, we can bump folly to a newer version, which requires GCC 4.9.
Pull Request resolved: https://github.com/facebook/react-native/pull/19945

Reviewed By: fkgozali

Differential Revision: D8943282

Pulled By: hramos

fbshipit-source-id: d239ca67a08788b12e115a9d78443b13a10403f6
2018-07-23 13:47:30 -07:00
Ram N b938cd524a Removed dependency on ReactInstancePackage
Reviewed By: achen1

Differential Revision: D8926248

fbshipit-source-id: 8ab7f3f0cd7bdecc9b0d2cd560ed5da89075d3ba
2018-07-23 10:17:09 -07:00
Vishwesh Jainkuniya 84022321c4 textInput: Fix placeholder is not completely visible on Android. (#20337)
Summary:
On Android, placeholder of TextInput is not completely visible.
TextInput had some default fixed width. On iOS it is perfectly
visible.

This commit makes it consistent on both the platforms.

Before:
https://user-images.githubusercontent.com/39303760/43045649-54cb45e8-8dda-11e8-9935-059ad8ee9def.png

After:
https://user-images.githubusercontent.com/39303760/43045650-54fb9428-8dda-11e8-88b8-176839d6c0a7.png

Testing code:
a0a6fbb491/App.js

Clone code from a0a6fbb491/App.js and test on Android with and without this commit.

Before:
https://user-images.githubusercontent.com/39303760/43045649-54cb45e8-8dda-11e8-9935-059ad8ee9def.png

After:
https://user-images.githubusercontent.com/39303760/43045650-54fb9428-8dda-11e8-88b8-176839d6c0a7.png

 [ANDROID] [BUGFIX] [TextInput] - Fix placeholder is not completely visible on Android.
Pull Request resolved: https://github.com/facebook/react-native/pull/20337

Differential Revision: D8950051

Pulled By: mdvacca

fbshipit-source-id: a583a48c90ecd55d8dd8c6f4eef829608b2a6079
2018-07-22 23:16:29 -07:00
Jiaqi Wu 9c71952f20 Fix overflow issue in root view
Summary:
Set clipChildren to false by default in ReactRootView.java so that Overflow: visible/hidden will work for the root view.

Moved sDefaultOverflowHidden from ReactViewGroup.java to ViewProps.java so that it can be used in both ReactViewGroup.java and ReactRootView.java.

Reviewed By: mdvacca

Differential Revision: D8727140

fbshipit-source-id: b593bed63e479cdbd22e4a025b936e6aeb28fc8c
2018-07-19 17:46:53 -07:00
Jiaqi Wu d5465a9a0a Fix ReactHorizontalScrollView overflow issue
Summary: Fix ReactHorizontalScrollView so that its children won't overflow. (Task: https://our.intern.facebook.com/intern/tasks/?t=31128239)

Reviewed By: achen1

Differential Revision: D8923947

fbshipit-source-id: 56c36b25c29a87a306d92544273603d0d086edc0
2018-07-19 17:17:25 -07:00
Jiaqi Wu 86f24ccf71 Fix placeholder clipping issue
Summary:
Problem: The first ReactTextInputShadowNode layout  calculation didn't consider the placeholder. When the layout with placeholder was actually being measured, its height was constraint by the previously calculated height, causing long placeholder content to be clipped.
Fix: Access the placeholder property in ReactTextInputShadowNode, set the dummyEditText's hint with placeholder before ReactTextInputShadowNode's first measurement.

Reviewed By: mdvacca

Differential Revision: D8903108

fbshipit-source-id: 8f3e518d0395ac875807f9ea989a0b5bbe4b2a26
2018-07-19 17:17:24 -07:00
Jiaqi Wu de573277bf Fix Horizontal ScrollView's scroll position during layout changes
Summary: Fix the calculation of offsetX in onLayout (ReactHorizontalScrollContainerView.java) that re-positions the updated layout. A private instance variable (oldWidth) is added in order to track the width difference between consecutive updates. (Issue report: https://github.com/facebook/react-native/issues/19979)

Reviewed By: mdvacca

Differential Revision: D8772780

fbshipit-source-id: 969dcead550f4a3d24d06416b63d960492b7a124
2018-07-19 17:02:38 -07:00
Ziqi Chen 3bedc78a35 Changed prop name "currentViewStates" to "accessibilityStates" in Android (2/3)
Summary:
Context:
After discussing with @[1038750002:yungsters], `currentViewStates` is a very ambiguous name for a prop, especially because there are only two possible values. From a developer's perspective, it makes more sense to just call them `accessibilityStates` because the main use for them is to add states to Talkback and Voiceover.
Defense for changing name in Android: The actual implementation of what we're changing under the hood in Native Code is abstracted away from developers using React Native, so as long as behavior is as they would expect, it makes more sense to change the name into a clear one regardless of how it is implemented.

Changes:
changed the Prop name from `currentViewStates` to `accessibilityStates` in the BaseViewManager file where the view property is being exposed.

Reviewed By: PeteTheHeat

Differential Revision: D8896389

fbshipit-source-id: 35dcd9239fae016b790e528947994681684bd654
2018-07-19 14:13:00 -07:00
Mats Byrkeland be715ec705 Make AccessibilityInfo.setAccessibilityFocus cross platform (#20229)
Summary:
Currently, `AccessibilityInfo.setAccessibilityFocus` is only available on iOS. The same behaviour can be achieved on Android by dispatching the proper accessibility event. I implemented the same function for Android, to make life slightly more convenient for the developer.

Today, developers must write something like this:
```
if (Platform.OS === 'ios') {
     AccessibilityInfo.setAccessibilityFocus(reactTag)
} else {
     UIManager.sendAccessibilityEvent(reactTag, 8)
}
```

With this change, the following is enough for both Android and iOS:
```
AccessibilityInfo.setAccessibilityFocus(reactTag)
```
Pull Request resolved: https://github.com/facebook/react-native/pull/20229

Differential Revision: D8874107

Pulled By: mdvacca

fbshipit-source-id: a6ffd7bb89ce56d6d65b06419633a71dcf3d0733
2018-07-18 17:24:23 -07:00
Himabindu Gadupudi 7ff7572e5c Fix Android RN server snapshot tests
Summary: Trying to see what it takes to get server snapshot tests working on android. This will be landed after fixing few things.

Reviewed By: achen1

Differential Revision: D8237948

fbshipit-source-id: 926555ba752171dac4e5814f5c8e5c2c173a82c7
2018-07-18 17:03:04 -07:00
Ziqi Chen c1d0ccde0f added android functionality for currentViewStates
Summary:
Added native android support for the prop accessibilityStates.

If 'selected' is passed in, it calls view.setSelected(true)
If 'disabled' is passed in, it calls view.setEnabled(false)

If both are passed in, both are set on the view.

Reviewed By: blavalla

Differential Revision: D8838407

fbshipit-source-id: a942dabcdc5d9e35f0316465e97317739a8b4b25
2018-07-17 16:06:21 -07:00
Ben Blackburne f5f27b3687 Revert D8786185: [fabric][android] Create CXX Binding
Differential Revision:
D8786185

Original commit changeset: d04208f07813

fbshipit-source-id: 1fc1648146ea9784bb364c4e56e8664bb8bb655f
2018-07-17 03:31:43 -07:00
Ben Blackburne bf22d904fe Revert D8794819: [fabric][android] Initialize FabricXX C++ code and register rootview
Differential Revision:
D8794819

Original commit changeset: b4d1d0958a3f

fbshipit-source-id: a984be9a31601644fb2d20a831f4e27075f24f7f
2018-07-17 03:31:42 -07:00
David Vacca 6c8b68183d 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: D8794819

fbshipit-source-id: b4d1d0958a3f8e01d4a51be957d9a2e2f442489e
2018-07-17 01:46:45 -07:00
David Vacca e155e78451 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: D8786185

fbshipit-source-id: d04208f0781387424fc0ddf7a6e5d46a6bd61f66
2018-07-17 01:46:45 -07:00
Robert Hönig a87b9db3dc Fix wrong time unit in dev server OKHttp client. (#19817)
Summary:
The keep-alive-duration for the connection pool for mOnChangePollingClient
is a number in milliseconds, but was mistakenly given in minutes. This mistake
was introduced in 6bbaff2944.

I discovered this by chance while lurking around in the codebase.
Pull Request resolved: https://github.com/facebook/react-native/pull/19817

Differential Revision: D8873138

Pulled By: hramos

fbshipit-source-id: c81c1952721449442f18a0c2373f8b2780403749
2018-07-16 22:34:22 -07:00
Ziqi Chen 5741f77156 added image button role on android
Summary:
Because we're now separating accessibilityTraits into accessibilityRole and accessibilityState, we're going to only allow one role to be set, and allow on preset combinations of roles that make sense.

This adds android functionality for an added role that is image button.

Reviewed By: blavalla

Differential Revision: D8846987

fbshipit-source-id: 9fe36828f63b05bd2c9cf9680204b1995d678342
2018-07-16 19:17:27 -07:00
Nurzhan Bakibayev ecd8802c1f Add @DoNotStrip to RemoteConnection methods
Summary: Add DoNotStrip to RemoteConnection methods

Reviewed By: alexeylang

Differential Revision: D8861729

fbshipit-source-id: d2b339f49dd25379dec6620d367786a9df02d28b
2018-07-16 12:47:16 -07:00
Andrew Chen (Eng) 123b3e1a8e Fix JSLocaleTest
Summary: becausereasons

Reviewed By: mdvacca

Differential Revision: D8838902

fbshipit-source-id: 0c6ca5ccde0439cacfa02771b2d99f26aa86f573
2018-07-16 11:17:50 -07:00
Taras Tsugrii 662c5bfd26 Skylarkify ReactNative build defs.
Summary: https://buckbuild.com/concept/skylark.html

Reviewed By: mzlee

Differential Revision: D8823004

fbshipit-source-id: 164be349782862bf83f5bdf2c869bf10713d5dfe
2018-07-14 17:31:19 -07:00
Ziqi Chen e739143809 added in the three roles: search, adjustable, link that require localization
Summary:
Added the android functionality for those three roles: search, adjustable, and link.
Until React Native internal framework ports internationalization and localization of strings, I'll handle localization by allowing an extra prop to be passed in that can override talkback's description in another language if needed.

Reviewed By: blavalla

Differential Revision: D8807692

fbshipit-source-id: b51877d187cb6cb663d65d6b4d072e6dc52a2d03
2018-07-12 23:47:12 -07:00
Yuanda Tang 8ee60e9b0d Cleanup clang compiler warnings
Summary:
Cleanup clang compiler warnings.
The last version delete some variables that still used in code.
Fix the problem and try to launch again.

Reviewed By: hershi

Differential Revision: D8704442

fbshipit-source-id: 8bd37fc9f2b27104fe15c4c8b8323e2bfd8c1060
2018-07-12 13:22:22 -07:00
Ziqi Chen f39d0923c7 removed tabbar for iOS 9 compatibility issues
Summary: Removed Accessibility Trait TabBar for iOS compatibility Issues, since tabbar is only available on iOS 10+

Reviewed By: PeteTheHeat

Differential Revision: D8822469

fbshipit-source-id: 34bf00eb930f631a5a4effa0a4159da07c1573f6
2018-07-12 12:32:03 -07:00