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
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
Summary: This diff enables the onPress event for TextViews that render RawText
Reviewed By: shergin
Differential Revision: D10222183
fbshipit-source-id: 4b6a6ad548286453f7dd3a14a5e4ee453a55b923
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
Summary: Adding a test for the newly added InterpolatorType.fromString()
Reviewed By: axe-fb
Differential Revision: D10203814
fbshipit-source-id: f3c70db1a5754c79b1bdd881d266bec110934494
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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


Every characters has consistent "weight" and looks nice:


<!--
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
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
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
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
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