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

26590 Коммитов

Автор SHA1 Сообщение Дата
Stephanie Nicholson 3951b27807 Revert D42923921: Fully remove usage of timed runtime
Differential Revision:
D42923921 (1c8179b9b1)

Original commit changeset: 33024a43269f

Original Phabricator Diff: D42923921 (1c8179b9b1)

fbshipit-source-id: 32f59baacd88fbdf34c7d8e248479cbe6eb4cc6d
2023-02-08 09:39:15 -08:00
Pieter De Baets 1c8179b9b1 Fully remove usage of timed runtime
Summary: Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D42923921

fbshipit-source-id: 33024a43269fd5b1512421f13c141350aa619732
2023-02-08 08:59:48 -08:00
Nicola Corti 4128df20de Reduce flakyness on InteractionManager-test (#36092)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36092

This test is partially disabled already, causing high flakyness of the `test_windows` CI job.
I'm taking a different approach at disabling it here (disabling the offending tests using a `Promise`
rather than disabling at the assert level).

Changelog:
[Internal] [Changed] - Reduce flakyness on InteractionManager-test

Reviewed By: cipolleschi

Differential Revision: D43120897

fbshipit-source-id: 69edee804aaaa8b6f89ff8440561254f393efae4
2023-02-08 08:43:54 -08:00
Samuel Susla 56cb19f419 Remove default arguments from ShadowTree::commit and ShadowTree::tryCommit
Summary:
Changelog: [Internal]

Caller needs to explicitly set commit options. This is for readability and making sure caller is aware of what are the options of the commit. This will be important in subsequent diff where we will add another commit option.

Reviewed By: christophpurrer

Differential Revision: D43082837

fbshipit-source-id: 1417205299c19430f902453c2b6d9bb9ca31707d
2023-02-08 06:58:33 -08:00
Pieter De Baets 2fbefff178 Remove unreferenced RCTWeakProxy
Summary:
Changelog:
[iOS][Removed] - Removed unused RCTWeakProxy helper

allow-large-files

Reviewed By: sammy-SC

Differential Revision: D43039589

fbshipit-source-id: 9398dfe2f052a63757823018d7072a56271eabac
2023-02-08 06:24:56 -08:00
Nick Gerleman cab865be79 Fix VirtualizedList usage of potentially stale state on cell focus
Summary:
State updates can be batched together idependent of `this.state`, so we should do any calculation deriving state from state within a `setState()` callback. This fixes a bug where we were relying on potentially stale state, a RenderMask derived from `this.state` instead of the `state` callback parameter, when triggering updates from focus.

Note that this is not exercised on Android/iOS, but it on desktop/web. I noticed this a while back while making another change, but that change got abandoned, so this is the independent fix.

Changelog:
[General][Fixed] - Calculate VirtualizedList render mask for focused cell during batched state updates

Reviewed By: javache

Differential Revision: D43073415

fbshipit-source-id: dee4197ec925a6d8d427b63fb063aa4e3b58c595
2023-02-07 18:25:28 -08:00
Lulu Wu 1058bb8096 Convert Bridge-only checks to overridable functions
Summary:
Convert Bridge-only checks to overridable functions and make Bridgeless override them in ReactSurfaceView so that the checks will work for Bridgeless as well.

Issue fixed:
https://fb.workplace.com/groups/rn.support/permalink/24231137939841493/

Changelog:
[Android][Changed] - Convert Bridge-only calls to overridable functions

Reviewed By: javache

Differential Revision: D43063348

fbshipit-source-id: a1c181d27c1669f6033f3fb783c5a668b7c2585b
2023-02-07 13:10:43 -08:00
Deepak Jacob 9d98e2cb07 Revert D41273822: Add fabric support for maintainVisibleContentPosition on iOS
Differential Revision:
D41273822 (ecf967a51d)

Original commit changeset: 7900898f2828

Original Phabricator Diff: D41273822 (ecf967a51d)

fbshipit-source-id: 0f4b9695c805407b9a41b0fec63784bd0e84be43
2023-02-07 13:06:38 -08:00
Matthijs Mullender d31670b4d9 do not strip JavascriptException
Summary:
Changelog:
[internal] - DescriptionSome tooling breaks when the JavascriptException is obfuscated. This change prevents the exception from getting obfuscated, allowing tools to detect them without symbolicating.

Differential Revision: D43091424

fbshipit-source-id: aae4768397bd78433a1d496ecac4a1442422d912
2023-02-07 12:42:34 -08:00
Samuel Susla 25f585302e Pass RuntimeScheduler to Binding from Venice on Android
Summary:
Changelog: [internal]

Pass RuntimeScheduler to Binding in Venice.
This is needed for two reasons:
- support "callImmediates". This is a workaround to bridge the gap in scheduling until microtasks in RN are shipped.
- To block paint in case there is a state update in useLayoutEffect. Used later in this diff stack

Reviewed By: sshic

Differential Revision: D43088186

