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

26248 Коммитов

Автор SHA1 Сообщение Дата
Sim Sun 92a705b0e0 deps(android): bump soloader to 0.10.5 (#35569)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35569

SoLoader should not be used on Android 7+ unless the app is delivered as [Exopackage](https://buck.build/article/exopackage.html), requires [Android Native Library Merging](https://engineering.fb.com/2018/01/23/android/android-native-library-merging/) or uses [Superpack](https://engineering.fb.com/2021/09/13/core-data/superpack/) compression.
The 0.10.5 soloader would direclty use system linker on Android 7+ by default.

you can change this behavior via adding below meta-data in app's manifest file
```
<application ...>
    <meta-data
        tools:replace="android:value"
        android:name="com.facebook.soloader.enabled"
        android:value="true" />
</application>
```
## Changelog

[Android] [Changed] - Bump Soloader to 0.10.5

https://github.com/facebook/SoLoader/compare/v0.10.4...v0.10.5

Reviewed By: cortinico

Differential Revision: D41691125

fbshipit-source-id: 7d63b090de66bc42c0b473b4bf85eb65442549dd
2022-12-05 11:51:56 -08:00
Pieter De Baets 56b10a8351 Support colors for AnimatedInterpolation on iOS
Summary:
Color support for AnimatedInterpolation was incomplete with native drivers, as only rgba type strings were supported. There was also an issue where color props instead a StyleAnimatedNode would never get applied. We were also potentially duplicating color parsing support, which is already centralized in normalizeColor / processColor.

Changelog: [iOS][Added] Enable AnimatedInterpolation to interpolate arbitrary color types.

Reviewed By: philIip

Differential Revision: D41649337

fbshipit-source-id: 505ba555b6a79113635fdfb35c6fe69c92d82234
2022-12-05 08:24:54 -08:00
Alec Winograd 36cc71ab36 Prevent native blob resource from being de-allocated prematurely (#31392)
Summary:
This PR prevents blob data from being prematurely de-allocated in native code when using slice to create views into an existing blob. Currently, whenever a new blob is created via createFromOptions, BlobManager.js creates a new blobCollector object since options.__collector is never provided.

dc80b2dcb5/Libraries/Blob/BlobManager.js (L115-L123)

When the reference to a blobCollector is garbage collected, the corresponding native memory for the blob data is de-allocated.

27651720b4/Libraries/Blob/RCTBlobCollector.mm (L19-L25)

Since, `blob.slice()` is supposed to create a new view onto the same binary data as the original blob, we need to re-use the same collector object when slicing so that it is not GC'd until the last reference to the binary data is no longer reachable. Currently, since each blob slice gets a new blobCollector object, the memory is de-allocated when the first blob is GC'd.

Fixes https://github.com/facebook/react-native/issues/29970
Fixes https://github.com/facebook/react-native/issues/27857

## 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] - Blob data is no longer prematurely deallocated when using blob.slice

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

Test Plan: I could use help coming up with a test plan here. I could add a referential equality check for the blob.data.__collector in `Blob-test` but it doesn't seem quite right to be testing the implementation detail there.

Reviewed By: javache

Differential Revision: D41730782

Pulled By: cortinico

fbshipit-source-id: 5671ae2c69908f4c9acb5d203ba198b41b421294
2022-12-05 07:22:49 -08:00
Blake Friedman 9c75871a81 Fix abnormal close JS exception
Summary:
D40660765 (3982a2c6bd) introduced extra logging for abnormal closes. The websocked 'close' event may not be called with the event argument.

Changelog: [Internal] - Fix for undefined websocket close

Reviewed By: jacdebug, cortinico

Differential Revision: D41731339

fbshipit-source-id: 92b28dcc0d55d0e9e32b4f4321f325fb3471edcd
2022-12-05 06:26:09 -08:00
Neil Mitchell bdb2fd6979 Add support for Buck oncall annotations (#35562)
Summary:
Newer versions of Buck (not released open source) support an `oncall` annotation to denote who owns a particular BUCK file. These annotations are useful to support so that if BUCK files are updated with such annotations they don't break.

## Changelog

[Internal] [Changed] - support oncall annotation in BUCK files

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

Test Plan: The `test_buck` CI job validates that the file can be evaluated by open-source Buck. I ran this on a CircleCI fork, and it passed.

Reviewed By: motiz88

Differential Revision: D41731925

Pulled By: cortinico

fbshipit-source-id: 7d0ae164c3e6289d4aa76892658d46bbe4faf99c
2022-12-05 06:12:46 -08:00
David Angulo 032bed45a9 remove hermes note (#35555)
Summary:
This note was added when upgrading from 0.69x to 0.70.x when `hermes_enabled` is explicitly set to `true`.

<img width="669" alt="Screenshot 2022-12-05 at 11 26 15" src="https://user-images.githubusercontent.com/36528176/205543104-b4a72c1c-57c0-422b-881e-8a0cb9d5c2a1.png">

But on 0.71, we are now using  `get_default_flags` again which makes the note obsolete.

## Changelog

[Internal] [Removed] - removed hermes note

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

Test Plan: N/A

Reviewed By: dmytrorykun

Differential Revision: D41731004

Pulled By: cortinico

fbshipit-source-id: d5f377062bf94fa73bc6e73d1f108e37ad68c715
2022-12-05 05:02:39 -08:00
Nicola Corti d4a9bdc40e Remove the react.gradle file as it's unused (#35539)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35539

This file is unused now that we rely on RNGP. We should be able to remove it
in the next stable release 0.72. In 0.71 we shipped it with a removal warning,
and users should not rely on it anymore.

Changelog:
[Android] [Removed] - Remove the react.gradle file as it's unused

Reviewed By: rshest

Differential Revision: D41655709

fbshipit-source-id: 20860da5e596d35738eea5748c791d3d923dc4fb
2022-12-05 03:43:02 -08:00
Nicola Corti 7933dd78da Remove .mk prebuilt file and .mk file generation from codegen (#35540)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35540

We now don't need to generate .mk files anymore, therefore I'm removing
this logic from the codegen. In RN 0.72 users should be fully migrated
to CMake.

Changelog:
[Android] [Removed] - Remove .mk prebuilt file and .mk file generation from codegen

Reviewed By: rshest

Differential Revision: D41654122

fbshipit-source-id: 3a3c01fa8ab4d48460338e1a9ce2ecbd6df25f47
2022-12-05 03:27:37 -08:00
Pieter De Baets 322a796cba Ignore disable_infer_precompiled_header in OSS BUCK
Summary:
A codemod landed which broke our public CI as it added
disable_infer_precompiled_header which is not known to Buck OSS. This ignores the argument like we do for other internal parameter types.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D41729615

fbshipit-source-id: 30601d793b15cca3164d0513882da94064b47996
2022-12-05 03:01:05 -08:00
Lorenzo Sciandra e509007f57 fix(internal, dangerfile): fix changelog entries for dangerfiles and PR template (#35541)
Summary:
A few days back leotm pointed out how the dangerfile was disaligned with the docs around the valid changelog entries for categories and types here: https://github.com/facebook/react-native/pull/35443#issuecomment-1327449113

I dug a bit deeper into the whole thing and went to the source of truth, which is the changelog generator, in particular here: https://github.com/microsoft/rnx-kit/blob/main/incubator/rn-changelog-generator/src/utils/getChangeDimensions.ts

So I've updated the dangerfile to respect the options listed there. Also did a parallel PR on the website side: https://github.com/facebook/react-native-website/pull/3447

So now all comms will be aligned.

## 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] [FIXED] - fix changelog entries for dangerfiles and PR template

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

Test Plan: N/A

Reviewed By: sammy-SC

Differential Revision: D41686913

Pulled By: cortinico

fbshipit-source-id: 2297b4a3209188bda4a609b60860de35c5e7e6df
2022-12-05 02:38:42 -08:00
Nick Gerleman 1d4396c9d7 Re-enable Text Test Using New Style Prop
Summary:
D41708199 (3e91415696) updated `deprecated-react-native-prop-types` so we should be able to re-enable this test, which I previously disabled as part of making RN tests fail on `console.error()`/`console.warn()` (i.e. any test unintentionally creating a redbox/yellowbox).

Changelog:
[Internal]

Reviewed By: yungsters

Differential Revision: D41724052

fbshipit-source-id: 4e91809940c4bf9bde416367326167598a4d1354
2022-12-04 23:06:46 -08:00
Ruslan Latypov 2e2cd302f1 fix missing imports and set disable_infer_precompiled_header]
Reviewed By: adamjernst

Differential Revision: D41704378

fbshipit-source-id: 92bcbc8710e75e6eccfb252986ebd7b5f8645ba6
2022-12-04 13:30:16 -08:00
Gabriel Donadel Dall'Agnol ea9e78d426 feat: Extract case Array and ReadOnlyArray into a single emitArrayType function (#35546)
Summary:
This PR extracts the content of the codegen case `'Array'` and `'ReadOnlyArray'` into a single `emitArrayType` function inside the `parsers-primitives.js` file and uses it in both Flow and TypeScript parsers as requested on https://github.com/facebook/react-native/issues/34872. This also adds unit tests to the new `emitArrayType` function.

## Changelog

[Internal] [Changed]  - Extract the content of the case 'Array' and 'ReadOnlyArray'  into a single emitArrayType function

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

Test Plan:
Run `yarn jest react-native-codegen` and ensure CI is green

![image](https://user-images.githubusercontent.com/11707729/205375599-3bbf02bf-85b5-41e6-ae77-fc6e12bee538.png)

Reviewed By: christophpurrer

Differential Revision: D41700084

Pulled By: rshest

fbshipit-source-id: 4bfd2d3ab3f1343bb401ba9c278dc0e0e1ea0989
2022-12-03 14:18:46 -08:00
Tim Yung 3e91415696 RN: Upgrade to deprecated-react-native-prop-types@3.0.1 (#35549)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35549

Upgrades `react-native` to the newly published `deprecated-react-native-prop-types@3.0.1`, which brings prop-types compatibility up-to-speed with React Native 0.71. (This **is** a release blocker for 0.71.)

Changelog:
[General][Changed] Updated Prop Types for 0.71: https://github.com/facebook/react-native-deprecated-modules/blob/main/deprecated-react-native-prop-types/CHANGELOG.md

Reviewed By: rickhanlonii

Differential Revision: D41708199

fbshipit-source-id: 0cbcf294753203d5a35c8602d5585c5f2b604c6e
2022-12-03 09:27:39 -08:00
Ruslan Shestopalyuk cb552f62f2 Create NativePerformance C++ module
Summary:
[Changelog][Internal]

The NativePerformance module functionality corresponds to the [timing extensions of the Performance API standard interface](https://www.w3.org/TR/user-timing/#extensions-performance-interface).

As this is logically separate from `PerformanceObserver` (which may exist without it), it makes sense to have it as a different native module, so there is no coupling between both.

Reviewed By: christophpurrer

Differential Revision: D41690145

fbshipit-source-id: 7443f4c51f54cc2fdddbdb2e89f9a1fa457ab280
2022-12-03 08:32:58 -08:00
Ruslan Shestopalyuk 1c7e678e08 Handle the case when PerformanceObserver.observe is called multiple times
Summary:
[Changelog][Internal]
Addresses the corresponding TODO in code, to make sure that PerformanceObserver.observe may be called multiple times with different entry types to observe.

Reviewed By: christophpurrer

Differential Revision: D41686237

fbshipit-source-id: 4287f63f7e71e5b1056d30ed616149841ba4f892
2022-12-02 17:23:58 -08:00
Ruslan Shestopalyuk 862a99c491 Use NativePerformanceObserver.popPendingEntries instead of getPendingEntries
Summary:
[Changelog][Internal]

The name corresponds more precisely to what the method does.

Reviewed By: christophpurrer

Differential Revision: D41686205

fbshipit-source-id: 36c47b57fdeb757515cd14b890f38247f7fe8d02
2022-12-02 17:23:58 -08:00
Sam Zhou 3905fd4bd7 Annotate implicit instantiation in xplat
Summary: Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D41662414

fbshipit-source-id: 763cde4ecc19ae2407cd9cf13557248544d2e0d1
2022-12-02 12:26:04 -08:00
Ruslan Shestopalyuk dfbb63996a Don't use public fields in PerformanceObserver API
Summary:
[Changelog][Internal]

A follow up to the [discussion](https://www.internalfb.com/diff/D41496082 (14e69db482)?dst_version_fbid=831443041436872&transaction_fbid=1281583632681733) in D41496082 (14e69db482), this gets rid of the non-private fields in the `PerformanceObserver` - both to prevent abuse and better conform to the standard.

Reviewed By: rubennorte

Differential Revision: D41683363

fbshipit-source-id: 1fc98ff77e0bcdbf66c2a768e8b27a726831f106
2022-12-02 11:17:27 -08:00
Pieter De Baets 1452a55845 Remove RCTViewConfigEventValidAttributesDisabled
Summary:
Changelog: [Internal]

Codemod-bot already hardcoded this to false a while back, so cleaning up the code related to it.

Reviewed By: RSNara

Differential Revision: D41615378

fbshipit-source-id: 7b62b20b8e25f0a06d207b2457d6caf9ad5c695e
2022-12-02 09:08:16 -08:00
Blake Friedman d9666962f7 Fix test_windows by caching choco deps (#35399)
Summary:
A flakey CDN is 404'ing the Java dep.  Caching the Choco dependencies should stop this.

## Changelog

[Internal] [Fixed] - Cache Choco dependencies to stop erratic 404s on Java 8 install.

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

Test Plan: Bump the PR to see if it's caching.

Reviewed By: huntie

Differential Revision: D41684462

Pulled By: blakef

fbshipit-source-id: f3eac9e8a00be33f7c3f0996f35abb63146cb3c4
2022-12-02 07:32:30 -08:00
itxch 436da18fce feat(ios): allow for custom project dir in react-native-xcode script (#35449)
Summary:
The `react-native-xcode` script assumes the that `node_modules` folder are in the same location as the react native project. This adds the ability to declare `CUSTOM_DIR` in `.xcode.env` file to let react-native-xcode know where the react native project is located - required for monorepos

## Issue
At the moment if a project is not using the default react native file structure then when trying to create a build or archive using Xcode it will fail, with the following error:

> File /Users/itxch/Library/Developer/Xcode/DerivedData/app-evgjukoxhuupzzdglopjnhcntvpw/Build/Intermediates.noindex/ArchiveIntermediates/jungul/BuildProductsPath/Release-iphoneos/app.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues

## Background
My project is a monorepo, using `npm` workspaces.

#### This is the relevant file structure
![files](https://user-images.githubusercontent.com/54910400/203641210-596ee866-9f9f-429c-8bae-62d0f3afc623.png)

This file structure is incompatible with line 63 of `react-native-xcode.sh`

c5a8425fad/scripts/react-native-xcode.sh (L63)
Note: `$REACT_NATIVE_DIR` is the `react-native` package directory inside node modules.

So by default this sets project root to be the parent folder of the `node_modules` folder. However in my case this is not correct, it should actually be:
```sh
PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../../app"}
```

## Solution
Seeing as hardcoding the value would not work, the simplest solution is to set the directory via a variable
```sh
PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../../$CUSTOM_DIR"}
```
`$CUSTOM_DIR` can easily be set via `.xcode.env` file.

## Changelog
[IOS] [Added] - allow for custom project dir in react-native-xcode script

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

Test Plan:
After updating my `.xcode.env` file to include `export CUSTOM_DIR=app`, I can successfully create a build or an archive.
If the variable is not set it will be black, so it will not effect `$PROJECT_ROOT`

Reviewed By: GijsWeterings

Differential Revision: D41529396

Pulled By: cortinico

fbshipit-source-id: 890e9867e31f83a08561df8c2de1069e771726fc
2022-12-02 04:09:48 -08:00
Tommy Nguyen 4df793f75b Don't use the internal `native_modules.rb` script yet (#35531)
Summary:
Revert the template `Podfile` to using `react-native-community/cli-platform-ios/native_modules`. The new internal script currently has a hard-coded path to `react-native-community/cli-platform-ios` which may not work in monorepos. The path in the `Podfile` is also hard-coded, but this is a file that the user has access to and can fix themselves if necessary.

## Changelog

[iOS] [Fixed] - Don't use the internal `native_modules.rb` script yet, as it hides a hard-coded path

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

Test Plan: n/a

Reviewed By: rshest

Differential Revision: D41682119

Pulled By: cortinico

fbshipit-source-id: 1822fcd20a794dc9df6e8d6f36615e90b42c1a94
2022-12-02 04:09:02 -08:00
Pranav Yadav 363a6d253d chore: untrack stack dumps; `*.stackdump` (#35530)
Summary:
- Untracking StackDump files through `.gitignore`
- Most of the programs like shell (bash) **_crashes_** it generates **_StackDump_**; `*.stackdump` file(s)
- Such files are only for low level debugging purpose and _shouldn't be tracked_
- PS: When using integrated terminals on IDEs it's common to have these files especially on Win m/c :)

## Changelog

[Internal] [Changed] - Untracking Stack Dumps; `*.stackdump` files

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

Test Plan: - [NO-CODE] Diff

Reviewed By: rshest

Differential Revision: D41653070

Pulled By: cortinico

fbshipit-source-id: 0727feb66daa286d077743a451643970555e9c20
2022-12-02 04:04:51 -08:00
fabriziobertoglio1987 759056b499 Override default Talkback automatic content grouping and generate a custom contentDescription (#33690)
Summary:
The Implementation of the functionality consists of:

1) Checking that an element has no contentDescription and no text and has other content to announce (role, state, etc.) which causes this issue (for ex. the accessibilityRole is announced before the contentDescription for ex. "Button, My text children component")
2) If Talkback finds no content to announce on the current node, a custom contentDescription is generated from the child elements that respect the following conditions:

>If an AccessibilityNodeInfo is considered "actionable" (which Talkback defines as having clickable=true, longClickable=true, or focusable=true, or having AccessibilityActions for any of those), AND it has some content to read like a contentDescription or text, it will be considered focusable.
>If an AccessibilityNodeInfo is considered "actionable" AND it does not have content to read like a contentDescription or text Talkback will parse descendant elements looking for non-focusable descendants to use as content.

3) implementation of a method getTalkbackDescription to generate the above contentDescription from child elements
4) over-ride parent contentDescription (accessibilityLabel) with the value returned from getTalkbackDescription

Related [notes on Android: Role description is announced before the components text, rather than after https://github.com/facebook/react-native/issues/31042][51]. This issue fixes [https://github.com/facebook/react-native/issues/31042][50].

## Changelog

[Android] [Added] - Override default Talkback automatic content grouping and generate a custom contentDescription

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

Test Plan:
**PR Branch**
[1]. Screenreader correctly announcing accessible/non-accessible items ([link][1])
[2]. Screenreader announces Pressability items ([link][2])
[3]. Button role is announced after child contentDescription with TouchableNativeFeedback ([link][3])
[4]. Testing for regressions in Accessibility Actions ([link][4])
[5]. Screenreader focuses on ScrollView Items ([link][5])
[6]. Recordings of complete test cases in rn-tester app main and pr branch ([link][6])
[9]. TouchableOpacity with TextInput child announces contentDescription before the Role ([link][9])
[10]. One of the child has accessibilityState (hasStateDescription triggers the announcement) ([link][10])
[11]. One of the child has accessibilityHint (hasText triggers the announcement) ([link][11])

**Main**
[15]. The View does not announce the child component Text when accessibilityLabel is missing (automatic content grouping) ([link][15])
[8]. TouchableOpacity with child EditText annouces placeholder text before and after the role ([link][8])

[1]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/14#issuecomment-1106375974 "Screenreader correctly announcing accessible/non-accessible items"
[2]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/14#issuecomment-1106213313 "Screenreader announces Pressability items"
[3]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/14#issuecomment-1109935139 "Button role is announced after child contentDescription"
[4]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/14#issuecomment-1110541392 "Testing for regressions in Accessibility Actions"
[5]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/14#issuecomment-1106012823 "Screenreader focuses on ScrollView Items"
[6]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/14#issuecomment-1111942775 "Recordings of complete test cases in rn-tester app main and pr branch"
[7]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/14#issuecomment-1139511589 "TouchableOpacity with child EditText annouces Button role before the child contentDescription"
[8]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/14#issuecomment-1140967225 "TouchableOpacity with child EditText annouces placholder text before and after the role"
[9]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/14#issuecomment-1140999648 "TouchableOpacity with TextInput child announces contentDescription before the Role"
[10]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/14#issuecomment-1149479950 "One of the child has accessibilityState (hasStateDescription triggers the announcement)"
[11]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/14#issuecomment-1149535215 "One of the child has accessibilityHint (hasText triggers the announcement)"

[15]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/14#issuecomment-1088680339 "The View does not announce the child component Text when accessibilityLabel is missing (automatic content grouping)"

[50]: https://github.com/facebook/react-native/issues/31042 "Android: Role description is announced before the components text, rather than after https://github.com/facebook/react-native/issues/31042"
[51]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/14 "notes on Android: Role description is announced before the components text, rather than after https://github.com/facebook/react-native/issues/31042"

Reviewed By: cipolleschi

Differential Revision: D39177512

Pulled By: blavalla

fbshipit-source-id: 6bd0fba9c347bc14b3839e903184c86d2bcab3d2
2022-12-01 21:32:04 -08:00
David Vacca fb84e092cf unique -> shared pointer in Component
Summary:
Refactor unique -> shared pointer in Component. This will be necessary in the next diffs of the stack

changelog: [intenal] internal

Differential Revision: D41629759

fbshipit-source-id: 335161c350692e25ac3443bd19675a89f9df60c4
2022-12-01 19:29:59 -08:00
Lorenzo Sciandra 7e17d26060 fix(scripts): remove leftover code for tmpPublishingFolder (#35528)
Summary:
When this was done ad43deca23 (most likely because the scripts folder is not type-checked) some references to this script were left lying around.

This PR takes care of it.

## 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] [Fixed] - remove leftover code for tmpPublishingFolder

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

Test Plan: Running  `yarn test-e2e-local` doesn't insta-fail.

Reviewed By: cortinico

Differential Revision: D41656151

Pulled By: GijsWeterings

fbshipit-source-id: 5fcf7fabce30076f90d92087a4f1e429903dfc0b
2022-12-01 16:38:42 -08:00
Nick Gerleman 59ee573527 Fix @react-native/eslint-config linting of jsx files
Summary:
`react-native/eslint-config` enables rules for TypeScript and `.js` files (as Flow), but seems to completely no-op if you have a `.jsx` file. Enabling it in an override leads to syntax errors because the config has not been enlightened on how to parse JSX.

This would normally happen if a config extended `plugin:react/recommended`, but we are already cutomizing the React plugin rules. So we instead just directly set `ecmaFeatures: {jsx: true}` as reccomended by https://github.com/jsx-eslint/eslint-plugin-react.

Changelog:
[General][Breaking] - Fix react-native/eslint-config linting of jsx files

Reviewed By: rickhanlonii

Differential Revision: D41654962

fbshipit-source-id: 778da0928fadb86caa6a33254379d3d7dd394892
2022-12-01 12:10:46 -08:00
Genki Kondo 07c8854a1c Consolidate OkHttpClient creation
Summary:
Consolidates creation of OkHttpClients used by RN panel apps into PanelAppOkHttpClientProvider. This diff adds no functional changes; however, a followup diff will leverage this to add an Interceptor for overriding the network tier.

Changelog:
[Internal] - Enable passing in custom OkHttpClient to NetworkingModule

Reviewed By: rshest

Differential Revision: D41621244

fbshipit-source-id: 8954f9adc6a0cfdf6312678e2dbd6be8ef9aa5ca
2022-12-01 10:24:55 -08:00
Ruslan Shestopalyuk 14e69db482 Implement native logic for performance event reporting (#35526)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35526

[Changelog][Internal]

This closes the full loop according to the [technical design](https://fb.quip.com/MdqgAk1Eb2dV) of the WebPerf API implementation, with the main components and the working central data flow in place.

The next step is to add some buffering/throttling, as in this diff we just spawn an idle-priority task after every performance entry coming (even though they still naturally do come in batches, because they manage to accumulate before the task is executed).

Reviewed By: christophpurrer

Differential Revision: D41496082

fbshipit-source-id: 5fd4cf22e75806f7bc98d1d1b6691596ccadf8b9
2022-12-01 09:49:44 -08:00
Ruslan Shestopalyuk e2c4941c80 Add ability to schedule JS functions as tasks from turbo modules (#35525)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35525

[Changelog][Internal]

Adds ability to invoke an async JS callback from a C++ native module, as a task with priority.

This will allow native modules to schedule less important calls to JS thread with lower priority. One example use case is feeding collected perf metrics back to JS.

Reviewed By: javache

Differential Revision: D41492849

fbshipit-source-id: 12f738557972dc23398d9bb9a7a01125c79da070
2022-12-01 09:49:44 -08:00
Nick Gerleman 68d6214a18 Simplify Template ESLint Configuration (#35529)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35529

ESLint configuration is derived from `react-native/eslint-config`, which has supported Flow, vanilla JS, and TypeScript.

https://github.com/react-native-community/react-native-template-typescript/pull/238 and a related PR ended up adding new rules to the TypeScript config, to fix bugs with TS linting. It required a followup change, to specify the parser/plugin, and explicity reference them as devDependencies. https://github.com/react-native-community/react-native-template-typescript/pull/240

`react-native/eslint-config` already includes setting the plugin/parser. But overriding rules requires declaring that again, and directly referencing a plugin means a need for the app to declare dependencies, since ESLint resolves modules from the current config.

The rules overridedn were later fixed in `react-native/eslint-config`, which is really the right place for the fix (e.g. https://github.com/facebook/react-native/pull/32644). I noticed this when deriving from the TS template in https://github.com/facebook/react-native/pull/32644 and removed the rule overrides, but didn't have the historical context to realize this means we can then:
1. Remove the explicit parser/plugins since `react-native/eslint-config` already sets them, and we are no longer overriding any rules.
2. Remove the devDependencies, to let the versions be managed entirely by `react-native/eslint-config`.

Changelog:
[General][Changed] - Simplify Template ESLint Configuration

Reviewed By: cortinico

Differential Revision: D41652699

fbshipit-source-id: 8e3313dbf27407c5866f3c2432cffc2ecec1b01d
2022-12-01 09:28:16 -08:00
MaeIg ee8701e13e Move emitUnionTypeAnnotation into parsers-primitives (#35502)
Summary:
This PR aims to move  the emitUnionTypeAnnotation function into parsers-primitives.
It was extracted to parsers-commons in a task of https://github.com/facebook/react-native/issues/34872. But, all other emit* functions are in this file, so I think it was a mistake.

## 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] - Move emitUnionTypeAnnotation function into parsers-primitives

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

Test Plan:
yarn flow:
<img width="506" alt="image" src="https://user-images.githubusercontent.com/40902940/204494702-4a190d29-38bb-4da3-beb1-236f685ce671.png">

yarn lint:
<img width="261" alt="image" src="https://user-images.githubusercontent.com/40902940/204494798-3dfb0a8a-8535-455c-9483-ec17a7d8a710.png">

yarn test:
<img width="381" alt="image" src="https://user-images.githubusercontent.com/40902940/204494766-27fdaccc-f90d-4b77-b53b-2ff0d720c74e.png">

Reviewed By: rshest

Differential Revision: D41577409

Pulled By: cortinico

fbshipit-source-id: c37b85e8a53c2b1c2bb0e00bc772dd615d1269dd
2022-12-01 09:23:45 -08:00
Nicola Corti daefeb1c0b Ensure local hermes.tar.gz doesn't get stale between subsequent runs.
Summary:
On main, We download and store `hermes.tar.gz` locally during builds.
If another commit on the Hermes repo lands, Gradle might not re-download the hermes.tar.gz
file.

This commit fixes it by using `useETag` that allows us to use ETag that Github exposes
to understand if the tarball has been updated or not.

Changelog:
[Internal] [Changed] - Ensure local hermes.tar.gz doesn't get stale between subsequent runs.

Reviewed By: javache

Differential Revision: D41652865

fbshipit-source-id: 9f6e02957989acb02f419286c94b05df701c8a04
2022-12-01 08:56:56 -08:00
Thibault Malbranche dc3355920d chore: rename normalize-color to normalize-colors (umbrella 480) (#34571)
Summary:
## 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
-->

[General] [Changed] - Rename normalize-color to normalize-colors as part of https://github.com/react-native-community/discussions-and-proposals/pull/480

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

Reviewed By: cortinico

Differential Revision: D39235696

Pulled By: hoxyq

fbshipit-source-id: b6d5fcae9fb5c953c2f7b48f73a95cd883ff8f63
2022-12-01 08:46:57 -08:00
TatianaKapos 879d303fc7 Fix windows build of RectangleEdges (#35516)
Summary:
[PR: Avoid emitting mountitems for default values](56e9aa369f) used a constexpr in a template, which windows is unable to compile since type at this point is incomplete. Once removed, windows is able to build again. Let me know if there's a better way to fix this!

See [10072](https://github.com/microsoft/react-native-windows/issues/10072) for windows error messages

## 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
-->
[General] [Fixed] - Remove constexpr from RectangleEdges.h

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

Test Plan: Windows has forked this file and had the change for ~5 month, all tests pass on Windows side

Reviewed By: javache

Differential Revision: D41639514

Pulled By: rshest

fbshipit-source-id: fbe595f71a7ab0accb7a76edf58ffb6aeef1ae96
2022-12-01 07:43:59 -08:00
Nick Gerleman 217696ee17 Fail tests on `console.error()` or `console.warn()`
Summary:
This makes it so that React Native unit tests will fail if code unexpectedly outputs a warning or error (which would show as a redbox error).

This logic split out from the normal `jest/setup.js` which is included by the jest-preset, to only effect our tests instead of existing RN Jest users.

Changelog:
[Internal][Changed] - Fail tests on `console.error()` or `console.warn()`

Reviewed By: huntie

Differential Revision: D41564032

fbshipit-source-id: 3cc7d3a8433fcb75f654669b9c350dea2da937a8
2022-12-01 06:59:04 -08:00
Nicola Corti da4243b38d Properly expose `jscexecutor` as a prefab target (#35521)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35521

Inside RC3 the jscexecutor target was prepared for prefab consumption
but not properly exposed.
This was not caught by the CI as we're not effectively using this target,
but some of our popular libraries do (i.e. Reanimated). I'm exposing it here.

Changelog:
[Internal] [Changed] - Properly expose `jscexecutor` as a prefab target

Reviewed By: javache

Differential Revision: D41648349

fbshipit-source-id: 1a04bc21aa50eece304828ce1d99ae795a51af48
2022-12-01 04:25:22 -08:00
Ian Petersen 5f01622ab7 Fix Yoga's conditional use of std::bit_cast<>()
Summary:
Yoga tries to use `std::bit_cast<>()` where it's available and falls back to
`std::memcpy()` everywhere else.  Unfortunately, the feature-test macro
(`__cpp_lib_bit_cast`) is only defined if the feature is available *and you have
already included either `<version>` or `<bit>`* (or something else that includes
one of those).  Since `CompactValue.h` checks `__cpp_lib_bit_cast` *first*, it's
not defined even if it *would be*  defined, leading the header not to
`#include <bit>`, leaving `std::bit_cast<>()` undefined; later, other headers
from the STL are included, leading to `__cpp_lib_bit_cast` *becoming* defined
and causing later code to choose to use the undefind `std::bit_cast<>()`.

This diff fixes the problem by `#include`ing either `<version>` or `<ciso646>`
(depending on availability) before checking any feature-test macros.

Changelog: [Internal]

Reviewed By: smeenai

Differential Revision: D41641205

fbshipit-source-id: 7d7bc5791c902a45302d3707e6cbf21fc0493f0c
2022-12-01 02:30:57 -08:00
SlyCaptainFlint 46fe963c4e Move close-pr workflow from react-native-bot to actions/github-script@v6 (#35500)
Summary:
This change adds a new action and workflow that will run whenever a commit is pushed that closes a PR via its message. When this happens, the corresponding PR will be labeled with "Merged" and a comment will be added with the name of the committer and the sha of the commit that resolved the PR.
This is not new functionality - it merely replaces a portion of the react-native-bot's functionality with a GitHub action.

## Changelog

[Internal] [Changed] - Moved close PR actions to a GitHub action

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

Test Plan:
Tested the golden path here ("Merged" label and comment added): https://github.com/SlyCaptainFlint/react-native/pull/27
Tested the case where a PR already labeled with Merged was processed and no new comment was left on it (simulates the case where react-native-bot, which is still going to be running, got to the PR and processed it before the new GitHub action did): https://github.com/SlyCaptainFlint/react-native/pull/26

Reviewed By: cipolleschi

Differential Revision: D41567047

Pulled By: SlyCaptainFlint

fbshipit-source-id: 23745a17950b75c1a8f25f0b840c2172332c4cfa
2022-11-30 20:52:46 -08:00
Rob Hogan 3e19c97646 Bump remaining build-time Babel deps
Summary:
Update `babel/*` dependencies specifying `^7.x.y` where `x > 0` to the latest available semver minor, and corresponding superficial snapshot updates reflecting a small decrease in JS bundle size.

 - `babel/core` to `^7.20.0`
 - `babel/parser` to `^7.20.0`
 - `babel/preset-env` to `^7.20.0`
 - `babel/traverse` to `^7.20.0`
 - `babel/cli` to `^7.19.0`
 - `babel/eslint-parser` to `^7.19.0`
 - `babel/preset-flow` to `^7.18.0`
 - `babel/preset-syntax-flow` to `^7.18.0`
 - Deduplicate / refresh others to take in patch updates

Changelog: [Internal] Bump Babel dependencies to latest 7.x

Reviewed By: JoeyMou

Differential Revision: D41449678

fbshipit-source-id: f04fe837a7961c4e2dde45fed59fcd138c2f8723
2022-11-30 19:16:23 -08:00
Di Chen de7a323f6b Revert D40632443: Support colors for AnimatedInterpolation on iOS
Differential Revision:
D40632443 (6003e70e84)

Original commit changeset: 4dfb29edca4b

Original Phabricator Diff: D40632443 (6003e70e84)

fbshipit-source-id: 0718fbd18c3a7a06e116d9926d40d8d9a75ed4cd
2022-11-30 14:45:07 -08:00
Xin Chen 0569f6500e Clean up unnecessary lambda function for preallocate after D40403682
Summary: `dispatchPreallocationInBackground_` is removed and we don't need to use the lambda function anymore.

Reviewed By: javache

Differential Revision: D41574447

fbshipit-source-id: 9c2b8a067fb86b75320b338e3f8c7989315f9b8b
2022-11-30 14:24:34 -08:00
fortmarek 3c5a8290ae Rename `assets` to `assets-registry` (#34572)
Summary:
Part of the [monorepo RFC](04671deebe/proposals/0006-react-native-monorepo.md)

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

[General] [Changed] - Rename assets to assets-registry

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

Reviewed By: cortinico

Differential Revision: D39235817

Pulled By: hoxyq

fbshipit-source-id: ff4d4a7ff980d3fc6e28b83ad3b36250eba79fc3
2022-11-30 12:25:02 -08:00
Pieter De Baets 6003e70e84 Support colors for AnimatedInterpolation on iOS
Summary:
Color support for AnimatedInterpolation was incomplete with native drivers, as only rgba type strings were supported. There was also an issue where color props instead a StyleAnimatedNode would never get applied. We were also potentially duplicating color parsing support, which is already centralized in normalizeColor / processColor.

Changelog: [iOS][Added] Enable AnimatedInterpolation to interpolate arbitrary color types.

Reviewed By: sammy-SC

Differential Revision: D40632443

fbshipit-source-id: 4dfb29edca4b919474408b43c3917ac9406a147a
2022-11-30 10:19:12 -08:00
Pieter De Baets e7dbfb2dbd Support colors in AnimatedInterpolation on Android
Summary:
Color support for AnimatedInterpolation was incomplete with native drivers, as only rgba type strings were supported. There was also an issue where color props instead a StyleAnimatedNode would never get applied. We were also potentially duplicating color parsing support, which is already centralized in `normalizeColor` / `processColor`.

Changelog: [Android][Added] Enable AnimatedInterpolation to interpolate arbitrary color types.

Reviewed By: mdvacca

Differential Revision: D40571873

fbshipit-source-id: 41857ab0391279c5307bc31b855ea8fbcb4cccd8
2022-11-30 10:19:12 -08:00
Pieter De Baets b589123a3d Rewrite AnimatedInterpolation JS driver support for colors
Summary:
Restructured the JS implementation of AnimatedInterpolation to make it clearer how colors and other string-based interpolatables are supported. We're then able to use a very similar structure to implement this interpolation on the native driver as well, which simplifies implementation, and improves support for different color types.

Changelog: [General][Fixed] Improved support for AnimatedInterpolation of color props.

Reviewed By: mdvacca

Differential Revision: D40571890

fbshipit-source-id: 7c204a7b736722732dc5f9e0d158ef5af81b4bb1
2022-11-30 10:19:12 -08:00
Ruslan Shestopalyuk a64319a2b2 Add API and scaffolding for Performance.mark implementation
Summary:
[Changelog][Internal]

Adds API definition for [Performance.mark](https://www.w3.org/TR/user-timing/#mark-method) support.

This is a bare bone implementation, that just logs events on the native side. The next step is the native logic for queuing, flushing etc.

Note that here I route both JS and native marks to native for now, for simplicity sake - ultimately this may not be what we want,  as it may be more efficient to process marks, logged from JS, on the JS side.

Reviewed By: rubennorte

Differential Revision: D41472148

fbshipit-source-id: bdf2b182b8472a71a5500235849bca5af1c2f360
2022-11-30 09:28:53 -08:00
Kwasow 2db26c548b Fixed typo in ReactCommon/buffer/map.h (#34631)
Summary:
Fixed a typo inside ReactCommon.

## Changelog

[General] [Fixed] - Fixed typo in comment

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

Test Plan: _This change does not require testing._

Reviewed By: cortinico

Differential Revision: D39382191

Pulled By: cipolleschi

fbshipit-source-id: 73939daaaa6199992019e74fe67d638176c8b58d
2022-11-30 06:55:21 -08:00
Pranav Yadav 5a20bd5b10 refactor: mv `translateArrayTypeAnnotation` (Flow,TS) fns > `parsers-primitives.js` (#35479)
Summary:
This PR is a subtask of https://github.com/facebook/react-native/issues/34872
Moved `translateArrayTypeAnnotation` (Flow,TS) fns to `parsers-primitives.js`
- combined `Flow` and `TS` `translateArrayTypeAnnotation` fn 's into common fn
- moved it to `parsers-primitives.js`
- re-organized imports and exports :)

## Changelog

[Internal] [Changed] - Moved `translateArrayTypeAnnotation` (Flow,TS) fns to `parsers-primitives.js`

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

Test Plan:
- ensure 👇 is `#00ff00`
`yarn lint && yarn flow && yarn test-ci`

Reviewed By: cipolleschi

Differential Revision: D41548046

Pulled By: GijsWeterings

fbshipit-source-id: 8fd7214f8b1e669ba42f326f814674eec179fed5
2022-11-30 04:53:34 -08:00