Commit Graph

12270 Commits

Author SHA1 Message Date
Gijs Weterings 6991db0dab add copyright header to BlobRegistry-test.js
Summary:
Every file in the react-native-github repo should have the right copyright header. This was missed for this file.

Changelog: Internal

Reviewed By: rubennorte

Differential Revision: D50319271

fbshipit-source-id: 77c20fa4d3679eb5573ce61fd1c9cba60386ee21
2023-10-16 04:03:16 -07:00
Filipp Mikheev 9497203957 Android: fix ClassCastException in ReactRootView.java when software keyboard is shown (#40755)
Summary:
Fixes https://github.com/facebook/react-native/issues/40754

Hi all!
We noticed that our app started to crash after bumping to RN v0.71.13, anyways after a deeper investigation we also found that the crash occurs in the latest version as well.

Crash log:
```
E  FATAL EXCEPTION: main
Process: com.nfl.fantasy.core.android.debug, PID: 6034
java.lang.ClassCastException: android.app.ContextImpl cannot be cast to android.app.Activity
at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.getActivity(ReactRootView.java:926)
at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.checkForKeyboardEvents(ReactRootView.java:946)
at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.onGlobalLayout(ReactRootView.java:912)
at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:1061)
```
The code which causes ClassCastException is following [here](https://github.com/facebook/react-native/blob/ea88fbe229e1d276753ee8e118184274fc872138/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java#L864).
In this code explicit type conversion to Activity is not safe because it's not guaranteed by the compiler that context will be compatible with Activity type.
The appropriate issue [has been filed](https://github.com/facebook/react-native/issues/40754).

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

[ANDROID] [FIXED] - Fixed crash occurring in certain native views when keyboard events are fired.

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

Test Plan:
Tested it manually with the [reference application](https://github.com/kot331107/rnCrashReproducer).  Repro steps are as follows:

- Build and run the app on Android
- Tap the button "Open Modal"
- You should see the red popup fragment to the bottom of the screen
- Tap on the text input to open software keyboard
- Expected: it should show the keyboard and no crash happens.

Reviewed By: arushikesarwani94

Differential Revision: D50198424

Pulled By: NickGerleman

fbshipit-source-id: a5a6d86334856f4ffbe818150da5793380da4702
2023-10-14 01:10:48 -07:00
Yicheng (Jerry) Gong b21cf6f3c0 Revert D50229030: Align directory name for normalize-colors
Differential Revision:
D50229030

Original commit changeset: 63854140bf61

Original Phabricator Diff: D50229030

fbshipit-source-id: 56e5dc564374dcf72500fcdd4ae4e47ceeda1120
2023-10-13 20:04:13 -07:00
Arushi Kesarwani 60af812d9b Back out "Replace RAIICallbackWrapperDestroyer with AsyncCallback" (#40951)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40951

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D50287045

fbshipit-source-id: be1a5dc2b2cc0b278d82323ed5db0b9cfdff2adc
2023-10-13 19:03:00 -07:00
Arushi Kesarwani 289aa10192 Back out "Use AsyncCallback in RCTTurboModule" (#40950)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40950

Original commit changeset: 289f2d5ef622

Original Phabricator Diff: D49862756

Changelog: [Internal]

Reviewed By: christophpurrer, javache

Differential Revision: D50281714

fbshipit-source-id: f16a312684f9b895752c29b66458bdcdda7b3fa6
2023-10-13 19:03:00 -07:00
Ramanpreet Nara 04852fd6fc Interop example: Make argument to getRootTag deterministic (#40947)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40947

This shows up as this.context shows up as 1 sometimes. Let's just hard-code this to 11, to make the test more reliable.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D50253990

fbshipit-source-id: 1da75e5e5f3226676f9af67fc329a70079eed59e
2023-10-13 16:53:38 -07:00
Nicola Corti a030224d1b Make sure template is consuming the right buildToolsVersion - Take 2 (#40938)
Summary:
Currently, the template has a `buildToolsVersion = '34.0.0'` specified in the top level .gradle file but it's not currently using it.

This is causing the build to fallback to the default version provided by AGP which is 33.x
This is also causing the CI to download buildtools 34.0.0 as they're not in the container (causing network flakyness).

## Changelog:

[INTERNAL] [FIXED] - Make sure template is consuming the right buildToolsVersion

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

Test Plan: CI should be green

Reviewed By: cipolleschi

Differential Revision: D50270482

Pulled By: cortinico

fbshipit-source-id: 09fdc66fe24f1cae760d07e4a2f044793a66cafc
2023-10-13 10:54:50 -07:00
Alex Hunt c5abe1e9f0 Align directory name for normalize-colors (#40934)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40934

The previous `packages/normalize-color` directory name could be confusing, given we have previously published a `react-native/normalize-color` package in addition to the current `react-native/normalize-colors`. After this change, the directory name and `package.json` `"name"` field are aligned.

Changelog: [Internal]

Reviewed By: cortinico, NickGerleman

Differential Revision: D50229030

fbshipit-source-id: 63854140bf61d7d1d3f1270ed05a2ba76f8c5b0f
2023-10-13 10:11:21 -07:00
Nicola Corti ab3506e609 Make sure buildConfig is turned on for all the 3rd party libraries (#40939)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40939

Currently some libs on RN 0.73 are broken as the default for Build Config generation changed
from true to false since AGP 8.x. This reverts the behavior to the old flag.

Closes #40791
Closes #40559

Changelog:
[Internal] [Changed] - Make sure buildConfig is turned on for all the 3rd party libraries

Reviewed By: mdvacca

Differential Revision: D50270382

fbshipit-source-id: 02dcb031c577f65be2f41d9da0334c1b3d89e4c5
2023-10-13 10:07:10 -07:00
Rob Hogan f00594b262 Bump dependency on deprecated-react-native-prop-types (#40869)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40869

Bumps DRNPT to v5 - the significant change is that this one depends on `react-native/normalize-color: ^0.73.0`, instead of `*`, so is protected from future breaking changes to that package.

NOTE: We can't safely include `react-native/normalize-color: ^0.74.0` in the dependency range of DRNPT because `0.74.0` isn't a semver-compliant release (0.74 isn't cut yet), so this will pull 0.73.2 from NPM, which is fine.  We may need to publish DRNPT@6 if 0.74 final turns out to contain breaking changes (eg, a Node 20 bump).

Changelog:
[General][Fixed] Update `deprecated-react-native-prop-types` to remove fragile transitive `*` dependencies.

Reviewed By: huntie

Differential Revision: D50228564

fbshipit-source-id: 01aafafad40d9a93d00de2b5f45d2796620b9b5d
2023-10-13 08:24:09 -07:00
Pieter De Baets edb7332d6a Add BUCK targets for OSS hermes targets (#40933)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40933

This enables us to have lint coverage (and others) for these files. Visibility is none, so it won't be pulled in to anything.

Also removed no-op JSITracing implementation.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D50262377

fbshipit-source-id: 6218c7a79b5c0328bed8472590cff9e92006b86e
2023-10-13 07:18:19 -07:00
Eric Rozell 2d8797a7dd Deletes unused JNI props conversion utility (#40882)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40882

This header has not been used since facebook/react-native#110b191b landed, generalizing the way props map buffers are initialized.

# Changelog

[General][Internal]

Reviewed By: christophpurrer

Differential Revision: D50237390

fbshipit-source-id: f0f532c59c53b1df5d363cfd49f950697df37128
2023-10-13 06:45:40 -07:00
Eric Rozell 41123a3f0f Make some accessibility props optional (#40881)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40881

Some host platforms (e.g., Windows) may have different semantics for accessibility props. For example, not setting `accessibilityState` at all is different from setting all accessibilityState values to false.

Similarly, setting AccessibilityState::expanded to false is different than not setting AccessibilityState::expanded at all because Windows inverts the AccessibilityState::expanded value for it's semantics: an explicitly false value for AccessibilityState::expanded sets the component to a collapsed accessibility state.

## Changelog

[General][Internal]

Reviewed By: NickGerleman

Differential Revision: D50236747

fbshipit-source-id: 2131824d14e38e1ed08a80e8b0e311fc6b02d1f2
2023-10-13 06:45:40 -07:00
Eric Rozell c323dbbcbe Parse isPressable from BaseTextProps (#40880)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40880

The isPressable prop was previously added to TextAttributes. It also needs to be parsed from RawProps in BaseTextProps for platforms to use it.

## Changelog

[General][Internal]

Reviewed By: javache

Differential Revision: D50235306

fbshipit-source-id: 101aded2af5889c739ed06af7511bd34a2683dfc
2023-10-13 06:19:44 -07:00
Pieter De Baets 95d09d32fe Fix unsafe async call in CatalystInstance callback (#40861)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40861

Reference `jobj_` from the async callback is unsafe, as the Java counterpart may have been deallocated by the time it's executed. Instead move the async call to Java.

Note that this method doesn't actually do anything in Fabric, it's used by the old renderer only.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D50224974

fbshipit-source-id: c848b177753643febac1d6646d62a27ebace9238
2023-10-13 03:33:39 -07:00
Jakub Romanczyk 0e590c0993 refactor: use ESM exports in ReactNativeViewConfigRegistry (#27508) (#40787)
Summary:
## Summary

When transpiling `react-native` with `swc` this file caused some trouble
as it mixes ESM and CJS import/export syntax. This PR addresses this by
converting CJS exports to ESM exports. As
`ReactNativeViewConfigRegistry` is synced from `react` to `react-native`
repository, it's required to make the change here. I've also aligned the
mock of `ReactNativeViewConfigRegistry` to reflect current
implementation.

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

Test Plan: Sandcastle tests

Reviewed By: noahlemen

Differential Revision: D50229257

Pulled By: javache

fbshipit-source-id: 2e848a1ac434c45e219876c1042aacb42c77cb6f
2023-10-13 03:33:03 -07:00
Eric Rozell 3a26e55a79 Revert "Temporary hotfix for broken view flattening on Android" (#40885)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40885

We no longer need this hotfix since the native fix has been stable for some time now. Cleans up the feature flags and forced `collapsable={false}` prop in View.

## Changelog

[General][Internal]

Reviewed By: yungsters, NickGerleman

Differential Revision: D50241092

fbshipit-source-id: 57a3121356736bd6633e3672e6a8369067e45811
2023-10-12 19:36:48 -07:00
Joe Vilches 53279ba426 Fix issue where marginStart and marginEnd were not working with rowReverse flex direction (#40804)
Summary:
X-link: https://github.com/facebook/litho/pull/962

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

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

This stack is ultimately aiming to solve https://github.com/facebook/yoga/issues/1208

**The problem**
Turns out that we do not even check direction when determining which edge is the leading (start) and trailing (end) edges. This is not how web does it as the start/end is based on the writing direction NOT the flex direction: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flexible_box_layout/Basic_concepts_of_flexbox#start_and_end_lines. While web does not have marginStart and marginEnd, they do have margin-inline-start/end which relies on the writing mode to determine the "start"/"end": https://developer.mozilla.org/en-US/docs/Web/CSS/margin-inline-start.

This means that if you do something like
```
export default function Playground(props: Props): React.Node {
  return (
    <View style={styles.container}>
      <View style={styles.item} />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    marginEnd: 100,
    flexDirection: 'row-reverse',
    backgroundColor: 'red',
    display: 'flex',
    width: 100,
    height: 100,
  },
  item: {
    backgroundColor: 'blue',
    width: 10,
  },
});
```

You get  {F1116264350}
As you can see the margin gets applied to the left edge even thought the direction is ltr and it should be applied to the right edge.

**The solution**
I ended up fixing this by creating a new `leadingLayoutEdge` and `trailingLayoutEdge` function that take the flex direction as well as the direction. Based on the errata, the a few functions will use these new functions to determine which `YGEdge` is the starting/ending.

You might be wondering why I did not put this logic inside of `leadingEdge(flexDirection)` / `trailingEdge(flexDirection)` since other areas could potentially have the same bug like `getLeadingPadding`. These functions are a bit overloaded and there are cases where we actually want to use the flexDirection to get the edge in question. For example, many of the calls to `setLayoutPosition` in `CalculateLayout.cpp` call `leadingEdge()` / `trailingEdge()` to set the proper position for cases like row-reverse where items need to line up in a different direction.

Reviewed By: NickGerleman

Differential Revision: D50140503

fbshipit-source-id: 5b580c7570f6ae1e2d031971926ac4e8f52dd362
2023-10-12 16:22:27 -07:00
Joe Vilches 2dad663c28 Add errata for fix to marginStart/End for row-reverse flex direction (#40803)
Summary:
X-link: https://github.com/facebook/yoga/pull/1419

X-link: https://github.com/facebook/litho/pull/961

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

This stack is ultimately aiming to solve https://github.com/facebook/yoga/issues/1208

This adds an value to the Errata enum. I will use this to gate this fix as there is potential for users to rely on this bug or have a hack in place to fix it and this would be a breaking change.

Reviewed By: NickGerleman

Differential Revision: D50145273

fbshipit-source-id: 913d2103cd31c1fa94cb39fc15d05b0c0b255920
2023-10-12 16:22:27 -07:00
David Vacca bf4d10eade Document future deprecation of ReactContextBaseJavaModule (#40876)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40876

Document future deprecation of ReactContextBaseJavaModule

changelog: [internal] internal

Reviewed By: arushikesarwani94

Differential Revision: D50233131

fbshipit-source-id: ef81ff11ce6b58cde5f29d60d9b38de720e77abe
2023-10-12 15:10:26 -07:00
David Vacca e48d18f2cf Mark NativeModule and BaseJavaModule as Stable (#40878)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40878

Mark NativeModule and BaseJavaModule as Stable

changelog: [internal] internal

Reviewed By: arushikesarwani94

Differential Revision: D50233129

fbshipit-source-id: 8f02a0db56b11d7df3e83f5f85c3d104e72c9197
2023-10-12 15:10:26 -07:00
David Vacca 8bbf872a3c Mark BaseJavaModule.getConstants as DeprecatedInNewArchitecture (#40877)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40877

Mark BaseJavaModule.getConstants as DeprecatedInNewArchitecture

changelog: [internal] internal

Reviewed By: arushikesarwani94

Differential Revision: D50233130

fbshipit-source-id: da3794251f52773ca511b46990f48cdea9dbf4ae
2023-10-12 15:10:26 -07:00
David Vacca b8534e60fc Introduce StableReactNativeAPI annotation (#40879)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40879

Introduce StableReactNativeAPI annotation, the goal of this annotation is to describe classes, interfaces and members that are considered Stable and will remain part of the new architecture of React Native

changelog: [internal] internal

Reviewed By: arushikesarwani94

Differential Revision: D50195996

fbshipit-source-id: a64a27217a6fd885d2c188a6847565b3413bb232
2023-10-12 15:10:26 -07:00
David Vacca b9c50e268c Revert undeprecation of onCatalystInstanceDestroy (#40800)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40800

Revert undeprecation of onCatalystInstanceDestroy

revert of D50141027

changelog: [Android][Changed] Deprecated NativeModule.onCatalystInstanceDestroy

Reviewed By: christophpurrer

Differential Revision: D50195995

fbshipit-source-id: ccfa91e40db2c6b05e78d571ca94e609d1993fba
2023-10-12 15:10:26 -07:00
Sam Zhou a53b4a0a2b Make React.Element fully opaque (#40883)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40883

Changelog: [Internal]

Reviewed By: mvitousek

Differential Revision: D50198503

fbshipit-source-id: 47537aeefbc6cbdee8954ea1052ff3a4b4392744
2023-10-12 13:48:22 -07:00
Dmitry Rykun 02957718d7 SVC Codegen: Handle TSAsExpression when looking for the codegen declaration (#40860)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40860

This diff adds support for the `AS` expression in TS sources. The following codegen declaration should work now:
```
export default codegenNativeComponent<NativeProps>(
  'MyComponentView',
) as HostComponent<NativeProps>;
```
Changelog: [General][Added] - Handle TSAsExpression when looking for the codegen declaration

Reviewed By: shwanton

Differential Revision: D50225241

fbshipit-source-id: 247a3d341d742b548e82318d0fa21dff9884d2bd
2023-10-12 11:24:16 -07:00
Eric Rozell eef823b90c Adds isPressable native prop to TextAttributes (#40871)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40871

If we pass isPressable to the native props object (via TextAttributes), we can use this information to bypass hit testing on some spans. This is rather important on some platforms where pointerenter/pointerleave/ mousemove events force frequent hit testing.

## Changelog:

[General] [Internal]

Reviewed By: javache

Differential Revision: D50228473

fbshipit-source-id: 4fce85f4b18617fbe10d3c804e943484bf990664
2023-10-12 11:15:46 -07:00
Blake Friedman 067c989b48 make runtime reference thread safe on tickleJs call
Summary:
The reference to runtime assumes the queue will ensure references to runtime are valid when invoked. This
isn't the case if you create a breakpoint, Hermes hit that breakpoint and your refresh the app. This consistently
will crash the app.

The fix is to not assument this, similar to ReactCommon/react/runtime/hermes/HermesInstance.cpp

Reviewed By: javache

Differential Revision: D50225678

fbshipit-source-id: b45cae1f5f687bc8c699fd74b187376a547012c5
2023-10-12 10:09:55 -07:00
Sam Zhou 11d9b9cef0 Prepare to make React.Element fully opaque (#40798)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40798

Changelog: [Internal]

Reviewed By: sullenor

Differential Revision: D50194982

fbshipit-source-id: 21d2f86dd787952ceed9a4f862a3fcaa2b063349
2023-10-12 08:43:32 -07:00
Nicola Corti 6f1b8edc7a normalize-colors should not impose node >= 18
Summary:
I'm removing the node >= 18 restriction on react-native/normalize-colors as that's unnecessary
as is currently breaking the ecosystem for users on Node 16 on previous versions of React Native.

Changelog:
[General] [Fixed] - normalize-colors should not impose node >= 18

Reviewed By: robhogan

Differential Revision: D50215144

fbshipit-source-id: cdfb90f4274754ad5b04fa2cad339419d45bbcba
2023-10-12 05:26:14 -07:00
Alex Hunt 79ded77fcd Disable --experimental-debugger by default (#40795)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40795

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D50178494

fbshipit-source-id: b833b6accadd2902d97a45e030cd48d1b62ac438
2023-10-12 05:26:11 -07:00
Skander Ellouze 2be1c71cb7 refactor(image typing): use ImageRequireSource instead of number for defaultSource prop typing (#40801)
Summary:
This is just a type refactoring to make the typing of the `defaultSource` prop of the Image component more explicit and descriptive (using the `ImageRequireSource` type makes it more clear that we can use the require statement to set an image asset as default source) and this is also more consistent with the `source` prop typing.

Currently :
- The typing of default source is `ImageURISource | number | undefined`
- The typing of source is `ImageSourcePropType` which is equal to `ImageURISource  | ImageURISource[]  | ImageRequireSource` and `ImageRequireSource` is equal to `number`.

In this PR we change the typing of default source to `ImageURISource | ImageRequireSource | undefined` to make more clear that the number of the default source prop refers to the use of the require statement with an asset file.

## Changelog:
[GENERAL] [CHANGED] - use ImageRequireSource instead of number for the defaultSource prop typing of the Image component

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

Test Plan: No one required since it's a small typing refactoring.

Reviewed By: christophpurrer

Differential Revision: D50209922

Pulled By: NickGerleman

fbshipit-source-id: c25f3c6f145f357ff1cb0b1c7b54a19bf1dec824
2023-10-12 03:28:53 -07:00
Riccardo Cipolleschi 5217890df9 Back out "Make sure template is consuming the right buildToolsVersion" (#40854)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40854

This [commit](https://github.com/facebook/react-native/commit/a5d5ead1a474832a911c3a6e44b6d6450bca3fd6) seems to break all the Android template tests: [CircleCI](https://app.circleci.com/pipelines/github/facebook/react-native/34139/workflows/b203bbea-d3c4-45aa-9ce1-1ddde6d88bc0).

## Changelog:
[Android][Changed] - revert commit https://github.com/facebook/react-native/commit/a5d5ead1a474832a911c3a6e44b6d6450bca3fd6

## Facebook:
Original Phabricator Diff: D50019777

Reviewed By: sammy-SC

Differential Revision: D50217952

fbshipit-source-id: d9b93ad72f08cf9f04cacfc04ea9b418f8129079
2023-10-12 03:18:50 -07:00
Ramanpreet Nara de1fb8f7fd Sort object properties in interop test
Summary:
It looks like objects properties aren't guaranteed to have a stable order. Sort them, before we serializae and print them to the screen in the interop test. This should reduce interop test flakyness.

Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D50148860

fbshipit-source-id: a6ed1433d4dd35cafa5c9f7d09c4cca194c31d81
2023-10-11 19:03:01 -07:00
Pieter De Baets fb194788cb Use AsyncCallback in RCTTurboModule (#40792)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40792

Similarly to D49792717, simplify the careful logic we have with CallbackWrapper and RCTBlockGuard and instead rely on bridging's `AsyncCallback` so safely handle jsi::Function for us.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D49862756

fbshipit-source-id: 289f2d5ef622f47eb3fccf0cc7a52cc13a83b028
2023-10-11 11:22:28 -07:00
Pieter De Baets 8dd89cee1b Replace RAIICallbackWrapperDestroyer with AsyncCallback (#39952)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39952

AsyncCallback and SyncCallbacks are better primitives for jsi::Function handling. The code is simpler and requires less manual argument passing. See in D49684248 how the API was extended to support more use-cases.

Changelog: [General] Deprecated RAIICallbackWrapperDestroyer. Use AsyncCallback instead for safe jsi::Function memory ownership.

Reviewed By: RSNara

Differential Revision: D49792717

fbshipit-source-id: 9f2f3b00c71ad1b86427dee3749c6d98ef0f5678
2023-10-11 11:22:28 -07:00
Fabrizio Cucci ec3a137572 Fix UIManager Flow type (#40794)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40794

I accidentally stumbled upon the `UIManager` object on JS side and realised it was being exported as `any`. So I've extracted the interface `UIManagerJSInterface` and applied where it seems to make sense, although, after chatting with javache it could be useful to further narrow down the interface given what's currently implemented by the `BridgelessUIManager`.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D50137691

fbshipit-source-id: ccc746fa1dfbb3290e0b73dfa14c65833b238e07
2023-10-11 11:21:19 -07:00
Riccardo Cipolleschi d16793dbe0 Update publishing to Sonatype for double publishing (#40781)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40781

## Changelog:
[Internal] - Allow Sonatype to double publish SNAPSHOTS

Reviewed By: cortinico

Differential Revision: D49914824

fbshipit-source-id: 830e20eb51ffdf5b7c4452972c436ca0cb4da5a9
2023-10-11 10:09:57 -07:00
Nicola Corti a5d5ead1a4 Make sure template is consuming the right buildToolsVersion (#39956)
Summary:
Currently, the template has a `buildToolsVersion = '34.0.0'` specified in the top level .gradle file but it's not currently using it.

This is causing the build to fallback to the default version provided by AGP which is 33.x
This is also causing the CI to download buildtools 34.0.0 as they're not in the container (causing network flakyness).

I'm also bumping the docker container to v12 as we bumped NDK 26 which is missing in the v11 container.

## Changelog:

[INTERNAL] [FIXED] - Make sure template is consuming the right buildToolsVersion

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

Test Plan: CI should be green

Reviewed By: christophpurrer

Differential Revision: D50019777

Pulled By: cortinico

fbshipit-source-id: a2ab7a7bd7c55624d5c050b45e69086c5f25ba6a
2023-10-11 10:04:47 -07:00
Lulu Wu 4d70337fb5 Add ExceptionsManagerModule for RNTester (#40767)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40767

Fix the following issue:
```Invariant Violation: TurboModuleRegistry.getEnforcing(...):
'ExceptionsManager' could not be found. Verify that a module by this name is registered in the native
binary.Bridgeless mode: true. TurboModule interop: true. Modules loaded: {"NativeModules":[],"TurboModules":
["PlatformConstants","AppState","SourceCode","BlobModule","WebSocketModule","DevSettings","DevToolsSettingsManager","LogBox","Networking","Appearance","DevLoadingView","DeviceInfo","DeviceEventManager",
"SoundManager","ImageLoader","DialogManagerAndroid","NativeAnimatedModule","I18nManager","AccessibilityInfo","StatusBarManager","StatusBarManager","IntentAndroid","ToastAndroid","ShareModule","Vibration"],
"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","RedBox","BugReporting","HeadlessJsTaskSupport","FrameRateLogger","KeyboardObserver",
"AccessibilityManager","ModalManager","LinkingManager","ActionSheetManager","ExceptionsManager"]}
```

Changelog:
[Android][Changed] - Add Add ExceptionsManagerModule to CoreReactPackage

Reviewed By: cortinico

Differential Revision: D50017783

fbshipit-source-id: 8642bb23bdae50a1e702f5e0586b0ede80007bb1
2023-10-11 09:56:27 -07:00
Luis Miguel Alvarado 0004888608 refactor: don't include DevtoolsOverlay & TraceUpdateOverlay in the production bundle (#40749)
Summary:
Currently, when we build the app in production mode the `DevtoolsOverlay` & `TraceUpdateOverlay` are bundle

## Changelog:

[GENERAL][REMOVED]: removed `DevtoolsOverlay` & `TraceUpdateOverlay` from production bundle

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

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

Test Plan:
1. Build the app in production mode
2. Check that both `DevtoolsOverlay` & `TraceUpdateOverlay` are included in the bundle

Reviewed By: robhogan, NickGerleman

Differential Revision: D50121208

Pulled By: hoxyq

fbshipit-source-id: 3e1fb506c679ec79b116dea9772d372cd2ea9ca9
2023-10-11 09:54:22 -07:00
Krystof Woldrich cd78e39e2b feat(tm-android): TM SyncVoidKind methods throws JSError (#40788)
Summary:
Other RM Sync method calls do return JSError with the throwable information.

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

[ANDROID] [ADDED] - TM SyncVoidKind methods throws JSError

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

Test Plan:
Output of caught error `console.log(e, e.stack, e.cause);`

```js
 LOG  [Error: Exception in HostFunction: Intentional exception from JVM voidFuncThrows] Error: Exception in HostFunction: Intentional exception from JVM voidFuncThrows
    at voidFuncThrows (native)
    at voidFuncThrows (http://10.0.2.2:8081/js/examples/TurboModule/SampleTurboModuleExample.bundle//&platform=android&lazy=true&app=com.facebook.react.uiapp&modulesOnly=true&dev=true&minify=false&runModule=true&shallow=true:100:127)
    at onPress (http://10.0.2.2:8081/js/examples/TurboModule/SampleTurboModuleExample.bundle//&platform=android&lazy=true&app=com.facebook.react.uiapp&modulesOnly=true&dev=true&minify=false&runModule=true&shallow=true:235:71)
    at _performTransitionSideEffects (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:67991:22)
    at _receiveSignal (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:67941:45)
    at onResponderRelease (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:67784:34)
    at apply (native)
    at invokeGuardedCallbackProd (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:4727:21)
    at apply (native)
    at invokeGuardedCallback (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:4903:42)
    at apply (native)
    at invokeGuardedCallbackAndCatchFirstError (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:4917:36)
    at executeDispatch (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:4994:48)
    at executeDispatchesInOrder (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:5016:26)
    at executeDispatchesAndRelease (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7640:35)
    at executeDispatchesAndReleaseTopLevel (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7647:43)
    at forEach (native)
    at forEachAccumulated (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:5610:22)
    at runEventsInBatch (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7660:27)
    at runExtractedPluginEventsInBatch (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7693:25)
    at anonymous (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7734:42)
    at batchedUpdates$1 (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:20049:20)
    at batchedUpdates (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7616:36)
    at dispatchEvent (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7705:23)
{"message": "Intentional exception from JVM voidFuncThrows", "name": "java.lang.RuntimeException", "stackElements": [{"className": "com.facebook.fbreact.specs.SampleTurboModule", "fileName": "SampleTurboModule.java", "lineNumber": 186, "methodName": "voidFuncThrows"}, {"className": "com.facebook.jni.NativeRunnable", "fileName": "NativeRunnable.java", "lineNumber": -2, "methodName": "run"}, {"className": "android.os.Handler", "fileName": "Handler.java", "lineNumber": 958, "methodName": "handleCallback"}, {"className": "android.os.Handler", "fileName": "Handler.java", "lineNumber": 99, "methodName": "dispatchMessage"}, {"className": "com.facebook.react.bridge.queue.MessageQueueThreadHandler", "fileName": "MessageQueueThreadHandler.java", "lineNumber": 27, "methodName": "dispatchMessage"}, {"className": "android.os.Looper", "fileName": "Looper.java", "lineNumber": 205, "methodName": "loopOnce"}, {"className": "android.os.Looper", "fileName": "Looper.java", "lineNumber": 294, "methodName": "loop"}, {"className": "com.facebook.react.bridge.queue.MessageQueueThreadImpl$4", "fileName": "MessageQueueThreadImpl.java", "lineNumber": 234, "methodName": "run"}, {"className": "java.lang.Thread", "fileName": "Thread.java", "lineNumber": 1012, "methodName": "run"}]}
```

Reviewed By: cortinico

Differential Revision: D50169068

Pulled By: javache

fbshipit-source-id: 3a7b5e44fc69e3b8747b12c524c717904c4e808f
2023-10-11 09:12:53 -07:00
Ivan Alexandrov 265af222aa Fix android platform border color (#39893)
Summary:
If you try to apply PlatformColor to borders on Android app will crash with the next error:

"Error while updating property 'borderColor' of a view managed by: RCTView"

## Changelog:

[ANDROID] [FIXED] - Fix android crash when apply PlatformColor to borders

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

Test Plan:
In RNTester example, go to APIs -> PlatformColor
|    Before  | After |
| ----------- | ----------- |
|  <img src="https://github.com/facebook/react-native/assets/70860930/66ac2880-53da-4438-bd9a-332f8ea40645" alt="drawing" width="200"/>    | <img src="https://github.com/facebook/react-native/assets/70860930/151f58a1-d857-4b3d-9ec6-de74eb065127" alt="drawing" width="200"/>      |

Reviewed By: NickGerleman

Differential Revision: D50011758

Pulled By: javache

fbshipit-source-id: ea06c18c6aef4b6731e9b9b87422a1e0d13de208
2023-10-11 08:47:23 -07:00
Alex Hunt f40bb9331c Bump package versions for next major (#39764)
Summary:
#publish-packages-to-npm

Bump all package versions to `0.74.0` (next major release) for `main`, following instructions at https://reactnative.dev/contributing/release-branch-cut-and-rc0#12-bump-minor-version-of-all-monorepo-packages-in-main.

```sh
yarn bump-all-updated-packages --release-branch-cutoff
```

Changelog: [Internal]

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

Test Plan: —

Reviewed By: robhogan

Differential Revision: D49871039

Pulled By: huntie

fbshipit-source-id: f4df6efeae4d8a9209e7aae7b9e6fea3d15793b5
2023-10-11 08:36:23 -07:00
Kacper Kafara bc63e44b23 Purge children from view registry when UIManager is invalidated (#38617)
Summary:
Talking about Paper & iOS here.

In standard RN applications when a native component is removed permanently from view hierarchy [it is invalidated (if it implements `RCTInvalidating`)](https://github.com/facebook/react-native/blob/e64756ae5bb5c0607a4d97a134620fafcb132b3b/packages/react-native/React/Modules/RCTUIManager.m#L483-L495). Components that implement `RCTInvalidating` such as [`RNSScreenView`](https://github.com/software-mansion/react-native-screens/blob/9fb3bd00850bcdf29b46daa57e56eabda3ae30ea/ios/RNSScreen.mm#L35) of [`react-native-screens`](https://github.com/software-mansion/react-native-screens) library rely on `RCTInvalidating#invalidate` method being called in adequate moment to release retained resources (in my case the `RNSScreenView` holds a strong reference to it's view controller preventing it from being garbage collected).

However in case of brownfield applications (React Native is used only for a particular view & loaded on demand, see: https://github.com/software-mansion/react-native-screens/issues/1754 for discussion & app example) when view controller holding `RCTRootView` is dismissed and whole `React Native` managed view / controller tree gets deallocated, `RCTInvalidating#invalidate` method is not called on the dismissed components, thus in my particular use case, leading to memory leak.

Right now I've added call to `RCTUIManager#_purgeChildren:fromRegistry:` (which internally invalidates all components which implement `RCTInvalidating`) in `RCTUIManager#invalidate`.

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

[IOS][FIXED] - Purge children from view registry on `RCTUIManager` invalidation.

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

Test Plan:
You can run the [demo](https://github.com/mkondakov/RNSScreensMemoryLeak) provided in the [issue](https://github.com/software-mansion/react-native-screens/issues/1754).

Following screenshots show that memory leak in brownfield application is resolved.

Without the change (`invalidate` method is not being called on native components)

![image](https://github.com/facebook/react-native/assets/50801299/dac331c2-1e7c-4e66-a8c1-b88f7a007d9b)

With the change:

![image](https://github.com/facebook/react-native/assets/50801299/7a8afbe9-446c-47a2-a972-d7589b921677)

Reviewed By: NickGerleman

Differential Revision: D49952215

Pulled By: javache

fbshipit-source-id: 6336b86774615acc40279c97e6ae0bb777bda8ad
2023-10-11 07:31:57 -07:00
generatedunixname89002005325672 3859eee961 Daily arc lint --take KTFMT
Reviewed By: 0x1eaf

Differential Revision: D50164739

fbshipit-source-id: a3a03735eaea41d3e7e04a73b210c6347ebd078e
2023-10-11 06:05:17 -07:00
Riccardo Cipolleschi c279db78c4 Bump RNTester Cocoapods cache keys after SocketRocket 6.1.0 bump (#40789)
Summary:
Commit 8b88883071 broke the Cache for RNTester because the cached version of the pods does not know about the exitence of SocketRocket 6.1.0
Bumping the keys should force a redownload of the cocoapods specs repo

## Changelog:
[Internal] - Bump RNTester cache keys

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

Test Plan: CircleCI is green

Reviewed By: GijsWeterings

Differential Revision: D50169281

Pulled By: cipolleschi

fbshipit-source-id: 83e251495bfa43d62384470efe97c5505d76684f
2023-10-11 05:02:08 -07:00
Gabriel Donadel 8b88883071 Bump SocketRocket to 0.6.1 (#40774)
Summary:
The SocketRocket version was upgraded to 0.6.1 on the 0.72-stable branch but for some reason it was not updated in main, causing a downgrade when running `pod install` with 0.73.0 RC1

Original commit bumping SocketRocket -> https://github.com/facebook/react-native/commit/8ce471e2fa802cc50ff2d6ab346627cb5f6d79b4

## Changelog:

[IOS] [CHANGED] - Bump SocketRocket to 0.6.1

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

Test Plan: Run rntester locally

Reviewed By: cipolleschi

Differential Revision: D50137261

Pulled By: arushikesarwani94

fbshipit-source-id: dfc2760f5d5611881126ad114d8f6ada23630a29
2023-10-11 02:18:19 -07:00
Phillip Pan 9f51a0c59d hook up unstable_enableSyncVoidMethods to ReactFeatureFlags (#39988)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39988

Changelog: [Internal]

in this pr, we integrate the sync void configuration with our feature flag infra

Reviewed By: luluwu2032

Differential Revision: D50030743

fbshipit-source-id: 03505e5e1f74aa90dc16f33fa4e93f9de9660dae
2023-10-10 22:39:59 -07:00
Phillip Pan 2e16785424 introduce unstable_enableSyncVoidMethods config (#39989)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39989

Changelog: [Internal]

we need some configuration path to turn on the sync void method execution behavior, doing that here

Reviewed By: luluwu2032

Differential Revision: D50028200

fbshipit-source-id: a2501b622685e4bafa5e2a5031275cc8bc5050b7
2023-10-10 22:39:59 -07:00