Commit Graph

5021 Commits

Author SHA1 Message Date
Andrei Shikov 4090195122 Ensure elevated views are not changing drawing order
Summary:
Uses `enableZ` trick to ensure that Skia doesn't try to reorder the views based on elevation. Unfortunately, it only helps for some cases, but the proper fix would require reimplementing `ViewGroup` completely to remove its internal logic of reordering based on Z coordinate.

Changelog: [Android][Fixed] Ensure elevated views are behind sticky header in FlatList

Reviewed By: cortinico

Differential Revision: D30700566

fbshipit-source-id: d2c59b22332922c610f4f2d415df34e81f5a33c5
2021-09-24 10:05:12 -07:00
Amy Nichol 4e8da9b28f Back out "Fix - ReconnectingWebSocket race condition mClosed"
Summary:
Changelog:[Internal]
Original commit changeset: 48793bd3bea9

Reviewed By: ShikaSD

Differential Revision: D31170947

fbshipit-source-id: cb460e3261fdc2a0df6e3a4597c61bd879ecf38f
2021-09-24 09:44:32 -07:00
Samuel Susla 6d367d70f2 Re-introduce AsyncEventBeatV2 experiment
Summary: changelog: internal

Reviewed By: javache

Differential Revision: D31056006

fbshipit-source-id: 423c81a0fde77b0e2e4b3ddcd6e23c0552b16b3b
2021-09-24 07:16:23 -07:00
Pieter De Baets 133705b130 Re-implement hover state calculation to support nested Text nodes
Summary:
Changelog: [Internal]

Add a path calculation method to TouchTargetHelper to avoid relying on the view hierarchy ourselves and better support virtual touch targets.

Reviewed By: JoshuaGross

Differential Revision: D30993410

fbshipit-source-id: 17577c815413ab0f03bcb6a2140ea1d4c9fd694a
2021-09-24 04:11:49 -07:00
Pieter De Baets 67b62adf4b Reduce LockFreeEventDispatcherImpl logspam
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D31116209