fbshipit-source-id: 8537234db5f72cbf057ad1861ca2c37a5c3dbd8b
2023-02-07 11:01:44 -08:00
Kudo Chien a232decbb1 update jsc-android to ndk r23 based (#36062)
Summary:
the current jsc-android is still built based on ndk r21, and react-native is now built based on ndk r23. the unwinder between r21 and r23 is incompatible (libgcc vs libunwind). if there's exceptions throwing from jsc, other react native libraries cannot catch these exceptions and cause runtime crash.

this pr updates jsc-android to 235231.0.0 which is the same webkitgtk version as 235230.2.1 but only built by ndk r23. the jsc-android pr is from https://github.com/react-native-community/jsc-android-buildscripts/pull/179. note that the jsc is based on ndk r23c and react-native is based on ndk r23b. the reason is that i cannot get jsc building successfully on r23b. hopefully r23b and r23c are abi safe.

there is another crash from libjscexecutor when testing the new jsc-android. to fix the issue, i have to explicitly link libunwind.a from libjscexecutor.so. supposedly ndk r23 should help to link libunwind under the hood, i still not figure out why it doesn't. but after linking libunwind.a, i can get new jsc-android work successfully.

```
E/art     ( 2669): dlopen("/data/app/com.test-1/lib/x86_64/libjscexecutor.so", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "_Unwind_Resume" referenced by "/data/app/com.test-1/lib/x86_64/libjscexecutor.so"...
W/System.err( 2669): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_Unwind_Resume" referenced by "/data/app/com.test-1/lib/x86_64/libjscexecutor.so"...
W/System.err( 2669): 	at java.lang.Runtime.load(Runtime.java:331)
W/System.err( 2669): 	at java.lang.System.load(System.java:982)
W/System.err( 2669): 	at com.facebook.soloader.SoLoader$1.load(SoLoader.java:558)
W/System.err( 2669): 	at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:110)
W/System.err( 2669): 	at com.facebook.soloader.DirectorySoSource.loadLibrary(DirectorySoSource.java:63)
W/System.err( 2669): 	at com.facebook.soloader.ApplicationSoSource.loadLibrary(ApplicationSoSource.java:91)
W/System.err( 2669): 	at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1067)
W/System.err( 2669): 	at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:943)
W/System.err( 2669): 	at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:855)
W/System.err( 2669): 	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:802)
W/System.err( 2669): 	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:772)
W/System.err( 2669): 	at com.facebook.react.jscexecutor.JSCExecutor.loadLibrary(JSCExecutor.java:24)
W/System.err( 2669): 	at com.facebook.react.jscexecutor.JSCExecutor.<clinit>(JSCExecutor.java:20)
W/System.err( 2669): 	at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:363)
W/System.err( 2669): 	at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:316)
W/System.err( 2669): 	at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:94)
W/System.err( 2669): 	at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:41)
W/System.err( 2669): 	at com.test.MainApplication.onCreate(MainApplication.java:60)
W/System.err( 2669): 	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)
W/System.err( 2669): 	at androidx.test.runner.MonitoringInstrumentation.callApplicationOnCreate(MonitoringInstrumentation.java:483)
W/System.err( 2669): 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4518)
W/System.err( 2669): 	at android.app.ActivityThread.access$1500(ActivityThread.java:144)
W/System.err( 2669): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
W/System.err( 2669): 	at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 2669): 	at android.os.Looper.loop(Looper.java:135)
W/System.err( 2669): 	at android.app.ActivityThread.main(ActivityThread.java:5221)
W/System.err( 2669): 	at java.lang.reflect.Method.invoke(Native Method)
W/System.err( 2669): 	at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err( 2669): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
W/System.err( 2669): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
```

fixes https://github.com/facebook/react-native/issues/36052

## Changelog

[ANDROID][FIXED] - Fixed jscexecutor crash on Android which is caused from NDK incompatibility

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

Test Plan: tested on [jsc-android instrumented test](https://github.com/react-native-community/jsc-android-buildscripts/tree/2.26.1/test) (based on react-native 0.71.2)

Reviewed By: cipolleschi

Differential Revision: D43040295

Pulled By: cortinico

fbshipit-source-id: e0e5b8fb7faa8ee5654d4cde5f274bef4b517376
2023-02-07 09:33:44 -08:00
Xin Chen 7e02b41630 Remove useOverflowInset flag as we rolled out 100% to public for over three months
Summary:
This was shipped in D36990986 (df80ed40c7) but backed out last year in D37074879 (59476d06f3), as we want to wait for some performance comparison results to come out.

Remove overflow inset optimization flags as they've been rolled out 100% to public.

Changelog:
[Android][Internal] - Clean up feature flags for overflowInset

Reviewed By: javache

Differential Revision: D43070494

fbshipit-source-id: dbf5aed9b2b5d3db1ad351bc208cb2016dc62e40
2023-02-07 09:22:58 -08:00
Zihan Chen (MSFT) bbed15d4ae Turbo Module supports intersection type for TypeScript (#36037)
Summary:
As [requested from community](https://github.com/reactwg/react-native-new-architecture/discussions/91#discussioncomment-4282384), intersection type is supported for component but no in turbo module. This PR fixed it.

## Changelog

[GENERAL] [CHANGED] - Turbo Module supports intersection type for TypeScript

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

Test Plan: `yarn jest react-native-codegen` passed

Reviewed By: christophpurrer

Differential Revision: D42960338

Pulled By: cipolleschi

fbshipit-source-id: d317d3155cb96643bf549d0ac3d77f503685edbc
2023-02-07 07:41:37 -08:00
shivenmian bb02ccf13f RNGP - fix: use relative paths for gradle exec invocations (#36080)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36080

For Android release builds on Windows, gradle release build fails if there are spaces in path (https://github.com/facebook/react-native/issues/34878). This is due to gradle improperly handling arguments with spaces (this is also [an open issue](https://github.com/gradle/gradle/issues/6072) on Gradle). Since the Hermes compilation and other Gradle exec invocations involve arguments which will contain spaces (if there are spaces in your path), this also means it is hard to get around this by simply escaping the spaces (eg: by using double quotes), since these arguments are not properly handled by Gradle itself.

As a workaround, this PR uses relative paths for all Gradle commands invoked for Android. As long as there aren't any spaces in the react-native directory structure (i.e this repo), this fix should work.

## Changelog

[Android][Fixed] - Used relative paths for gradle commands

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

Test Plan: `npx react-native run-android` builds and runs the app successfully on Android device, when run inside an RN0711 project with a path containing spaces (and with the changes in this PR applied) on Windows. This includes release builds (i.e with the `--variant=release` flag).

Reviewed By: cipolleschi

Differential Revision: D43080177

Pulled By: cortinico

fbshipit-source-id: 7625f3502af47e9b28c6fc7dfe1459d7c7f1362d
2023-02-07 07:29:17 -08:00
Nicola Corti 2607602b8a Reduce flakyness by not downloading extra packages (#36077)
Summary:
Yesterday CircleCI was extremely flaky due to us trying to `apt install` extra packages. This mitigates one scenario where we try to redownload `jq` and `shellcheck`.

I've moved to use a container which contains those packages already

## Changelog

[INTERNAL] - Reduce flakyness by not downloading extra packages

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

Test Plan: Will wait for a green CI

Reviewed By: cipolleschi

Differential Revision: D43080349

Pulled By: cortinico

fbshipit-source-id: 6527c5ad129f47d8b5f02bf207e1af67a095afa1
2023-02-07 07:22:30 -08:00
Raouf f6a4e4f20f update `asdf-vm` setup to use `$ASDF_DIR` to work if user defined custom directory (#36043)
Summary:
Update setup of sourcing `asdf-vm` in `find-node-for-xcode.sh` in case of user has custom defined of `$ASDF_DIR`
by default `$ASDF_DIR` point to `$HOME/.asdf`, but if user has custom directory (like XDG convention) this script wont work without this change.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[GENERAL] [CHANGED] - Find node binary when using asdf as the node version manager with custom `$ASDF_DIR`

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

Test Plan: use a defualt/custom `$ASDF_DIR` while using `asdf-vm` as node version manager then make iOS build.

Reviewed By: cortinico

Differential Revision: D42990407

Pulled By: cipolleschi

fbshipit-source-id: 1fe3fdc786bddf741ff422e7bec55a6c9cc8ed83
2023-02-07 07:00:14 -08:00
Birkir Gudjonsson 0a4dcb0309 Add Appearance.setColorScheme support (#35989)
Summary:
Both Android and iOS allow you to set application specific user interface style, which is useful for applications that support both light and dark mode.

With the newly added `Appearance.setColorScheme`, you can natively manage the application's user interface style rather than keeping that preference in JavaScript. The benefit is that native dialogs like alert, keyboard, action sheets and more will also be affected by this change.

Implemented using Android X [AppCompatDelegate.setDefaultNightMode](https://developer.android.com/reference/androidx/appcompat/app/AppCompatDelegate#setDefaultNightMode(int)) and iOS 13+ [overrideUserInterfaceStyle](https://developer.apple.com/documentation/uikit/uiview/3238086-overrideuserinterfacestyle?language=objc)

## Changelog

[GENERAL] [ADDED] - Added `setColorScheme` to `Appearance` module

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

Test Plan:
This is a void function so testing is rather limited.

```tsx
// Lets assume a given device is set to **dark** mode.

Appearance.getColorScheme(); // `dark`

// Set the app's user interface to `light`
Appearance.setColorScheme('light');

Appearance.getColorScheme(); // `light`

// Set the app's user interface to `unspecified`
Appearance.setColorScheme(null);

Appearance.getColorScheme() // `dark`
 ```

Reviewed By: NickGerleman

Differential Revision: D42801094

Pulled By: jacdebug

fbshipit-source-id: ede810fe9ee98f313fd3fbbb16b60c84ef8c7204
2023-02-07 06:23:39 -08:00
Xun Sun 9af3c9654a switch from `@types/jest` to `@jest/globals` (#36068)
Summary:
Originally proposed in https://github.com/react-native-community/discussions-and-proposals/discussions/592

Main changes are:
- Explicitly importing the global APIs in `App.test.tsx`
- Drop `types/jest` from the devDependency list

Benefits of these changes will be:
- Keep in line with Jest's recommended practice
- Remove a dev-dependency to make dependencies slimmer

References:
- https://github.com/facebook/jest/pull/13133
- https://github.com/DefinitelyTyped/DefinitelyTyped/pull/62037

## Changelog

[GENERAL] [CHANGED] - Switch from `types/jest` to `jest/globals` for new react-native projects

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

Test Plan:
1. Create a new RN project from the modified template
2. Ensure yarn test passes
3. Ensure IDEs do not complain about `App.test.tsx`

Reviewed By: cipolleschi

Differential Revision: D43080151

Pulled By: cortinico

fbshipit-source-id: c9161cb930c78f3a1eaa08ccb6483aa38d52fa3c
2023-02-07 06:16:07 -08:00
Lorenzo Sciandra 7adf6b1e63 fix(script): handle patch versions after the .0 for set version (#36020)
Summary:
A small backport to main of a local fix done in 0.71 to account for the logic for releases 0.Y.1,2,3-prerelease (meaning, not just strictly 0).

I could have done like the other logics and just remove the check for patch, but decided to at least make sure it's a digit 😅

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[INTERNAL] [FIXED] - handle patch versions after the .0 for set version

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

Test Plan: Tested in 0.71-stable, without it we can't test RNTestProject.

Reviewed By: jacdebug, cortinico

Differential Revision: D42924375

Pulled By: cipolleschi

fbshipit-source-id: b003d884cc45a2602adbc14fa8b66d3f1e0c94a6
2023-02-07 03:45:17 -08:00
Janic Duplessis ecf967a51d Add fabric support for maintainVisibleContentPosition on iOS (#35319)
Summary:
This adds support for the `maintainVisibleContentPosition` in iOS fabric. This was previously only implemented in the old renderer. The implementation is very similar to what we currently have.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[iOS] [Added] - Add fabric support for maintainVisibleContentPosition on iOS

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

Test Plan:
Test in RN tester example.

https://user-images.githubusercontent.com/2677334/201484543-f7944e34-6cb7-48d6-aa28-e2a7ccdfa666.mov

Reviewed By: sammy-SC

Differential Revision: D41273822

Pulled By: jacdebug

fbshipit-source-id: 7900898f28280ff01619a4af609d2a37437c7240
2023-02-07 02:54:06 -08:00
Nick Gerleman 0daf83ac51 Reconnect VirtualizedList Source History 2/2 (Apply D41745930 + history, D42805202, D43063551)
Summary:
This change re-applies D41745930 (2e3dbe9c2f) (and D42805202 (1479b2ac26) which was also partially reverted), re-registers additions as moves, then applies D43063551 which has been added to the changes since migration.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D43068114

fbshipit-source-id: 72997700bf9962d82a988599481e255b69e68a9b
2023-02-06 20:00:19 -08:00
Nick Gerleman ebaa00e327 Reconnect VirtualizedList Source History 1/2 (Revert D41745930)
Summary:
This change reverts D41745930 (2e3dbe9c2f) as part of a stack to splice back source history which was lost (Git registered the file moves as additions).

It is expected this diff will individually fail. The entire stack should be applied at once.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D43068113

fbshipit-source-id: c8398629fe5dcc1ca4bf02f550adc00c78a8487a
2023-02-06 20:00:19 -08:00
Xin Chen d9f2491a71 Fix edge case when layout animation caused delete and create mutations in the same batch
Summary:
This is a two step (2/2) fix to a race that could caused a DELETE...CREATE mutations being sent over to the fabric mounting layer. Such combination was assumed not possible from the differ (https://fburl.com/code/kg8z9t4w), yet it happened at least in the existence of layout animation and when certain commits happen while animation is active.

This diff fixes all potential races in the Fabric mounting layer directly. It captures all the `DELETE...CREATE` combinations and stop those from passing down to the native platforms. This should fix all such races should them not captured by the fix in the layout animation.

To help understand other races better, I also logged here to indicate such race so that future crashes will have more context.

Changelog:
[General][Fixed] - Fix edge case when layout animation caused delete and create mutations in the same batch

Reviewed By: javache

Differential Revision: D41900201

fbshipit-source-id: 280502ca32ce87a9e483cd859b11bcd3e5c4a435
2023-02-06 19:12:46 -08:00
hoxy 5b8faae2ae fix: re-export SectionBase & ScrollToLocationParamsType from virtualized-lists package
Summary:
Changelog: [Internal]

- Fixes `flow-stable`
build-break
overriding_review_checks_triggers_an_audit_and_retroactive_review

Differential Revision: https://internalfb.com/D43063551

fbshipit-source-id: b7a92669fa41e8fc69370a2d9e809ce2559dd600
2023-02-06 15:56:14 -08:00
Ruslan Lesiutin 1479b2ac26 refactor(arvr/xplat): update imports to resolve packaged virtualized list from react-native (#36035)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36035

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D42805202

fbshipit-source-id: 1f1d6e36ec6e19a1b46ce340be095bb60b8048f4
2023-02-06 13:39:13 -08:00
Gabriel Donadel Dall'Agnol 2e3dbe9c2f feat: Move virtualized lists to @react-native/virtualized-lists (#35406)
Summary:
This PR moves `VirtualizedList`, `VirtualizedSectionList`, and its files to a separate package called `react-native/virtualized-lists` located under `packages/virtualized-lists` as proposed on https://github.com/facebook/react-native/issues/35263

## Changelog

[General] [Changed] - Move virtualized lists to react-native/virtualized-lists package

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

Test Plan:
1. Open the RNTester app and navigate to `FlatList` or `SectionList` page
2. Test virtualized lists through the many sections

https://user-images.githubusercontent.com/11707729/202878843-2b1322f5-cfee-484e-aaf3-d8d4dc0b96cc.mov

Reviewed By: cipolleschi

Differential Revision: D41745930

Pulled By: hoxyq

fbshipit-source-id: d3d33896801fd69448c6893b86fd5c2363144fd0
2023-02-06 13:39:13 -08:00
Blake Friedman 62fa6d9dac ci: Add `Type: Expo` label action (#36069)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36069

This PR adds a github action to auto closes an issue labelled with `Type: Expo`.

Changelog:

[Internal][Added] - Support `Type: Expo` label action

Reviewed By: cortinico

Differential Revision: D43041449

fbshipit-source-id: 8ac29487b172acd5798c8c36f5ef89cf60e69d04
2023-02-06 08:18:54 -08:00
Julien Brayere 98009ad94b fix: fix virtualizedList scrollToEnd for 0 items (#36067)
Summary:
Fixes https://github.com/facebook/react-native/issues/36066

## Changelog

[GENERAL] [FIXED] - VirtualizedList scrollToEnd with no data

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

Test Plan: Run `yarn test VirtualizedList-test`

Reviewed By: jacdebug

Differential Revision: D43041763

Pulled By: javache

fbshipit-source-id: d4d5e871284708a89bf9911d82e9aa97d7625aca
2023-02-06 08:05:59 -08:00
Riccardo Cipolleschi 34604fa8fd Back out "Restore scroll position when scroll view is hidden and shown"
Summary:
Backing out D42815359 (47903d0c62) as it caused [this](https://fb.workplace.com/groups/rn.support/permalink/24250950937860193/)

## Changelog:
[iOS][Changed] - Backout to prevent issue

Reviewed By: sammy-SC

Differential Revision: D43041078

fbshipit-source-id: 844764af15c37baee55c927501b8b293878df284
2023-02-06 06:55:52 -08:00
Gaurav ROy 011ea3306f fix(35280): added a fix to trigger on viewable items changed when null or 0 is passed in first element (#36009)
Summary:
Since currently the check was for null , and that too not === check. So added a check , only for item !== undefined, since null is an assigned value, and we can have null as values in the array for flatlist,
 undefined is in absence of any data, hence if its only undefined we should assign falsy to frame variable, since null is an assigned value, sometimes null can be passed to data in the dataset

 Hence added a check on top of Sam's previous commit to fix it

 UPDATE:

 Now after discussing with NickGerleman , removed the check for item with nullish/undefined.
 Now directly frames value is being controlled by _keyExtractor function

 This is already an issue [https://github.com/facebook/react-native/issues/35280](url)

Currently in my project, even [0,1] -> didnt trigger onViewableItemsChanged since, it was considered as falsy value,
went to check the node modules code for flatlist, debugged this.
When pulled latest main branch, saw it was partially fixed , but for null as values it wasnt fixed. So added that check .

## Changelog

[General] [Fixed] Fix VirtualizedList onViewableItemsChanged won't trigger if first item in data  is null

```
const frame =
      item !== undefined ? this._frames[this._keyExtractor(item, index, props)]
        : undefined;
```

      in place of existing which is

```
const frame =
      item != null ? this._frames[this._keyExtractor(item, index, props)]
        : undefined;
```

Update:

`const frame = this._frames[this._keyExtractor(item, index, props)]`

Finally this is the one used for getting frames value

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

Test Plan:
Checked out in my local , wrt changes , will share video if required

Update:
After the new changes too, checked in local, working fine

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

Reviewed By: NickGerleman

Differential Revision: D42934757

Pulled By: skinsshark

fbshipit-source-id: cb5622a79523bccbdfbc15470baf84422f635b33
2023-02-06 00:56:53 -08:00
Saad Najmi 7f2dd1d49c Pull out CGContext early in UIImage+Diff (#35940)
Summary:
This is a small refactor designed to make future merges for React Native macOS easier. It was found while merging React Native 0.71 into React Native macOS.

In React Native macOS, we ifdef iOS  out API's and replace them with macOS APIs, reusing as much code as possible. `CGContext` is a type that is available on both iOS and macOS, but `UIGraphicsImageRendererContext` is not. A simple refactor makes it easier to reuse this code in React Native macOS without affecting iOS :)

Resolves https://github.com/microsoft/react-native-macos/issues/1676

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[IOS] [CHANGED] - Pull out CGContext early in UIImage+Diff

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

Test Plan: Build should pass.

Reviewed By: matrush

Differential Revision: D42761424

Pulled By: javache

fbshipit-source-id: 5ce79a5e7c60484dd37d0b2c3f58ff0897d662df
2023-02-05 06:49:08 -08:00
Evan Yeung 11ece22fc6 Deploy 0.199.1 to xplat
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D42982746

fbshipit-source-id: b45980db2d7204eee9bee9918eafdd810d147579
2023-02-03 14:25:53 -08:00
rj1 7fedd7577a fixed typo in interface.js (#36049)
Summary:
fixed a typo in interface.js

## Changelog

[GENERAL] [FIXED] - Fixed a typo in interface.js

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

Test Plan: simple typo fix - no testing required

Reviewed By: cortinico

Differential Revision: D42996797

Pulled By: cipolleschi

fbshipit-source-id: 8a5a5f28174f874c530549743019c281732d2da4
2023-02-03 08:12:29 -08:00
Ruslan Shestopalyuk 82a7968d09 Remove duplication of default field values in iterator-based prop parsing (#36051)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36051

[Changelog][Internal]

This has been on my backlog for some time, submitting the diff to get it out of the way.

It makes the macro-based code in the "iterator-based property parsing" branch somewhat less horrible and less error prone (by removing duplication vs the default values in the class declaration).

Reviewed By: sammy-SC

Differential Revision: D42990595

fbshipit-source-id: e4b91160c6e09d3d1eab2ba70a58d390243bb335
2023-02-03 05:54:47 -08:00
Vitali Zaidman 39bdb34178 Parse and collect enum members in turbo module specs (#36044)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36044

> **Notice**: This commit does not change any behaviour.

Parse and collect enum members in module specs instead of the current behaviour of parsing enum members as 'string' / 'number' and ignoring the member names.

This commit would allow us to generate native Enums corresponding to the schema's enums.

Prior to this commit, enum params were parsed as:
```
                {
                  'name': 'qualityParam',
                  'optional': false,
                  'typeAnnotation': {
                    'type': 'EnumDeclaration',
                    'memberType': 'StringTypeAnnotation'
                  }
                },
```

The name of the enum type and the members of the enum type were ignored.

After this commit, parsed modules would hold a new object member called `enumMap` that would look like this:
```

      'enumMap': {
        'QualityEnum': {
          'name': 'QualityEnum',
          'type': 'EnumDeclarationWithMembers',
          'memberType': 'StringTypeAnnotation',
          'members': [
            {
              'name': 'SD',
              'value': 'sd'
            },
            {
              'name': 'HD',
              'value': 'hd'
            }
          ]
        },
        // ...
      }
```
And enum params would be exported as:
```
	        {
                  'name': 'qualityParam',
                  'optional': false,
                  'typeAnnotation': {
                    'name': 'NativeModuleEnumTypeAnnotation',
                    'type': 'EnumDeclaration',
                    'memberType': 'StringTypeAnnotation'
                  }
                },
```

Combining the two new outputs would allow us to generate Native enums in the Native generators.

Changelog: [Internal] Parse and collect enum members in turbo module specs

Reviewed By: cipolleschi

Differential Revision: D42778258

fbshipit-source-id: 56479342e085bc4e13c5a3e12b265b140e49893c
2023-02-03 03:03:41 -08:00
Vitali Zaidman 53c9786b71 remove 'EnumDeclaration' as a type expected to throw error in module generators
Summary:
Handling of `EnumDeclaration` was introduced in D38967241 (745f3ee8c5) so it is no longer a type expected to fail generators.

Changelog: [Internal] remove 'EnumDeclaration' as a type expected to throw error in module generators

Reviewed By: cipolleschi

Differential Revision: D42917947

fbshipit-source-id: 16fcb915ccd42c613ca4d30b815d6365681f5fa1
2023-02-03 03:03:41 -08:00
Vitali Zaidman 209d019055 Added an e2e test fixture for Enums and .H+.C TM e2e snapshot tests
Summary:
* Added an e2e test fixture with all the supported enum variations
* Added H and C file TM generators to the TM e2e tests

Changelog: [Internal] Added an e2e test fixture for Enums and .H+.C TM e2e snapshot tests

Reviewed By: cipolleschi

Differential Revision: D42917330

fbshipit-source-id: 8e4adb86b6eb4e2b29a9e6d0cd6e4fd5b002ad1a
2023-02-03 03:03:41 -08:00
Vitali Zaidman 81d123c399 Allow using flow enums in the react-native repo (#923)
Summary:
X-link: https://github.com/facebook/metro/pull/923

Changelog: [Internal] Allow using flow enums in the react-native repo

Reviewed By: christophpurrer, yungsters

Differential Revision: D42924379

fbshipit-source-id: b4c720428668ed853a1acfff68d4927e87bd6bc5
2023-02-03 03:03:41 -08:00
Eric Rozell e1a1e6aa80 Revert D13866122: Fix negative value rounding issue for nodes across an axis
Differential Revision:
D13866122 (37171ec78f)

Original commit changeset: 4faf8a9efc86

Original Phabricator Diff: D13866122 (37171ec78f)

fbshipit-source-id: c11919fdd585f09b0422e8db55a8a3d66027676f
2023-02-02 14:04:12 -08:00
Evan Yeung 6bbf323d68 Back out "Deploy 0.199.0 to xplat"
Summary:
Original commit changeset: a0c046860d32

Original Phabricator Diff: D42952050 (f731151a90)

Changelog: [internal]

Reviewed By: samwgoldman

Differential Revision: D42972089

fbshipit-source-id: fe2b21d18e1a6a5a147a3ff6a4c0c7d5e6fc7226
2023-02-02 12:05:39 -08:00
Evan Yeung f731151a90 Deploy 0.199.0 to xplat
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D42952050

fbshipit-source-id: a0c046860d3229a40ee3bf7f9c8bbc56fd63dc01
2023-02-02 10:07:01 -08:00
Vitali Zaidman 69494a7b1f rename module exports from "aliases" to "aliasMap" (#36042)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36042

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

Use aliasMap both in parsers and generators instead of using aliasMap in half of the places and aliases in the other.

This would also allow us to introduce "enumMap" more easily in the next commit.

Changelog: [Internal] rename module exports from "aliases" to "aliasMap"

Reviewed By: christophpurrer, cipolleschi

Differential Revision: D42888752

fbshipit-source-id: cf1929fcebde994d07e5c6bda5ab71106d417b21
2023-02-02 09:58:01 -08:00
Fabrizio Cucci 2d37f25f29 Fix null pointer exception in JSPointerDispatcher
Summary:
Changelog: [Internal] Fix null pointer exception in JSPointerDispatcher

Small regression introduced in D42817315 (1e53f88b72).

Reviewed By: javache

Differential Revision: D42965308

fbshipit-source-id: c1c4e907605d792f4be05800eb17af26cfea2bac
2023-02-02 09:30:43 -08:00
Nicola Corti 147a1f6619 Add macro to detect circular dependencies on Cmake
Summary:
This is a prototype to add circular dependencies detection on CMake for ReactCommon and ReactAndroid.
It can be enabled per module and works as follows:

```
set(ALLOWED_HEADER_IMPORT_PATHS
        react/renderer/graphics
        react/debug)
check_for_circular_dependencies("${ALLOWED_HEADER_IMPORT_PATHS}")
```

The allowed header import path must be manually specified as libraries are exposing wrong header search paths (so can't be reused).
The CI will be red till the circular dependency on `graphics` is resolved.

Changelog:
[Internal] [Changed] - Add macro to detect circular dependencies on Cmake

Reviewed By: cipolleschi

Differential Revision: D42927036

fbshipit-source-id: b1393dfd43fd042e2ebf1d5b46b24bd9f5e20d58
2023-02-02 09:23:55 -08:00
Jonathan Maurice 37171ec78f Fix negative value rounding issue for nodes across an axis (#688)
Summary:
This fix issue https://github.com/facebook/yoga/issues/683 the rounding calculation is incorrect if a node is crossing an axis and it will shrink it's width/height on layout calculation.

The following test reproduce the issue :

```
TEST(YogaTest, node_shrink_on_axis)
{
  const YGConfigRef config = YGConfigNew();
  const YGNodeRef root = YGNodeNewWithConfig(config);
  const YGNodeRef child = YGNodeNewWithConfig(config);

  YGNodeInsertChild(root, child, 0);

  YGNodeStyleSetWidth(child, 10);
  YGNodeStyleSetHeight(child, 10);
  YGNodeStyleSetPosition(root, YGEdgeLeft, -0.75f);
  YGNodeStyleSetPosition(root, YGEdgeTop, -0.75f);

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  ASSERT_FLOAT_EQ(YGNodeLayoutGetWidth(child), 10);
  ASSERT_FLOAT_EQ(YGNodeLayoutGetHeight(child), 10);

  YGNodeFreeRecursive(root);

  YGConfigFree(config);
}
```

X-link: https://github.com/facebook/yoga/pull/688

Reviewed By: NickGerleman

Differential Revision: D13866122

Pulled By: rozele

fbshipit-source-id: 4faf8a9efc86723c303f600d730660a2e13d8a73
2023-02-02 07:50:12 -08:00
Nicola Corti 5647d79dc9 RNGP - Bump AGP to 7.4.1 (#36039)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36039

This change bumps AGP to 7.4.1 so we can remove a lot of the unnecessary changes
we had to do to support AGP 7.3.x

I've also removed the explicit version in the template as now the AGP version
is provided by RNGP. That means that the user will get the correct version they need.

This also bumps the default CMake version in user space to 3.22 which resolves a lot
of warning when users are building with the New Architecture enabled.

Changelog:
[Android] [Changed] - Bump AGP to 7.4.1

allow-large-files

Reviewed By: cipolleschi

Differential Revision: D42960353

fbshipit-source-id: 9065f975c1694d266a86b2d3fe805e6e2b1c4aa1
2023-02-02 07:07:45 -08:00
Lulu Wu 6d45e49dc7 Align creation of FabricUIManager with bridge
Summary:
- Bridgeless is using a deprecated FabricUIManager constructor which bridge doesn't use, and is the only one using it, this diff migrated bridgeless to use the same FabricUIManager constructor as bridge
- Remove static view config check (mShouldDeallocateEventDispatcher), instead use Bridgeless check since SVC is enabled in Bridgeless but not in Bridge.

Changelog:
[Android][Changed] - Align creation of FabricUIManager with bridge

Reviewed By: javache

Differential Revision: D42681489

fbshipit-source-id: b9c7c4a81a98db52e881138cc85be0e85df636d9
2023-02-02 05:35:47 -08:00
Luna Wei 1e53f88b72 PointerEvents: Account for root view exits
Summary:
Changelog: [Internal] Support hovering in/out of root views

Prior to this change, we did not have signal when an input device moved out of the root view and so our internal state would not be aware and we would not trigger enter/leave events.

This diff starts listening to `HOVER_EXIT` events as dispatched from `onInterceptHoverEvent` and assumes that's the right event to signal a cursor has moved out of the root view. We dispatch the relevant leave events for this case and update our internal state to ensure the next `HOVER_MOVE` in our rootview, will properly dispatch the enter events.

## Investigation for creating this diff

Determining the signal for when an inputDevice enters/exits our rootview wasn't straight-forward.

From my understanding Android event dispatching follows a similar capture, bubbling phase as web. With `onIntercept..` handlers to swallow events. See this explanation: https://suragch.medium.com/how-touch-events-are-delivered-in-android-eee3b607b038 and this video talk: https://youtu.be/EZAoJU-nUyI?t=929

However when trying to understand hover enter/exit events on the root view, my understanding of this logic broke down.

Here's what confused me:
* When moving a cursor from inside to outside the root view, I would receive `HOVER_ENTER/EXIT` MotionEvents on `onInterceptHoverEvent` and since we did not swallow them, we'd receive those same events on the bubble up in `onHover`. That makes sense.
* However, when I hovered from the rootview into a child view, I would receive MotionEvents of `HOVER_ENTER/HOVER_EXIT` in the `onHoverEvent` handler of the rootview without having seen them in the `onInterceptHoverEvent` (re: capture phase down). This was confusing, where was the capture down?
* What tips me off that these events (`HOVER_ENTER/EXIT`) don't follow the classic capture, bubbling model as explained in the linked article, is that I don't receive `HOVER_ENTER/HOVER_EXIT` events for each child view in the root view's `onInterceptHoverEvent`.
   * Like when a cursor moves from root -> child, I'd expect to motion events 1. exit for the rootview, 2. enter for the child view. But I never receive the 2. from the root view --
   * I also wonder if the wording for `HOVER_EXIT` events mean that these events are directly dispatched to the view? Re: ["This action is always delivered to the window or view that was previously under the pointer."](https://developer.android.com/reference/android/view/MotionEvent#ACTION_HOVER_ENTER)
* There also seems to be some optimizations around the dispatch path as mentioned in this video at this timestamp: https://youtu.be/EZAoJU-nUyI?t=929 for the UP gesture.. so maybe there's some optimization happening with hover events? I'm not sure how hover events are account for in gesture handling for Android.

Reviewed By: vincentriemer

Differential Revision: D42817315

fbshipit-source-id: 412c971c1d1e7afc0d67fadcc4417189967fe48c
2023-02-01 23:52:16 -08:00
eps1lon a0800ffc7a Add `borderCurve` and `pointerEvents` to `ViewStyle` (#35998)
Summary:
Forward-porting https://github.com/DefinitelyTyped/DefinitelyTyped/pull/64125

## Changelog

[GENERAL] [FIXED] - Add `borderCurve` and `pointerEvents` to `ViewStyle`

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

Test Plan: - [x] https://github.com/DefinitelyTyped/DefinitelyTyped/pull/64125 green

Reviewed By: christophpurrer

Differential Revision: D42906357

Pulled By: lunaleaps

fbshipit-source-id: 6a5763cf7880888462fbabe1a00e560065c9a551
2023-02-01 12:20:40 -08:00
Lorenzo Sciandra 95b995270a add 0.71.2 changelog (#36032)
Summary:
Adds changelog for new patch.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Changed] - add changelog entry for 0.71.2

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

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D42928179

Pulled By: cipolleschi

fbshipit-source-id: 1eb7b399e58c6e78a6961dc98198fb747df5ceb3
2023-02-01 10:04:51 -08:00