Commit Graph

23704 Commits

Author SHA1 Message Date
Xin Chen 1c1945569f Fix mis-use of the post animated value when predict fling distance
Summary:
This diff fixes an edge case where scroll to the end of the list may trigger a bounce back effect.

This issue is a regression from D32487846 (https://github.com/facebook/react-native/commit/f70018b37532622f08f20b2c51cdbfca55d730ea) (See [this comment](https://www.internalfb.com/diff/D32487846 (https://github.com/facebook/react-native/commit/f70018b37532622f08f20b2c51cdbfca55d730ea)?dst_version_fbid=263960175698224&transaction_fbid=566201141113715)) that zero velocity fling at the end of the scroll view makes the next fling animator use previous post animation position. This is due to cached `postAnimationValue` is applied mistakenly.

- Pass velocity instead of velocity sign to the helper class
- Update helper class logic to decide if we need to use post animated value from last fling animation

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D32566010

fbshipit-source-id: 1c61659030151f8f2c7648ca901b8b4158835538
2021-12-06 09:40:57 -08:00
Xin Chen ead7b97944 Fix fling and snap in recycler viewgroup where children views not fill up all the scrollable space
Summary:
This diff fixes an edge case where fling and snap failed to find the correct target position when children views not fill up all the scrollable space. In this case, the target position would be calculated as the end of the scrollable space, which case the snap logic to go to the end of the scrollable area, instead of stop at the expected snapping position.

Changelog:
[Android][Fixed] - Fix fling and snap with recycler viewgroup where fling to the end of scrollable distance when it goes over current rendered children views.

Reviewed By: mdvacca

Differential Revision: D32565459

fbshipit-source-id: 319ef6e2d4e1c4deb9e45ed02c1bff7d807575c3
2021-12-06 09:40:57 -08:00
Luna Wei 583471bc48 Fix workflow for automating version bumps
Summary: Changelog: [Internal] - Fix bugs in automate workflow

Reviewed By: cortinico, sota000

Differential Revision: D32810597

fbshipit-source-id: 13503fea871043224f673f2c5301804e1f4cf614
2021-12-03 13:17:31 -08:00
Luna Wei 8cc80a843a isTaggedVersion checks if the commit has a version tag on it
Summary: Changelog: [Internal] Add a `isTaggedVersion` function to filter out commits from release automation.

Reviewed By: sota000

Differential Revision: D32842035

fbshipit-source-id: 14bb262a1d2a96ffda87c759a3202c4f9a356141
2021-12-03 13:17:31 -08:00
Chiara Mooney badd30885f Bump deprecated-react-native-prop-types Dependency (#32700)
Summary:
Bump deprecated-react-native-prop-types dependency to ^2.3.0. This version contains a  .windows.js fork of some deprecated props. Current version has missing information for Windows, breaking CI for react-native-windows repository.

## Changelog
[General] [Changed] - Upgrade deprecated-react-native-prop-types dependency

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

Reviewed By: lyahdav, rozele

Differential Revision: D32816801

Pulled By: yungsters

fbshipit-source-id: f6a8507637075b1a936d91c264bbd8a462505f48
2021-12-03 12:43:15 -08:00
Liron Yahdav 771ca921b5 Add TextInput.setSelection method
Summary:
Adds a `setSelection` imperative method to `TextInput`.

Changelog:
[General][Added] - Adds a setSelection imperative method to TextInput

Reviewed By: JoshuaGross

Differential Revision: D32186514

fbshipit-source-id: 549a7d93b1c55363cf01d804b1e3d735e55c4481
2021-12-03 11:54:01 -08:00
zpd106 0aee7330ff mMainComponentName Keep in line with above in ReactActivityDelegate (#32685)
Summary:
```
public String getMainComponentName() {
    return mMainComponentName;
}

protected void onCreate(Bundle savedInstanceState) {
    String mainComponentName = getMainComponentName();
    mReactDelegate =
        new ReactDelegate(
            getPlainActivity(), getReactNativeHost(), mainComponentName, getLaunchOptions()) {
          Override
          protected ReactRootView createRootView() {
            return ReactActivityDelegate.this.createRootView();
          }
        };
    // mMainComponentName rename is mainComponentName
    if (mainComponentName != null) {
      loadApp(mainComponentName);
    }
  }
```

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

[CATEGORY] [TYPE] - Message

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

Reviewed By: ShikaSD

Differential Revision: D32754475

Pulled By: cortinico

fbshipit-source-id: 46c395a5d6c6508c14eaa163a1e824f0c3cb8b80
2021-12-03 11:50:29 -08:00
Luna Wei bfc6392e1a Rename eslint-plugin-codegen to eslint-plugin-specs (#32698)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32698

Changelog: [Internal] - Renaming the eslint-plugin-codegen to eslint-plugin-specs as a better descriptor for this package. Part of the plan is to publish as a public npm package

Reviewed By: RSNara

Differential Revision: D32777702

fbshipit-source-id: 7776c481871031dba1280d87fb76b777ecc23339
2021-12-02 20:47:12 -08:00
Yuan Dai 8e49658096 Revert D32778338: Add a dependency to the native component example added to RNTester
Differential Revision:
D32778338 (https://github.com/facebook/react-native/commit/173d3a4abcfe6e46e5f375d21fd7823795c16973)

Original commit changeset: d4703903c222

fbshipit-source-id: 7319c272b93584709a69a2b72173aac916c2f093
2021-12-02 20:27:05 -08:00
Sota Ogo 173d3a4abc Add a dependency to the native component example added to RNTester (#32693)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32693

Changelog: [Internal] this diff adds dependecies to the buck files so that an internal app that referes RNtester will work as intended.

Reviewed By: cortinico

Differential Revision: D32778338

fbshipit-source-id: d4703903c2227283fe9c70f02bb7da420d936fbb
2021-12-02 19:18:16 -08:00
Samuel Susla 387e79f8aa Remove background_executor flag
Summary:
changelog: [internal]

Background executor has been shipped on both platforms for a long time.
I've kept the flag around because I wanted to run tests and compare Concurrent Mode vs Background Executor. The intention was to see if we can get rid of Background Executor to simplify the threading model.

Since then, React team has moved away from Concurrent Mode towards more gradual rollout of concurrent rendering and it no longer makes sense to do this comparison. Right now, we don't have a concern with concurrent rendering and Background Executor. If we ever want to run the an experiment, this gating will need to be added again.

Reviewed By: javache

Differential Revision: D32674798

fbshipit-source-id: a1e51c9c5b8e48efa4cb0f25379d58e7eb80ccd9
2021-12-02 15:32:28 -08:00
Tom Spencer ae67c5ac45 Disable ESLint no-undef for TypeScript files (#32655)
Summary:
The `typescript-eslint` project [recommends that `no-undef` is disabled for TypeScript files](https://github.com/typescript-eslint/typescript-eslint/blob/6c3816b3831e6e683c1a7842196b34248803d69b/docs/linting/TROUBLESHOOTING.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors), since TypeScript itself will perform this check. Disabling this config property has two benefits:

- Undefined variables and types will only be reported once, by the TypeScript compiler. Currently they are reported twice: once by TypeScript, and once by ESLint:

<img width="506" alt="Screenshot 2021-11-24 at 12 38 22" src="https://user-images.githubusercontent.com/820863/143239961-eb8ed709-60f9-490a-bda3-fc581673d56c.png">

- Types that are declared globally by React Native will no longer be erroneously reported as undefined - this is currently the case for some types, e.g. `Blob`:

<img width="419" alt="Screenshot 2021-11-24 at 12 40 04" src="https://user-images.githubusercontent.com/820863/143240213-06428b24-09c8-4f95-8e77-7f4fd160eed1.png">

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

[General] [Fixed] - ESLint no-undef rule clashing with TypeScript compiler for TS files

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

Test Plan:
- Before: ESLint reporting on undefined variables in TypeScript files
- After: ESLint no longer reporting on undefined variables in TypeScript files

Reviewed By: GijsWeterings

Differential Revision: D32647147

Pulled By: yungsters

fbshipit-source-id: 070c734ac7a075b556492726c8fecf4fdab65898
2021-12-02 14:43:36 -08:00
Sota Ogo 81a431bbbe Add an option to enable USE_CODEGEN_DISCOVERY
Summary: Changelog: [Internal] Adding an option in RN Tester to enable the new codegen discovery option where it uses generate-artifacts.js to codegen native files. It also updates generate-artifacts.js to support the case where react-native is not within node_modules. It also updates the option name for rn-demo-app.

Reviewed By: cortinico

Differential Revision: D32777912

fbshipit-source-id: f2b76fa61573e3d4507a9f16f8243ac7ca006900
2021-12-02 14:26:58 -08:00
Marc Rousavy 1721efb54f fix: Use same implementation for performance.now() on iOS and Android (#32695)
Summary:
I've noticed that the `performance.now()` implementations differ on iOS and Android.

iOS:
```objc
PerformanceNow iosPerformanceNowBinder = []() {
  // CACurrentMediaTime() returns the current absolute time, in seconds
  return CACurrentMediaTime() * 1000;
};
```
Android:
```c++
double reactAndroidNativePerformanceNowHook() {
  auto time = std::chrono::steady_clock::now();
  auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(
                      time.time_since_epoch())
                      .count();

  constexpr double NANOSECONDS_IN_MILLISECOND = 1000000.0;

  return duration / NANOSECONDS_IN_MILLISECOND;
}
```

For consistency, I thought why not just use the same implementation on both iOS and Android.

It also seems more logical to use Chrono on iOS, since it has nanosecond precision and we just multiply it to milliseconds, whereas `CACurrentMediaTime` multiplies to seconds, and we divide it down to milliseconds again.

## Changelog

(internal change only)

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

Test Plan:
Run on iOS and Android:

```ts
const now = global.performance.now()
console.log(`${Platform.OS}: ${now}`)
```

Reviewed By: feedthejim

Differential Revision: D32793838

Pulled By: ShikaSD

fbshipit-source-id: e7967780be95956a75a3a3757311af0077976d23
2021-12-02 12:32:29 -08:00
Luna Wei 90f0de99ad Remove warning against PR for release branch
Summary:
Changelog: [Internal] Remove warning about creating a pull request to a release branch

We want to support this use case as we want pick requesters to land the cherry-picks themselves and rely on CircleCI automation to test

Reviewed By: cortinico

Differential Revision: D32780819

fbshipit-source-id: 882625a016653dbf480da33fd499d3718b2b5524
2021-12-02 12:11:52 -08:00
Samuel Susla 9e2ec4d3dd Make UIManager::animationTick const
Summary:
changelog: [internal]

UIManager::animationTick is thread safe. Let's make it obvious by marking the method const.

Reviewed By: javache

Differential Revision: D32669102

fbshipit-source-id: 49e35d0f0a5c5d1b03baa1cbf9cdece082909e85
2021-12-02 07:54:09 -08:00
David Ashinsky 5da4872775 Restore react native override preference when live shopping ends.
Summary:
The current implementation of the prelive composer is setting the RN override preference to nil when live shopping ends. However, if the user had a previously set appearance override, this would clear it out.

To resolve this, I cache the user's override preference before we override it, and restore it when live shopping ends.

Additionally, I'm adding a missing callback to restore the override pref when live shopping is dismissed, but not cancelled.

Changelog:
[ReactiveNative][Appearance] - Add function to retrieve overridden RN appearance

Differential Revision: D32564739

fbshipit-source-id: d0b4e06d2bbadad68f172d951609cba3e4587e5d
2021-12-02 07:20:05 -08:00
Peter Carpenter 4d1357918a feat: support queuing accessibility announcements on ios (#32637)
Summary:
The current implementation of `AccessibilityInfo.announceForAccessibility` will immediately interrupt any existing in progress speech with the announcement. Sometimes this is desirable behaviour, but often you will want to wait until existing speech is finished before reading the new announcement. This change gives us that option.

My personal use case for this feature is a custom text input. When typing on iOS with voiceover enabled, each character is read out after being selected. I wanted to add some additional information after each character to help with the context of what has changed in the input, but I didn't want to override the reading of the character itself.

This feature is supported natively on iOS by constructing an `NSAttributedString` with the property [`accessibilitySpeechQueueAnnouncement`](https://developer.apple.com/documentation/foundation/nsattributedstring/key/2865770-accessibilityspeechqueueannounce), so this change just adds an extra parameter to `AccessibilityInfo.announceForAccessibility` which controls the value of that property on the native side. Adding this as an extra optional parameter with false as the default ensures that existing uses of the function won't be affected.

Unfortunately, this feature doesn't appear to be supported on Android, so the new second property will be iOS only.

## Changelog

[iOS] [Added] - add new argument to announceForAccessibility to allow queueing on iOS

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

Test Plan:
I've updated the `announceForAccessibility` section in RNTester with multiple buttons to demonstrate the difference between `queue: false` (default) and `queue: true` and show they work as intended.

Here's the expectation for each button:

- "Announce for Accessibility Immediately": on press, should start reading the button label, then be interrupted by the announcement
- "Announce for Accessibility Queued": on press, should read the button label then read the announcement afterwards
- "Announce for Accessibility Queue Multiple": on press, should read the button label, then read three announcements sequentially, no interruptions

You can see the realisation of those expectations in the following video recorded on an iPhone 12 running iOS 15.0.2:

https://user-images.githubusercontent.com/14826539/142770536-d57bfd69-eba5-444d-9c89-4bf4851ea062.mov

I've also tested the same way on an iPhone 8 running iOS 13.4 and it works exactly the same.

Reviewed By: yungsters

Differential Revision: D32637989

Pulled By: philIip

fbshipit-source-id: 3e90add523f11eb0eb34ea623211249263f257e2
2021-12-02 00:34:05 -08:00
Luna Wei 2bb91ae0e9 Consolidate upgrade forms
Summary:
Changelog:
[Internal] - Consolidate issue forms instead of separating into to 2.

Reviewed By: sota000

Differential Revision: D32736198

fbshipit-source-id: 73f858ae7dae4fea6c0e5d5a3af7b110b34c6226
2021-12-01 16:57:18 -08:00
Tom Spencer 722a0ff6f8 Fix eslint no-shadow issue with TypeScript enums (#32644)
Summary:
The current ESLint config includes a rule for `no-shadow`. When authoring using TypeScript, the [typescript-eslint docs](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-shadow.md) mention that the base `no-shadow` rule should be disabled in favour of `typescript-eslint/no-shadow`, otherwise false positives can be reported. In my case, I was experiencing the same symptoms as described in [this issue](https://github.com/typescript-eslint/typescript-eslint/issues/2552).

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

[General] [Fixed] - ESLint `no-shadow` rule returning false positive for TypeScript enums

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

Test Plan:
Before config changes:

<img width="631" alt="Screenshot 2021-11-22 at 21 02 31" src="https://user-images.githubusercontent.com/820863/142934803-ef1343d6-46ab-4495-9ea5-957f7ec404fc.png">

After changes:

<img width="486" alt="Screenshot 2021-11-22 at 21 03 28" src="https://user-images.githubusercontent.com/820863/142934914-a151656a-a37e-4ffb-9db5-ed9fb93543c7.png">

Reviewed By: GijsWeterings

Differential Revision: D32618393

Pulled By: yungsters

fbshipit-source-id: c69d5cff7210c22c84a0791bde62674efc6aa027
2021-12-01 14:09:34 -08:00
Janic Duplessis b2cf24f41c Make hermes-executor-common a static lib (#32683)
Summary:
I've been seeing a couple crashes related to missing hermes-executor-common.so, seems to happen on specific android versions, but can't repro. I investigated this so file more and noticed it is incorrectly linked as a static library here https://github.com/facebook/react-native/blob/b8f415eb6cdc0e0e7a7413b6f9defdcee304d9e8/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/Android.mk#L20. There doesn't seem to be any reason for this to be a shared lib so I changed it to be compiled as a static lib.

## Changelog

[Android] [Fixed] - Make hermes-executor-common a static lib

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

Test Plan:
- Verify there is no more hermes-executor-common-{release,debug}.so
- Test locally in an app to make sure it build and run properly.
- Verify that the crash happening on play store pre-launch report doesn't happen anymore.

Reviewed By: ShikaSD

Differential Revision: D32754968

Pulled By: cortinico

fbshipit-source-id: cb57e2d81edb4cbdb1f003dab45c53e594a5a62a
2021-12-01 11:19:23 -08:00
Luna Wei cdce733b79 Back out "Quote --sourcemap-output argument during ios build"
Summary:
Changelog: [Internal] Revert --sourcemap-output argument

Reverting on main from discussion from the 67 release:
https://github.com/reactwg/react-native-releases/discussions/1#discussioncomment-1705266

Original commit changeset: 0c2d98746b36

Reviewed By: GijsWeterings

Differential Revision: D32734743

fbshipit-source-id: cc3130581d01bdcdc9f5d483161ae9506fdbf7b8
2021-12-01 10:55:11 -08:00
Samuel Susla 1989ad3955 Attempt to fix a crash in Scheduler::uiManagerDidCloneShadowNode
Summary:
changelog: [internal]

Attempt at fixing a crash in `Scheduler::uiManagerDidCloneShadowNode` by setting delegate to nullptr explicitly.

I don't think this will make a difference because `scheduler_` is released at the end of `dealloc` but it is worth a shot. Maybe some complex interaction between Obj-C and C++ comes into play here.

In this diff I also removed `_animationDriver = nullptr` because dealloc will do that automatically.

Reviewed By: philIip

Differential Revision: D32720901

fbshipit-source-id: 227ced2331384c47e8d15a323ee8a621bbb3d179
2021-12-01 03:09:47 -08:00
Eric Rozell f3bf2e4f51 Add isPressable native prop to Text
Summary:
react-native-windows currently needs to maintain a fork of TextNativeComponent to wire through a native-only prop for `isPressable`.

The reason we do this on Windows is that we implement an optimization so we only attempt to hit test a virtual Text node if it is actually pressable, leading to significant perf improvement for pointer events (e.g., onMouseEnter / onMouseLeave) on Text.

Changelog:
[General][Added] - Native-only prop to optimize text hit testing on some RN platforms

Reviewed By: JoshuaGross

Differential Revision: D32564637

fbshipit-source-id: bf47c68d94a930d2c620cb3b1584355c5e412bd4
2021-11-30 21:55:39 -08:00
Sota Ogo 363ff5c0fc Build codegen package in pod install (#32678)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32678

In D32420306 (https://github.com/facebook/react-native/commit/3d8b5a35f9ef2a1c1c3c974917dbc9abc79ba522) (https://github.com/facebook/react-native/commit/3d8b5a35f9ef2a1c1c3c974917dbc9abc79ba522), I added a phase which uses a codegen, but it assumed that the codegen package has already been built. This diff fixes the issue where it checks and build the codegen packaage.

I also reverted the change that I made for the circle CI test since it now builds the codegen when running pod install.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D32707588

fbshipit-source-id: a287ff96e8123833da093228fe60e2069884eb45
2021-11-30 17:11:17 -08:00
Luna Wei 94abcffe2f Update CircleCI to auto-deploy release branch on push
Summary:
Changelog: [Internal] Update CircleCI to auto-deploy release branch on push

This work is part of an effort to automate the release process by using a push to a release branch as a trigger to prepare, package and deploy react-native to npm from CircleCI

The following diagram describes the context (what kind of releases we do, relevant scripts and what they do), the pre-existing process for the different types of release and how I've modified the process.
{F683387103}

This diff updates the relevant CircleCI workflows

Reviewed By: sota000

Differential Revision: D32702420

fbshipit-source-id: e20cdeb53eb4a8ce7e54e083e3e14bd89e11b789
2021-11-30 16:52:18 -08:00
Luna Wei f4314c2b44 Extract logic from bump-oss-version specific to prod releases
Summary:
Changelog: [Internal] - Extract logic from bump-oss-version specific to prod releases

This work is part of an effort to automate the release process by using a push to a release branch as a trigger to prepare, package and deploy react-native to npm from CircleCI

The following diagram describes the context (what kind of releases we do, relevant scripts and what they do), the pre-existing process for the different types of release and how I've modified the process.
{F683387103}

This diff creates the `prepare-package-for-release` script referenced by extracting it out of `bump-oss-version` and leveraging `set-rn-version`. It adds some helper functions to `version-utils` with tests

Reviewed By: sota000

Differential Revision: D32556610

fbshipit-source-id: eb4ddc787498744156f985ab6d205c5d160e279b
2021-11-30 16:52:18 -08:00
Luna Wei ea6e34da77 Extract release agnostic logic in bump-oss-version to set-rn-version
Summary:
Changelog: [Internal] Copy over universal (across dry-run, nightly, release) work in `bump-oss-version` script

This work is part of an effort to automate the release process by using a push to a release branch as a trigger to prepare, package and deploy react-native to npm from CircleCI

The following diagram describes the context (what kind of releases we do, relevant scripts and what they do), the pre-existing process for the different types of release and how I've modified the process.
{F683387103}

This diff creates the `set-rn-version` script referenced by extracting it out of `bump-oss-version`

Reviewed By: sota000

Differential Revision: D32556608

fbshipit-source-id: 6c2868c01ddd930375279a5105bcd0d447f65734
2021-11-30 16:52:18 -08:00
Luna Wei c611ed1b93 Add getNextVersionFromTags
Summary:
Changelog: [Internal] - Add getNextVersionFromTags to determine next release version off a release branch

In more detail - this work is part of an effort to automate the release process by using a push to a release branch as a trigger to prepare, package and deploy react-native to npm from CircleCI

This function is later used in `prepare-package-for-release` script in D32556610 to bump the version

Reviewed By: cortinico, ShikaSD

Differential Revision: D32556609

fbshipit-source-id: 7d93ead0b34318a58ffeb876715fbd34d6041f4e
2021-11-30 16:52:18 -08:00
Xin Chen 508de3f351 Refactor helper method for ScrollView to not detect scroll direction
Summary:
The helper class for ScrollView should not need to detect the scroll direction. If it has to do so, that means the corresponding logic should live in the `ReactScrollView` or `ReactHorizontalScrollView` respectively.

This diff is to remove the scroll direction detection logic from the scroll view helper. Long term we should keep it this way as the shared code got moved to the helper class from the scroll view classes.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D32514429

fbshipit-source-id: 2165f2eba90cc25d14834c39148fe8ce8805bea6
2021-11-30 13:14:55 -08:00
Xin Chen 8ab2cbb78f Merge scroll changed workflow into scroll helper class
Summary:
This diff address [comment](https://www.internalfb.com/diff/D32372180 (https://github.com/facebook/react-native/commit/073195991bfdf4c96490c65f9c0cf00d09356188)?dst_version_fbid=444635297227339&transaction_fbid=636262217544650) to merge workflow that notify Fabric state changes when scroll changed.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D32500423

fbshipit-source-id: 8701f7ac885bf755e026b70554cb4a2ebb1af527
2021-11-30 13:14:55 -08:00
Xin Chen f70018b375 Fix quick small scroll gesture race issues
Summary:
This diff fixes two edge case (similar to a race condition) that caused unexpected behaviors.

**Problem one**
{F680816408}

The previous fling animation is not canceled when user starts to scroll or drag. This is causing both the animation and scroll are setting the scroll position. Depends on the animation path and scroll speed, there may be cases where the [velocity calculation](https://fburl.com/code/010lsu72) ends up getting reversed values. See P467905091 as an example where you can see `mXFlingVelocity` goes back and forth from positive to negative.

It's hard to see if the wrong values are in the middle, but if that happens in the end of user gesture, the velocity for the next fling would be wrong. It shows a "bounce back" effect, and can be triggered when user makes small quick joystick scrolls in one direction.

**Problem two**

{F680821494}

There is a gap between animator's `onAnimationEnd` lifecycle method [finished](https://fburl.com/code/6baq04ne) and the `Animator#isRunning` API to return false. This is causing issues for `getPostAnimationScrollX` where we [decide to return](https://fburl.com/code/hzzugvch) the animated final value or the scroll value. User may see the `-1` value got used for the next fling start value, and the whole scroll view goes back to the beginning of scroll view and starts to fling.

This happens when the previous fling animation finishes and the animated final value is set to -1, but at the same time the next fling starts before `isRunning` returns false for the previous animation.

**Solution**
The problems are fixed by
- Do not reset animated final value to -1 in `onAnimationEnd` method
- Add `mIsFinished` states and use it to track animation finish signal, instead of using `isRunning` API
- Update logic where we decide to return the correct value for the next animation starts point. We will return previous animated final value when the animation got canceled, and user is going towards that value from the current scroll value.

Changelog:
[Android][Fixed] - Fixed edge case for quick small scrolls causing unexpected scrolling behaviors.

Reviewed By: javache

Differential Revision: D32487846

fbshipit-source-id: f1b0647656e021390e3a05de5846251a4a2647ff
2021-11-30 13:14:55 -08:00
Felipe Perez 79d20a1717 Fix fromRawValue(EdgeInsets) from single float case falling through to float array
Summary:
If `value` is of type `float`, it will still fall through to the `react_native_assert` below, exploding. The `map` type is handled correctly.

Changelog: [Internal][Fixed] Fix fromRawValue(EdgeInsets) from single float case falling through to float array and exploding

Reviewed By: javache

Differential Revision: D32648848

fbshipit-source-id: e70cddd291a8f52d6ee3de5fef11b0bb7aee92cd
2021-11-30 10:38:22 -08:00
Simon Farshid a4a3e67554 Fix post_install_workaround downgrading development targets (#32633)
Summary:
The `__apply_Xcode_12_5_M1_post_install_workaround` script changes the `IPHONEOS_DEPLOYMENT_TARGET` to `11.0` for all pods. This causes problems if the pods were targetting `12.0` or higher. Many expo modules are targetting `12.0`.

I fixed this issue by checking the existing version and only bumping the target if it is lower than `11.0`.

See also: this discussion post by mikehardy https://github.com/reactwg/react-native-releases/discussions/1#discussioncomment-1619523

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

[iOS] [Fixed] - __apply_Xcode_12_5_M1_post_install_workaround causing pods targetting iOS 12 and above to fail

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

Test Plan:
### Test (failing before this patch, passing after this patch)

1. pick an iOS Pod that has a minimum deployment target of iOS 12 or higher, I chose the Braintree package
2. `npx react-native init myrnapp`
3. Open `ios/Podfile` and add the pod as a dependency: `pod 'Braintree', '~> 5'` (and upgrade the Podfile target to 12 (`platform :ios, '12.0'`))
4. Compile the app.

Before applying this patch:  Build fails because Braintree uses iOS 12 features and was downgraded to target 11.0
After applying this patch:  Build succeeds

Reviewed By: fkgozali

Differential Revision: D32638171

Pulled By: philIip

fbshipit-source-id: 0487647583057f3cfefcf515820855c7d4b16d31
2021-11-30 10:22:31 -08:00
Nicola Corti 6abf8b4f05 Do not report a CI failure if add-version-label-issue is red
Summary:
The `add-version-label-issue` CI is failing if the version label is not found.
That is happening for previous versions of RN where the Labels are missing.

Changelog:
[Internal] [Changed] - Do not report a CI failure if add-version-label-issue is red

Reviewed By: sammy-SC

Differential Revision: D32723953

fbshipit-source-id: 878d2632b3a78311a01363b8f8a9181ae543a253
2021-11-30 09:40:09 -08:00
Nicola Corti f1a673b49b Enable Fabric by default inside RN-Tester
Summary:
As the title says. It's now safe to enable Fabric by default inside RNTester.

Changelog:
[Internal] [Changed] - Enable Fabric by default inside RN-Tester

Reviewed By: fkgozali

Differential Revision: D32723540

fbshipit-source-id: dab786694ba9ceb238570608713b5243a730aada
2021-11-30 09:36:14 -08:00
Andrei Shikov 290dae9df5 Move preallocation calls to background under MC
Summary:
Preallocation can take 10-20% of time when creating new nodes. (according to systrace measurements). At the moment, we are executing all preallocation calls in JS thread, potentially slowing down the progress there. Moving them to bg thread is a simple micro-optimization that ensures we return the node to JS as soon as possible.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D32677843

fbshipit-source-id: 3df47ae9aa365a8db720d71e2423c87659e9128c
2021-11-30 09:17:39 -08:00
Andrei Shikov 041398a775 Compile platform Android components into static libraries
Summary:
Removes extra .so files by merging built-in components into libfabricjni.so
These components shouldn't be referenced in outside modules, so merging them is trivial atm.

Changelog:
[Internal][Android] - Compile native components into static libraries

Reviewed By: cortinico

Differential Revision: D32677572

fbshipit-source-id: fc1a6c5a2832ee49e438c30856562f85677514ea
2021-11-30 08:31:44 -08:00
Andrei Shikov 7eb1ff5048 Rename reactconfig module to react_config to align naming
Summary:
title

Changelog:
[Internal][Android] - Rename reactconfig c++ module

Reviewed By: cortinico

Differential Revision: D32677571

fbshipit-source-id: 41b4313a1f7c75da7204cf829ae3d0d700151eba
2021-11-30 08:03:27 -08:00
Pieter De Baets e3a591e650 Enable allow_jni_merging for internal targets
Summary:
Noticed we explicitly dropped the `allow_jni_merging` while not actually using it anywhere, and that we didn't have `fbandroid_allow_jni_merging` on some other libs.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D32355868

fbshipit-source-id: 6bd3fcc395e3dcacf4a8fc1033d471b2ffb0e8af
2021-11-30 06:50:18 -08:00
Samuel Susla a9815286c2 Remove redundant parameter from ShadowTreeRegistry::enumerate
Summary:
Changelog: [internal]

Nothing was using `stop` parameter, let's get rid of it.

Reviewed By: philIip

Differential Revision: D32669018

fbshipit-source-id: dc2d52048a2f7dd3785dd959270087001c778962
2021-11-30 04:32:02 -08:00
Nicola Corti fab4752e1f Create a cleanAll Top Level Gradle task.
Summary:
This task is supposed to really clean all the files that are generated
as part of a build and bring you to a clean state.

Changelog:
[Internal] [Changed] - Create a `cleanAll` Top Level Gradle task.

Reviewed By: ShikaSD

Differential Revision: D32649942

fbshipit-source-id: 20b72ad4e1c0ef046aaaba94e2331176dca49abf
2021-11-30 01:53:06 -08:00
Neil Dhar 040e72e02b Bump package version for Hermes on iOS
Summary:
allow-large-files

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D32416407

fbshipit-source-id: 7f7c7c4b25afe9d3852034958b57a45004e859a7
2021-11-29 17:13:57 -08:00
Xin Chen 3352b57a6f Make fling animator customizable
Summary:
This diff makes the fling animator cuztomizable, so that the subclasses can have their own animation for fling behavior.

Before the diff, we rely on the `OverScroller` to `fling`, which has some issues with Spline interpolation being messed up due to the clamped fling distance (See more details in T105464095). This may not be a big issue for mobile when user touches screen, but in VR environment this shows up very clearly with joystick events. To fix that properly without affecting mobile behavior, I added a new interface `HasFlingAnimator` from the helper, and implemented with default fling animator in the OSS ScrollView.

We should consider adopt a suitable animator for mobile platform, as the non-smooth fling effect is also happening in mobile.

- Add interface `HasFlingAnimator` to `ReactScrollView` and `ReactHorizontalScrollView`
- Add default fling animator
- Depend on if the default animator is used, customize the flingAndSnap behavior

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D32382806

fbshipit-source-id: 08f03350f6a9b9fc03414b4dcb9977b9f33603ba
2021-11-29 14:56:14 -08:00
Sota Ogo 0ff02f9a41 Add log function binding to Facebook App
Summary:
Adding the RCTLog binding to Facebook app. More context is in D30271863 (https://github.com/facebook/react-native/commit/c317a709d5657f30b9d839f8676f23a62731dcd5)

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D31299188

fbshipit-source-id: 5234242e2f82262f9d2538e6c689f4a3738f37bb
2021-11-29 14:42:10 -08:00
Nicola Corti b8f415eb6c Update LOCAL_SHARED_LIBRARIES to be a multiline string
Summary:
We have `LOCAL_SHARED_LIBRARIES` that are getting longer and are
making reviewing them on Diffs quite hard.
Having all the list of the dependency on a single line is suboptimal
and it makes hard to find duplicated entries.
I've updated the longest `LOCAL_SHARED_LIBRARIES` to be multilines and
I've sorted the entries here.

Changelog:
[Internal] [Changed] - LOCAL_SHARED_LIBRARIES

Reviewed By: ShikaSD

Differential Revision: D32695127

fbshipit-source-id: f5b381c501ddff083ef9f4baaca6c4c8c9523368
2021-11-29 13:01:51 -08:00
Nicola Corti d74e71e86b Bump AGP to 7.x inside the react-native-gradle-plugin
Summary:
Seems like the Gradle plugin was left behind when bumping AGP.
This bump is quite significant as AGP removed several dependencies from their
exported one so I had to reimport them again (ideally we should move to kotlinx-serialization).

I've also addressed a couple of Kotlin compiler warnings that were not related to
the AGP Api (those will be addressed at a later time).

Plus I've also fixed the target Java version to 11 as the compiler was complaining
that Java target was at 11 while Kotlin Jvm target was defaulted at 8

Changelog:
[Internal] [Changed] - Bump AGP to 7.x inside the react-native-gradle-plugin

Reviewed By: ShikaSD

Differential Revision: D32667745

fbshipit-source-id: 044930bf6cc49065eff4af1c9be79de76d5b368b
2021-11-29 12:00:33 -08:00
enniel b399c2e3d1 CLI: export packager environment variables (#32666)
Summary:
Custom metro port not working without exporting variables from `.packager.env`

## Changelog

[General] [Fixed] - Fix support for custom port

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

Test Plan: run `react-native run-android --port=8082` and `react-native run-ios --port=8082`

Reviewed By: yungsters

Differential Revision: D32694233

Pulled By: cortinico

fbshipit-source-id: 42e803d56b83608024b901d2a3024733ed7099b7
2021-11-29 08:31:27 -08:00
Andrei Shikov a596e98611 React Native sync for revisions c0c71a8...c1220eb
Summary:
This sync includes the following changes:
- **[c1220ebdd](https://github.com/facebook/react/commit/c1220ebdd )**: treat empty string as null ([#22807](https://github.com/facebook/react/pull/22807)) //<salazarm>//
- **[09d9b1775](https://github.com/facebook/react/commit/09d9b1775 )**: Update deprecated features in ESLint configuration files. ([#22767](https://github.com/facebook/react/pull/22767)) //<Esteban>//
- **[bddbfb86d](https://github.com/facebook/react/commit/bddbfb86d )**: Revert "Fix Node package.json ./ exports deprecation warning ([#22783](https://github.com/facebook/react/pull/22783))" ([#22792](https://github.com/facebook/react/pull/22792)) //<Sebastian Silbermann>//
- **[b831aec48](https://github.com/facebook/react/commit/b831aec48 )**: chore(fast-refresh): double check wasMounted ([#22740](https://github.com/facebook/react/pull/22740)) //<anc95>//
- **[8edeb787b](https://github.com/facebook/react/commit/8edeb787b )**: Fix Node package.json ./ exports deprecation warning ([#22783](https://github.com/facebook/react/pull/22783)) //<Rin Arakaki>//
- **[fdc1d617a](https://github.com/facebook/react/commit/fdc1d617a )**: Flag for client render fallback behavior on hydration mismatch ([#22787](https://github.com/facebook/react/pull/22787)) //<salazarm>//
- **[aa19d569b](https://github.com/facebook/react/commit/aa19d569b )**: Add test selectors to experimental build ([#22760](https://github.com/facebook/react/pull/22760)) //<Brian Vaughn>//
- **[520ffc77a](https://github.com/facebook/react/commit/520ffc77a )**: Use globalThis if possible for native fetch in browser build ([#22777](https://github.com/facebook/react/pull/22777)) //<Jiachi Liu>//
- **[afbc2d08f](https://github.com/facebook/react/commit/afbc2d08f )**: Remove unused react-internal/invariant-args ESLint rule. ([#22778](https://github.com/facebook/react/pull/22778)) //<Esteban>//
- **[ca94e2680](https://github.com/facebook/react/commit/ca94e2680 )**: Remove 'packages/shared/invariant.js' ([#22779](https://github.com/facebook/react/pull/22779)) //<Esteban>//
- **[83564712b](https://github.com/facebook/react/commit/83564712b )**: Move SuspenseList to experimental channel ([#22765](https://github.com/facebook/react/pull/22765)) //<Andrew Clark>//
- **[d4144e6e5](https://github.com/facebook/react/commit/d4144e6e5 )**: fix : grammatical typo for test description ([#22764](https://github.com/facebook/react/pull/22764)) //<Brijesh Prasad>//
- **[0b329511b](https://github.com/facebook/react/commit/0b329511b )**: chore: fix comment typo ([#22657](https://github.com/facebook/react/pull/22657)) //<Han Han>//
- **[e6f60d2ad](https://github.com/facebook/react/commit/e6f60d2ad )**: fix typos ([#22715](https://github.com/facebook/react/pull/22715)) //<180909>//

Changelog:
[General][Changed] - React Native sync for revisions c0c71a8...c1220eb

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D32646433

fbshipit-source-id: c534ee7a17141634700c90fc2c7b34bfbe17887a
2021-11-29 04:37:28 -08:00
Nicola Corti e21f8ec349 Fix crash on ReactEditText with AppCompat 1.4.0
Summary:
This Diff fixes a crash happening as the user uses AppCompat 1.4.0
as a dependency in their App and uses a `TextInput` component.

The crash happens as `mFabricViewStateManager` is accessed during
the ctor of the superclass, and is not yet initialized.

Fixes #31572

Changelog:
[Android] [Fixed] - Fix crash on ReactEditText with AppCompat 1.4.0

Reviewed By: ShikaSD

Differential Revision: D32674975

fbshipit-source-id: efa413f5e33527a29fbcfa729e8b006ecb235978
2021-11-29 02:56:07 -08:00