fbshipit-source-id: 90dacad32f20148c5956815cff54e2077b7b83a3
2021-09-22 15:45:40 -07:00
Kudo Chien 369b28ce01 Support custom DevSupportManager (#31841)
Summary:
to open possibilities for some DX enhancement, the pr introduces `DevSupportManagerFactory` customization. applications could implement a different DevSupportManager in ReactNativeHost.

## Changelog

[Internal] [Added] - Support custom DevSupportManager

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

Test Plan: this pr just introduces some new interfaces and should not break existing functionalities.

Reviewed By: RSNara

Differential Revision: D30878134

Pulled By: yungsters

fbshipit-source-id: ccdf798caa322b07a876da8312b97002da057388
2021-09-22 10:33:14 -07:00
Pieter De Baets f29ad54534 Pass through coalesce info to Fabric eventEmitter
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D30767649

fbshipit-source-id: d5e730850408afd23a4d4964ef7dd3b17fa44a19
2021-09-22 06:07:35 -07:00
Amy Nichol 94bcfb71a2 Fix - ReconnectingWebSocket race condition mClosed
Summary:
Changelog : [Internal]
Use synchronized blocks to avoid race conditions surrounding mClosed.

Reviewed By: makovkastar

Differential Revision: D31019994

fbshipit-source-id: 48793bd3bea98224d8df344bc4fc8771b517cf72
2021-09-22 01:11:34 -07:00
David Vacca f8e4a783ac Avoid calling getEventData() method twice
Summary:
EZ diff that avoids calling getEventData() method twice

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D31076778

fbshipit-source-id: 63c2a469e8e684202dbdbbf12166487328685976
2021-09-21 11:35:53 -07:00
David Vacca fbb802ca63 Fix typo in Event class
Summary:
Just a fix of a typo

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D31076782

fbshipit-source-id: 192de92ba080a565acd67e038b370917ea9fcddc
2021-09-21 11:35:53 -07:00
Samuel Susla 9a308697e2 Do not retain RuntimeScheduler beyond Runtime's lifetime
Summary:
changelog: [internal]

Retaining RuntimeScheduler beyond Runtime's lifetime can lead to crashes.

Reviewed By: ShikaSD

Differential Revision: D31084763

fbshipit-source-id: df6dd6fcf5aa224b9465ed7df1e64ad0ca964510
2021-09-21 10:24:12 -07:00
Moti Zilberman a7ff7229f0 Centralize HERMES_BYTECODE_VERSION setting
Summary: Changelog: [Internal]

Reviewed By: javache

Differential Revision: D31081032

fbshipit-source-id: e0e18e424a192f42daed6dc802155022b41b0067
2021-09-21 10:24:12 -07:00
Pieter De Baets 6025611bd0 Use real propsParserContext in LayoutAnimation
Summary: Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D31053819

fbshipit-source-id: 8ec21012500f3bfc7e8aea018b5ca72323da2d9e
2021-09-21 04:24:28 -07:00
Lulu Wu f4fdf4b55e Fix currentActivity being null when launching Redbox
Summary:
Try to reuse currentActivity when the new context from "mReactInstanceDevHelper.getCurrentActivity()" is null to fix  "Unable to launch redbox because react activity is not available..."

Changelog:
[Android][Fixed] - Fix currentActivity being null when launching Redbox

Reviewed By: philIip

Differential Revision: D30942434

fbshipit-source-id: faf03390adc545376f3cec223eac5a16bf8233ea
2021-09-20 14:27:26 -07:00
Amy Nichol dd10134bdc Option to use fallback bundle in dev mode
Summary: Changelog: [Android] [Added] - Adds option use fallback bundle instead of cached bundle when the packager isn't running in ReactInstanceManager

Reviewed By: ShikaSD

Differential Revision: D30899295

fbshipit-source-id: 7ea68fb13029bde9c3170cacee92b3c8a0a7367d
2021-09-17 07:25:54 -07:00
Amy Nichol 9f55bda50b Only create one OkHttpClient per ReconnectingWebSocket
Summary:
Changelog:
[Internal]- Share the OkHttpClient within the ReconnectingWebSocket

Reviewed By: makovkastar

Differential Revision: D30763398

fbshipit-source-id: cda931ef83de48075949917b6bd8bc92b5fc2ae8
2021-09-17 07:25:54 -07:00
Nicola Corti 85031d0166 Rename extension to just ReactExtension
Summary:
I'm cleaning up the extension to be just ReactExtension and not ReactAppExtension.
Similarly the name of the extension will be just `react` and not `reactApp`.

Changelog:
[Internal] [Changed] - Rename extension to just ReactExtension

Reviewed By: ShikaSD

Differential Revision: D30964793

fbshipit-source-id: 8a4207825d424e133e51495c34c21284c50363ae
2021-09-16 05:38:51 -07:00
Nicola Corti 022f188750 Merge CodegenPluginExtension inside ReactAppExtension
Summary:
This Diff is merging over all the properties from `CodegenPluginExtension` to
`ReactAppExtension`. Some of the properties were duplicate and generally having two
extensions is creating a lot of confusion for the users (e.g. don't know where to place a
specific property).

Therefore I'm merging the two to have only one. I've also updated the property to use the
Gradle Lazy Configuration API.

Changelog:
[Android] [Changed] - Gradle: Merge CodegenPluginExtension inside ReactAppExtension

Reviewed By: ShikaSD

Differential Revision: D30961343

fbshipit-source-id: 66be3157efef356392c0701aaef2283d058d3161
2021-09-15 09:23:23 -07:00
Nicola Corti c3ff336326 Merge the two Gradle Plugins (#32177)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32177

This diff merges the `react-native-gradle-plugin` and the `react-codegen/android` into a single plugin.
This will allow us to iterate faster on a single plugin, will create less confusion for our users (`react` vs `reactApp`)
and will help us avoid race conditions when the two plugins are applied together (as we will control the whole lifecycle of it).

Changelog:
[Internal] [Changed] - Merged the two Gradle Plugins

allow-large-files

Reviewed By: ShikaSD

Differential Revision: D30765147

fbshipit-source-id: fcb02a181c7d900daa514107c637d0ee0225976c
2021-09-15 03:21:23 -07:00
Krzysztof Borowy 04fe3ed80d Fix: Set "new task flag" for intent method (#29000)
Summary:
Addresses https://github.com/facebook/react-native/issues/28934

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - When sending OS intents, always set "FLAG_ACTIVITY_NEW_TASK" flag (required by OS).

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

Test Plan:
1. Open RNTester on Android
2. Go to Linking section
3. Try opening "POWER_USAGE_SUMMARY" intent
4. App should open settings, instead of crashing

Reviewed By: cortinico

Differential Revision: D30876645

Pulled By: lunaleaps

fbshipit-source-id: e427bfeadf9fb1ae38bf05bfeafd88e6776d71de
2021-09-13 12:56:19 -07:00
Ramanpreet Nara 657c48c21d Rename JavaScriptTimerManager to JavaScriptTimerExecutor
Summary:
This JavaScriptTimerManager interface calls into JavaScript to execute timers. For that reason, I think JavaScriptTimerExecutor is a better name for the interface.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D30851912

fbshipit-source-id: de282068d18693fd67331586e66847105ea16531
2021-09-10 01:20:59 -07:00
Rodolfo d40cb0e1b0 Fix missing webview provider crash on Android (#32165)
Summary:
I applied the changes requested in this PR: https://github.com/facebook/react-native/pull/29089

We upgraded to RN 0.62.2 on our latest release and started to see again the "Failed to load WebView provider: No WebView installed" (see below for Crashlytics screenshot)

![image](https://user-images.githubusercontent.com/870365/131935283-033fbd44-5a3b-49b0-bd25-3d6733f22040.png)

This crash had been fixed by https://github.com/facebook/react-native/pull/24533 but https://github.com/facebook/react-native/pull/26189 (added in 0.62) reverted the fix

Indeed the exception raised in Crashlytics is actually a `AndroidRuntimeException` and `MissingWebViewPackageException` is only part of the message.

For instance, in the screenshot above, the exception message is `android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed`

Now these crashes are quite tricky to reproduce, so to be on the safe side, I'm filtering out all exceptions containing `WebView` as suggested by thorbenprimke on the original fix.

If my reasoning is correct, it should fix siddhantsoni 's issue as well, since `WebView` is included in `MissingWebViewPackageException`
But following that reasoning, I am not sure https://github.com/facebook/react-native/pull/26189 fixed siddhantsoni 's issue, so siddhantsoni if you could check that this PR also fixes your issue, that would be great!

## Changelog

[Android] [Fixed] - Fix missing WebView provider crash in ForwardingCookieHandler

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

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

Test Plan:
I created a version of react native with this patch applied

```
"react-native": "almouro/react-native#release/062-2-fix-missing-webview-provider"
```

Before the fix ~0.1% of our users were impacted on Android, no new crashes have occurred after the update.

This is putting back what was already in place and working for us, but making the check wider to catch more errors.

Reviewed By: lunaleaps

Differential Revision: D30847404

Pulled By: sota000

fbshipit-source-id: fe3b5fa2c9ebde5bedd17a9d6394a52ccdbdf0d0
2021-09-09 15:24:03 -07:00
Aaron Grider b7c023a8c1 Use Updated Android Locale API (#30701)
Summary:
This change migrates fetching locale information from the deprecated Android locale api to the new locale api on sdk version 30+. The old api was deprecated some time ago and should not be used.

https://developer.android.com/reference/android/content/res/Configuration#locale

## Changelog

[Android] [Changed] - Use new Locale API on Android 11 (API 30)+

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

Test Plan:
```js
if (Platform.OS === 'android') {
  locale = NativeModules.I18nManager.localeIdentifier; // returns ex. 'EN_us'
}
```

Reviewed By: mdvacca

Differential Revision: D30821396

Pulled By: lunaleaps

fbshipit-source-id: 31622cd9c71c6057ff98ab5245898bc687b5ac60
2021-09-08 16:39:17 -07:00
Samuel Susla 8c2571171e Add feature flag to control to turn on yielding
Summary:
Changelog: [internal]

Add feature flag to turn yielding on/off on Android.

Reviewed By: ShikaSD

Differential Revision: D30487129

fbshipit-source-id: 5d9f60055285cbe7d85493ecaa1dfa17225da9e0
2021-09-06 08:47:51 -07:00
Samuel Susla f679891bd6 Pass RuntimeScheduler to Binding
Summary: changelog: [internal]

Reviewed By: ShikaSD

Differential Revision: D30487037

fbshipit-source-id: 3956606891a313577fd013ae5c2a9f1f90ac5903
2021-09-06 05:42:30 -07:00
Xuan Huang a8ac5ea326 Revert the Android specific max heap size GCConfig
Summary:
Changelog:
[Category][Internal]

This diff reverts the [Androids-specific heap size overrides](github.com/facebook/react-native/commit/63d20d3b1ef35cb4398d63d62f631f7f5d2935c7#diff-4c59ddca85e294a90a0e1bd15ed323ff4e130911d9642680dde44aacbcd7d32c) after
[Hermes has changed its default max heap size to 3GiB](https://github.com/facebook/hermes/commit/5f2b47d0be6281fd2605d24efc0b43af42b4033d).
You can read about more context there.

Reviewed By: yungsters

Differential Revision: D30726067

fbshipit-source-id: 1bcc93fdf4da817f3b3d60bd09c6a5a64166eb7e
2021-09-02 17:04:15 -07:00
Tim Yung 455433f481 Revert D30675510: Remove custom Hermes config for Android
Differential Revision:
D30675510 (https://github.com/facebook/react-native/commit/a40f973f58609ca717fac63bc501d5cf93b748ad)

Original commit changeset: 5eef056893b7

fbshipit-source-id: 25db31c4fbe938d92bba8b0bfe6523bced1524f0
2021-09-02 13:20:04 -07:00
Ashoat Tevosyan a40f973f58 Remove custom Hermes config for Android (#31900)
Summary:
Right now, `react-native` on Android passes in an explicit Hermes config when initializes Hermes. The upcoming version of Hermes shipping with React Native 0.66 will handle this default config itself, so there's no need to override it from Android anymore.

Changelog:
[Android][Changed] - Hermes initialization will no longer need an explicit configuration.

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

Test Plan: I compiled and ran a React Native app using the Android build, making sure to build `ReactAndroid` from source. I confirmed that the config was actually being applied by testing how much memory an application could eat before being killed.

Reviewed By: sshic

Differential Revision: D30675510

Pulled By: yungsters

fbshipit-source-id: 5eef056893b72ddd433ee808eb08d0eb56f22f72
2021-09-02 12:30:48 -07:00
fabriziobertoglio1987 c360b1d92b Fix non selectable Text in FlatList (#28952)
Summary:
This issue fixes https://github.com/facebook/react-native/issues/26264 fixes https://github.com/facebook/react-native/issues/27107
Text is not selectable inside a FlatList on Android. The solution is to invalidate the ReactTextView after a change of the selectable prop. If the view is visible, onDraw(android.graphics.Canvas) will be called at some point in the future and make the Text selectable.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Fix non selectable Text in FlatList

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

Test Plan:
**<details><summary>CLICK TO OPEN TESTS RESULTS</summary>**
<p>

The issue was demonstrated in the following [snack](https://snack.expo.io/fabrizio.bertoglio/selectable-bug-in-flatlist) (more info in issue https://github.com/facebook/react-native/issues/26264).

The solution is:

1) Calling `invalidate()` from [setSelectableText][1] after changing the `selectable` prop and `mSelectableText` value. [`invalidate()`](https://developer.android.com/reference/android/view/View#invalidate()) triggers the `onDraw` callback.

[1]: https://github.com/fabriziobertoglio1987/react-native/blob/8027524947cafd5cbdc492e4ef9c92b346fe23fc/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java#L427-L430

2) calling `setTextIsSelectable(mSelectableText);` from the [`onDraw`][2] callback

[2]: https://github.com/fabriziobertoglio1987/react-native/blob/8027524947cafd5cbdc492e4ef9c92b346fe23fc/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java#L456-L460

The example below is availabe in RNTester FlatList example. Two options (`onPressDisabled` and `textSelectable`) have been added to test the functionality inside a FlatList.

<p align="center">
<img src="https://user-images.githubusercontent.com/24992535/82672536-c2e74d80-9c40-11ea-8fd8-156bfacfac8a.gif" width="200" height="" />
</p>

</p>
</details>

Reviewed By: ShikaSD

Differential Revision: D30000870

Pulled By: lunaleaps

fbshipit-source-id: 4851a294960df0af057d006793aa9ba97c51e3f9
2021-09-01 15:28:30 -07:00
Samuel Susla e2e39808d3 Remove RuntimeSchedulerManager
Summary:
Changelog: [internal]

Remove RuntimeSchedulerManager on Android in favor of different way to initialise RuntimeScheduler.

Reviewed By: ShikaSD

Differential Revision: D30486975

fbshipit-source-id: 9fe38de12be452bd9d2c92bb54cf5933ce7555b5
2021-09-01 11:26:27 -07:00
Andrei Shikov 8b4f5073a1 Log created views with mounting errors
Summary:
Displays views from the surface mounting manager after we hit a crash during mounting.
This change should help with debugging mounting crashes (e.g. when view is added before removal)

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D30681339

fbshipit-source-id: f83cecaf8e418a2fa5aa0713513c51bb1be77013
2021-09-01 07:31:18 -07:00
Nicola Corti 85249cafe8 Update project to build on Gradle 7.0.2 (#32073)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32073

This Diff bumps the version of Gradle used to build the project to
7.0.2. Ideally we could bump to 7.2.x directly, but I'll do one minor version
at a time to exclude potential build problems.

This diff is addressing all the extra build warnings that got raised by the new version.

Changelog:
[Android][Changed] - Bumped Gradle project version to 7.0.2

Reviewed By: ShikaSD

Differential Revision: D30486612

fbshipit-source-id: 70e0f7d18e547013ca7b1d12f8dd64a633df5870
2021-08-31 13:27:27 -07:00
Nicola Corti 24a9ef7384 Suppressing bad file descriptor errors on native builds
Summary:
When running native builds, we experience a lot of
bad file descriptor warnings. This diff is suppressing the issue on local builds (on Mac).

Changelog:
[Internal] [Changed] - Suppressed bad file descriptor on native builds

Reviewed By: ShikaSD

Differential Revision: D30487098

fbshipit-source-id: 8199fb8f2f18d19543d2861f1f2f852fff6ae73b
2021-08-31 10:26:42 -07:00
Neil Dhar 1bc885b8b8 Make JSI a dynamic library
Summary:
Ship libjsi as a standalone dynamic library. This prevents problems
with exception handling caused by duplicate typeinfo across multiple
shared libs, and reduces bundle size by removing duplicate copies of
JSI.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D30599215

fbshipit-source-id: abad1398342a5328daa825f3f684e0067cad7a96
2021-08-27 17:16:49 -07:00
Genki Kondo f3e8ea9c29 Use hyphenationFrequency for text measurement
Summary:
Implements the calculation of measurement and position of Text attachments in Android

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D30586616

fbshipit-source-id: e9ecc002f03477e3465d746855e1dff2e5f0b321
2021-08-27 09:04:01 -07:00
Valentin Shergin 1acf334614 Fixed alignItems: baseline for <Text> elements on Android (#31575)
Summary:
This fixes https://github.com/facebook/react-native/issues/20666 and https://github.com/facebook/react-native/issues/21918.

This is pretty much the same as 51b3529f6c but implemented for Android.
Now <Text> exposes the actual base-line offset value that allows Yoga to position it properly when `alignItems: baseline` is requested.

## Changelog
[Android][Fixed] - Fixed `alignItems: baseline` for <Text> elements on Android

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

Test Plan:
The same test case that we have for iOS.
Before:
<img width="487" alt="Screen Shot 2021-05-22 at 7 03 18 PM" src="https://user-images.githubusercontent.com/22032/119277516-d62b5100-bbe5-11eb-9141-3abe56e1a476.png">

After:
<img width="487" alt="Screen Shot 2021-05-22 at 7 01 51 PM" src="https://user-images.githubusercontent.com/22032/119277518-d75c7e00-bbe5-11eb-9139-4c6b5fcd9157.png">

Reviewed By: JoshuaGross

Differential Revision: D28631468

Pulled By: yungsters

fbshipit-source-id: 7c259e469d19d8344298319f066b8437dfdedad0
2021-08-26 21:46:37 -07:00
Genki Kondo a0d30b848a Remove unsupported values for android_hyphenationFrequency
Summary:
hyphenationStrategy must be one of one of Layout#HYPHENATION_FREQUENCY_NONE, Layout#HYPHENATION_FREQUENCY_NORMAL, Layout#HYPHENATION_FREQUENCY_FULL: (https://developer.android.com/reference/android/widget/TextView#setHyphenationFrequency(int))

Thus "high" and "balanced" are not only redundant, but actually don't do what the value indicates - Layout#BREAK_STRATEGY_BALANCED (constant value: 2) and Layout#BREAK_STRATEGY_HIGH_QUALITY (constant value: 1) are only meant to be used for android:breakStrategy

Changelog:
[Android][Changed] - Remove `"high"` and `"balanced"` as values for `android_hyphenationFrequency` on `Text`

Reviewed By: JoshuaGross

Differential Revision: D30531096

fbshipit-source-id: 1a0b6e733bb21ce6b2f104a2025a79c16de3cfea
2021-08-26 10:40:11 -07:00
Sota Ogo d6c879edba Show RedBox for C++ errors
Summary:
This diff is hooking up cxx error with redbox. Before this diff, cxx errors were only shown in log and there was no visible user feedback.

Changelog:
[Android] [Added] - Show Redbox for C++ errors.

Reviewed By: JoshuaGross

Differential Revision: D30421355

fbshipit-source-id: ad473337ba301feb08ba31ee8d82ebaa771ecaeb
2021-08-26 10:06:05 -07:00
Joshua Selbo 369a7ab5d3 Update AndroidX test deps to 1.4.0 (#32084)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32084

Upgrade RN AndroidX test deps after an internal upgrade.

Changelog: [Internal] Update AndroidX test deps after internal upgrade

Reviewed By: sturmen

Differential Revision: D30546422

fbshipit-source-id: 644648c7dcf179e737fb967d996a789cc904a5ca
2021-08-25 14:30:06 -07:00
Andres Riveros Moya 7a770526c6 Remove DatePickerAndroid from react-native-github
Summary:
Changelog:
[JavaScript][Removed] - Remove DatePickerAndroid from React Native

Reviewed By: lunaleaps, yungsters

Differential Revision: D30281952

fbshipit-source-id: 5cd0ad2ad741afeef3e6f8a39635c6baf4b79b38
2021-08-25 13:38:25 -07:00
Joshua Gross 8c4912a42f Fabric should be enabled or disabled app-wide without entrypoint-specific options
Summary:
Add new ReactFeatureFlag to enable or disable Fabric appwide.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D30504714

fbshipit-source-id: f615d4c888a89f5401b0ff8f8305fdfbdf75fba3
2021-08-25 13:09:36 -07:00
fabriziobertoglio1987 ee3e71f536 onKeyPress event not fired with numeric keys (#29046)
Summary:
This issue fixes https://github.com/facebook/react-native/issues/19507 fixes https://github.com/facebook/react-native/issues/30475 onKeyPress event not fired for numeric keyboard
The TextInput onKeyPress event is not fired when pressing numeric keys on Android.

The method sendKeyEvent will dispatchKeyEvent only for:
- ENTER_KEY_VALUE
- KEYCODE_DEL (delete key)

The solution proposed is trigger dispatchKeyEvent for KeyEvents with event.getUnicodeChar() value included between 47 and 58 (numeric keys 0-9)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - onKeyPress event not fired with numeric keys

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

Test Plan:
**<details><summary>CLICK TO OPEN TESTS RESULTS</summary>**
<p>

| **BEFORE** | **AFTER** |
|:-------------------------:|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/83673015-7ce2a000-a5d7-11ea-9c1d-32a5f5605687.gif" width="300" height="" /> | <img src="https://user-images.githubusercontent.com/24992535/83673017-7f44fa00-a5d7-11ea-8d93-edf1f61f7023.gif"  width="300" height="" /> |

</p>
</details>

Reviewed By: hramos, cortinico

Differential Revision: D30427789

Pulled By: sshic

fbshipit-source-id: b4e17ab94daa59fe28de5a5141b0fdd49bab72e3
2021-08-25 04:56:45 -07:00
Joshua Gross 4841e1bae0 Add first-class support to ReactInstanceManager for Activity-less usage
Summary:
I'm not sure if we'll ever need to do more than this (probably!) but I want to have a specific option for Activity-less usage, so
that our logic in ReactInstanceManager and elsewhere is more clear. I want to be able to confidently assert that the Activity is present
and correct, or never present, depending on if this `requireActivity` flag is set; instead of adding else statements that imply "well, the Activity should be here, hope everything is okay" which feels hacky.

Doesn't change much for now, but it's an additional constraint in the RN Android codebase that we need to explicitly embed in code so that
we can point to it, and so that the logic is more clear.

Changelog: [Internal]

Reviewed By: javache, motiz88

Differential Revision: D30504616

fbshipit-source-id: d2abdb7c4765a16113c9517406cdbb8cf42822ff
2021-08-25 02:21:18 -07:00
Valentin Shergin 59021521e7 Fixed dynamic behavior of <Text adjustsFontSizeToFit={true}> on Android (#31538)
Summary:
This PR fixes https://github.com/facebook/react-native/issues/30717, a bug in `<Text adjustsFontSizeToFit={true}>` implementation that prevents it from adjusting text size dynamically on Android.

The way `adjustsFontSizeToFit` was implemented in https://github.com/facebook/react-native/issues/26389 (and the design of ReactTextShadowNode) implies that Yoga will call `onMeasure` on every size change of a `<Text>` component, which is actually not the case (Yoga can cache the results of the measures, call the function multiple times or do not call at all inferring the size from the size constraints). The implementation of `adjustsFontSizeToFit` computes the adjusted string inside the measure function and then eventually passes that to the view layer where it's being rendered.

The proper fix of this issue requires the full redesign of the measure and rendering pipelines and separating them, and that... would be too invasive. And, I believe, this issue is already fixed in Fabric where this part is already designed this way.

Instead, this diff implements a small workaround: if `adjustsFontSizeToFit` is enabled, we manually dirty the Yoga node and mark the shadow node updated to force remeasuring.

## Changelog

[Android] [Fixed] - Fixed dynamic behavior of <Text adjustsFontSizeToFit={true}> on Android

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

Test Plan: https://user-images.githubusercontent.com/22032/118508162-8c79cc80-b6f4-11eb-853f-a1a09f82935f.mov

Reviewed By: mdvacca

Differential Revision: D28631465

Pulled By: yungsters

fbshipit-source-id: 7db1d22e2a5a464c7bf941d1d3df8e3fe8df66a2
2021-08-24 17:58:12 -07:00
Chatura Atapattu 2c2b831716 Apply new buildifier fixes
Summary: Changelog: [Internal]

Reviewed By: zertosh

Differential Revision: D30407205

fbshipit-source-id: 022a02829d59a900764b228afb9856ed1ba2cf8c
2021-08-19 20:01:02 -07:00
Chatura Atapattu 8258f5e271 Remove BUILD FILE SYNTAX from build files
Summary: Changelog: [Internal]

Reviewed By: zertosh

Differential Revision: D30410441

fbshipit-source-id: 62deebb502121f23270bfa18286b155ad161af2d
2021-08-19 15:25:19 -07:00
Nicholas Tinsley abc1ace6ec - Fix broken Circle CI due to missing BUCK rule for androidx:tests (#32052)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32052

Changelog: Update the OSS React Native dependencies to match the internal dependency structure.

Reviewed By: cortinico

Differential Revision: D30397818

fbshipit-source-id: a70e26d764729f6ead9eb6a4d689e32d25243571
2021-08-19 14:21:08 -07:00
Arushi Kesarwani cb0782c87e Adding activity check to enable Dev mode
Summary:
It is assumed that there will always be an activity associated on enabling the dev support which is not the case. Hence adding that null check.

Changelog:
[Android][Fixed] - Added null check for activity in onHostResume()

Reviewed By: javache

Differential Revision: D30411311

fbshipit-source-id: 8936be2df7f16c355693163347d5e1d94c5ce2e1
2021-08-19 10:47:26 -07:00
Sota Ogo b29a78732d Emit soft error for warning
Summary:
This diff adds a default behavior for the unified logger on Android.

Added the call site in the CXXNativeModule.

Changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D30377767

fbshipit-source-id: 000014828f2f245dc9492e3617218895d9a33536
2021-08-18 23:38:01 -07:00
Joshua Gross 10cd2730af Ship "Disable 'virtual view' preallocation" experiment in code
Summary:
The impact of this has proven impressive, and safe. Ship in code and remove feature-flag.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D30269561

fbshipit-source-id: 9bb72567cfd881928d14d9bee43cf32b390664fb
2021-08-18 21:19:37 -07:00