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

24813 Коммитов

Автор SHA1 Сообщение Дата
Héctor Ramos 8b8d7324a6 Hermes: Warn user about longer pod install times when Hermes is enabled
Summary:
Adjust logs during `pod install` to warn user about longer install times due to Hermes compilation.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36143766

fbshipit-source-id: 0facb2e295543438dfbc46d11db1c4dc163acff9
2022-05-06 02:17:35 -07:00
Janic Duplessis 6ab7a99518 Pass react build dir to cmake (#33736)
Summary:
The ReactAndroid cmake build assumes that the build directory is ReactAndroid/build, but this is not always the case if gradle is configured with a different build location. Instead of assuming the build location in cmake, pass it from gradle.

## Changelog

[Android] [Fixed] - Pass react build dir to cmake

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

Test Plan:
Tested in an app with a custom build dir that RN now builds properly after this change.

In build.gradle add:

```groovy
allprojects {
    buildDir = "${System.getProperty("user.home")}/.gradle/builds/${rootProject.name}/${project.name}"
}
```

Reviewed By: christophpurrer

Differential Revision: D36128556

Pulled By: cortinico

fbshipit-source-id: cdb8283c93ea7c384ec94cd3e24012220965b6dc
2022-05-06 01:56:33 -07:00
Rick Hanlon 93b50be8c2 Replace use-subscripton with use-sync-external-store (#33770)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33770

React has replaced use-subscription with the React 18 compatible use-sync-external-store.

Changelog:
[General][Changed] - Replace use-subscripton with use-sync-external-store

Reviewed By: ryancat

Differential Revision: D35592432

fbshipit-source-id: cc2016f66940e53f3614e110bafb02240bae1ae4
2022-05-05 19:58:19 -07:00
Christoph Purrer e5469c48e3 Back out > Add CompositeReactPackageTurboModuleManagerDelegate
Summary:
This change caused some internal regression in release builds, hence reverting it

Changelog:
[Internal] [Changed] - Back out > Add CompositeReactPackageTurboModuleManagerDelegate

Reviewed By: alsun2001

Differential Revision: D36182014

fbshipit-source-id: e49fc897f3b1a2e9d33fcb7687244be74020c5be
2022-05-05 16:29:19 -07:00
Tim Yung 870755fa7e RN: Delete `EventEmitter#removeSubscription`
Summary:
Deletes `EventEmitter#removeSubscription`, which has been deprecated since D27704279 (cb6cbd12f8).

Relatedly, the `removeListener` family of methods (which were deprecated ad the same time) were recently removed by D35549719 (2596b2f695).

Changelog:
[General][Removed] - Removed `EventEmitter.prototype.removeSubscription` method.

Reviewed By: christophpurrer

Differential Revision: D36171048

fbshipit-source-id: 2409d235d43049cddfe0a54bcc60e1f47d4185c5
2022-05-05 12:55:00 -07:00
Moti Zilberman 018d5cf985 Remove nonstandard Promise.prototype.done implementation
Summary:
Changelog:
[General][Breaking] - Remove nonstandard Promise.prototype.done

`Promise.prototype.done` has been deprecated since D34222667 (35800962c1). Here we remove it from React Native's default Promise polyfill. Users should switch to using standard Promise features like `.then()`, or install their own custom polyfills for advanced use cases.

Reviewed By: kodafb

Differential Revision: D36001688

fbshipit-source-id: 37f452000c16279280ef6a50b2ce616776377c4e
2022-05-05 03:55:10 -07:00
George Zahariev 20d9d3aa6a Fixes to non-product code (e.g React Native)
Summary:
We are working on making the empty object literal `{}` have the type `{}` - i.e. exact empty object - rather than being unsealed.

Some manual fixes, in particular to React Native code, which is used and can be synced to other repos (e.g. WWW).

With these changes, error diff in Xplat is down to ~1990 errors

Note that after I roll out `exact_empty_objects`, I'll codemod all the `{...null}` (the only way to get an exact empty object currently) back to `{}`

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D36142838

fbshipit-source-id: 054caf370db230f42a4c5f5706c88979ef246537
2022-05-04 16:13:07 -07:00
Lulu Wu bf6884dc90 Remove assertion when current activity is null
Summary:
Assertion failure would lead to a crash, in real world not being able to start an activity shouldn't crash - usually a navigation won't happen as expected, user could try again.

Changelog:
[Android][Changed] - Don't assert on current activity when call startActivityForResult

Reviewed By: cortinico

Differential Revision: D35746652

fbshipit-source-id: 0b77ca5a69b2f3f3b0b969d84980ed8290ac9b1f
2022-05-04 15:52:47 -07:00
Sam Zhou 7e7cf24200 Add annotations to unannotated variable declarations
Summary: Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D36114983

fbshipit-source-id: 2622e13ba19a372592967670b7d615688c0e9fd6
2022-05-04 14:17:28 -07:00
Matin Zadeh Dolatabad 2596b2f695 fix: remove deprecated removeListener methods (#33580)
Summary:
Remove old deprecated modules that cause annoying warnings. This can be a breaking change for some third-party modules.

## Changelog

[General] [Removed] - Remove deprecated removeListener methods

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

Test Plan: See `flow-check` and `build-arvr-js-flow` succeed in Sandcastle.

Reviewed By: cortinico

Differential Revision: D35549719

Pulled By: yungsters

fbshipit-source-id: 0495e36de19db434362d5de56463d9c1ad6edd73
2022-05-04 11:32:51 -07:00
Christoph Purrer 7d037ddd6a Fix Circle CI for CompositeReactPackageTurboModuleManagerDelegate (#33758)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33758

This fails to compile in our CircleCI builds
```
/root/react-native/ReactAndroid/src/main/java/com/facebook/react/CompositeReactPackageTurboModuleManagerDelegate.java:52: error: incompatible types: java.util.List<java.lang.Object> cannot be converted to java.util.List<com.facebook.react.ReactPackage>
        delegates.add(delegatesBuilder.build(context, Collections.emptyList()));
```
Make the empty collection generic should solve the issue

Changelog:
[Internal] [Changed] - Fix Circle CI for CompositeReactPackageTurboModuleManagerDelegate

Reviewed By: cortinico, dmitryrykun

Differential Revision: D36130573

fbshipit-source-id: 9615311798fbbd7c000838dfbc043f450c2d9e2e
2022-05-04 10:01:11 -07:00
fortmarek 709a459b1e Fix using Swift in a native module with Fabric enabled (#33743)
Summary:
Using Fabric with a Swift native module is currently broken. There are currently two issues.

If you try to integrate a native module with Swift code, you will get the following error when running `pod install` with Fabric enabled:
```
[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `MyNativeView` depends upon `React-RCTFabric`, `React-Codegen`, `RCTTypeSafety`, and `ReactCommon`, which do not define modules.
To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries),
you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
```

To resolve this, I have applied the suggestion from the error (set `:modular_headers => true` for the appropriate modules inside `react_native_pods.rb`.

Afterwards, `pod install` succeeds but I still got `Redefinition of module 'React'` during the build due to the conflict inside the generated modulesmaps  `React-Core.modulemap` and `React-RCTFabric.modulemap`. This makes sense since `React-RCTFabric.podspec` has `s.header_dir = "React"` (see [here](https://github.com/facebook/react-native/blob/main/React/React-RCTFabric.podspec#L37)) and the module inherits that. However, we can explicitly specify `module_name` for the podspec which is what I have done. I have named the module `Fabric`, let me know if you think there's a better name.

## 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] - Fix using Swift in a native module with Fabric enabled

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

Test Plan:
1. Clone [this](https://github.com/fortmarek/react-native) repo
2. From `main`, apply changes from [this](26958fccf4) commit (adding Swift file to the `MyNativeView` native module in the RN tester app)
3. Try to run `USE_FABRIC=1 RCT_NEW_ARCH_ENABLED=1 USE_CODEGEN_DISCOVERY=1 USE_HERMES=0 bundle exec pod install` inside the `packages/rn-tester`
4. Observe errors
5. Apply [the commit](9772c6209d) from this PR
6. Both pod install and the subsequent build should succeed.

I can also make changes to the current `MyNativeView` module to include Swift as well if it's something that the React Native Core team would be interested in - in case you want the Swift native modules to be always buildable on `main`

Reviewed By: dmitryrykun

Differential Revision: D36097852

Pulled By: cipolleschi

fbshipit-source-id: 2faebcffd1115339f89a406e265a6a040218dc9c
2022-05-04 04:31:23 -07:00
Pieter De Baets 5de0f145ec Avoid allocating empty lists
Summary: Changelog: [Internal] Optimize Fabric memory allocations on Android

Reviewed By: genkikondo

Differential Revision: D36098912

fbshipit-source-id: 8d34a652db019865a8306bc070a08f5ddfef96bf
2022-05-04 04:22:40 -07:00
Nicola Corti b9bb30b1ad Bump React Native Codegen to 0.0.16 (#33749)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33749

Yet another bump of the Codegen to ship new features for RN 0.69

Changelog:
[Internal] [Changed] - Bump React Native Codegen to 0.0.16

Reviewed By: cipolleschi

Differential Revision: D36096803

fbshipit-source-id: 46e118f633eff2abf636737e69718e8fcb3608ed
2022-05-04 04:04:10 -07:00
Riccardo Cipolleschi e4d0153a67 Update CodeGen to leverage the `outputDir` as suggested in diff review (#33729)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33729

This PR addresses [this comment](https://www.internalfb.com/diff/D35820848?dst_version_fbid=496290878846487&transaction_fbid=355967423221044).

It makes the CodeGen to the `outputDir` as base directory for the codegen.

Finally, it updates the unit tests accordingly.

## Changelog
[iOS][Changed] - use `outputDir` as base directory for the codegen and remove the possibility to customize the intermediate path. The generated code requires specific paths in the `#include` directive.

Reviewed By: cortinico, dmitryrykun

Differential Revision: D35935282

fbshipit-source-id: a9ad4e296efb042cf34b20db5eebb59614beb5f6
2022-05-04 04:04:10 -07:00
Riccardo Cipolleschi 0465c3fd10 Refactor generate-specs-cli and add tests
Summary:
This Diff splits the `generate-specs-cli.js` script into:
* `generate-specs-cli-executor.js`: which contains the logic to generate the code for iOS.
* `generate-specs-cli.js`: which contains the argument parsing logic and invokes the executor.

Finally it introduces some tests.

## Changelog
[iOS][Changed] - Refactor part of the codegen scripts and add tests.

Reviewed By: cortinico, dmitryrykun

Differential Revision: D35892576

fbshipit-source-id: 6a3205af049bf55aa4ecaf64544ebc4eb7b13f73
2022-05-04 04:04:10 -07:00
Riccardo Cipolleschi 305a054865 Refactor generate-artifacts to improve testability.
Summary:
This Diff splits the `generate-artifacts.js` script into:
* `generate-artifacts-executor.js`: which contains the logic to generate the code for iOS.
* `generate-artifacts.js`: which contains the argument parsing logic and invokes the executor.

Finally, it introduces some tests.

## Changelog
[iOS][Changed] - Refactor part of the codegen scripts and add tests.

Reviewed By: cortinico, dmitryrykun

Differential Revision: D35846674

fbshipit-source-id: 14873c3fe762606e9004a29e4a6b986bf6a8f055
2022-05-04 04:04:10 -07:00
Riccardo Cipolleschi 6718500eaa Support the `type == all` properly
Summary:
This Diff introduces some changes in the CodeGen to properly generate the types in the right folder.

## Issue
The codegen on iOS defines the output folder once, before creating the generated code.
When the code we have to generate is just a TurboModule (TM) or a Fabric Component (FC), this mechanism works properly.

However, if a library has to generate both TM and FC, actually using the library type `all`, all the code is generated using the TurboModules' output folder.
(**Note:** Android only works in this way)

This generates invalid code because all the FC's `#import` directives assumes that the code is generated in the FC output path which, in this case, is not.

## Solution

The adopted solution moves the responsibility to decide where the files has to be generated to the CodeGen step instead of in the preparatory phases.

The two paths are precomputed in the `generate-artifacts.js` script (the entry point for the CodeGen) and they are passed to all the scripts that requires them.

Once they reach the `RNCodegen.js` file, the generators creates the files and save them in the proper paths.

## Changelog
[iOS][Changed] - CodeGen now supports the `"all"` library type.

Reviewed By: cortinico, dmitryrykun

Differential Revision: D35820848

fbshipit-source-id: ce7f5393936e2ae17f8b2c970f6a011d27f641f2
2022-05-04 04:04:10 -07:00
Christoph Purrer 3f09b48487 Add CompositeReactPackageTurboModuleManagerDelegate
Summary:
This diff adds a CompositeReactPackageTurboModuleManagerDelegate which can be used to combine 1 or more TurboModuleManagerDelegates into a single one.

This is useful when both the app and one or multiple of its libraries provides a TurboModuleManagerDelegate

Changelog:
[Internal] [Changed] - Add CompositeReactPackageTurboModuleManagerDelegate

Reviewed By: cortinico

Differential Revision: D36057036

fbshipit-source-id: bf131fa7315941b3353c0522e4d77d909b82914b
2022-05-04 04:02:39 -07:00
George Zahariev e7d9e4dbb5 Collapse object initialization in Xplat
Summary:
Collapse multiline object initialization into one single object literal (as much as possible).

Run codemod (requires temporary xplat task runner config changes), then manual fixes.

```
./scripts/typedjs/flow/runner codemod lti/collapseObjectInitialization ~/fbsource/xplat/js/
```

- Announcement: [post](https://fb.workplace.com/groups/flowlang/posts/903386663600331)
- Support group: [Flow Support](https://fb.workplace.com/groups/flow)

drop-conflicts

Format:
```
arc f
```
Sort imports
```
hg l -n | xargs js1 lint --fix --rule 'fb-tools/sort-requires'
```

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D36112168

fbshipit-source-id: 23db87c3bd8ffe693019ffeb5ac8300ec46c8532
2022-05-03 21:55:01 -07:00
George Zahariev 0337a2981d Add annotations to empty objects that look like indexers in Xplat
Summary:
We are working on making the empty object literal `{}` have the type `{}` - i.e. exact empty object - rather than being unsealed.
Making this change exposes a variety of errors. We can prevent these errors by annotating what we want the type of the empty object to be.

Reduces Xplat error diff to 2.3k

- Announcement: [post](https://fb.workplace.com/groups/flowlang/posts/903386663600331)
- Support group: [Flow Support](https://fb.workplace.com/groups/flow)

drop-conflicts

Format:
```
arc f
```
Sort imports
```
hg l -n | xargs js1 lint --fix --rule 'fb-tools/sort-requires'
```

Changelog: [Internal]

Reviewed By: samwgoldman

Differential Revision: D36086696

fbshipit-source-id: 90447279f2e6e38f44189b74ec0297719f7adf58
2022-05-03 19:59:28 -07:00
Kevin Gozali ab43358da7 iOS: Introduced ReactNativeRuntimeDiagnostics for various runtime validation mechanism
Summary:
With the new architecture, this diagnostic utility will be helpful to ensure stronger validation of various corner cases at runtime, like handling an early JavaScript exception when loading React Native.

If `global.RN$DiagnosticFlags` is set to a string of comma-separated flags, the util functions will be able to perform additional diagnostics. For now, the accepted flags are:
- `early_js_errors`
- `all`

This is still experimental and may change frequently.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D36088407

fbshipit-source-id: 9059d2d081b0f41d049310fb09650416b333ff57
2022-05-03 18:11:35 -07:00
Xin Chen 72c1a770fe Disable preallocation for panel apps
Summary: Disable preallocation for panel apps to mitigate some crashes.

Reviewed By: javache

Differential Revision: D35866301

fbshipit-source-id: e6277e6be7a86682867c6a7ecfe60f7cf1ab549d
2022-05-03 14:47:47 -07:00
Xin Chen 16f30fc0ec Update overflowInset flag to use public static field
Summary: There's no need to use private feature flag for overflowInset feature. This makes future refactor on feature flags easier.

Reviewed By: javache

Differential Revision: D35866302

fbshipit-source-id: a3fde212ff40cd6d4c68832bb39b34de5a17a8d4
2022-05-03 14:47:47 -07:00
Sam Zhou c8550bb5fa Add annotations to unannotated variable declarations [manually-modified]
Summary: Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D36085338

fbshipit-source-id: 34d421ad3fd4595c13e7a45256666112f8607fbe
2022-05-03 13:50:45 -07:00
Moti Zilberman 598c2e02fd Use Flow type inference for interpolation outputRange
Summary:
Changelog:
[Internal]

Cleans up unnecessary type casts / suppressions throughout the codebase following D35869725.

Reviewed By: javache

Differential Revision: D35870027

fbshipit-source-id: eefcb544b19ba93587011cdfd4046d18dddb246e
2022-05-03 12:04:02 -07:00
Moti Zilberman 7b86fa2b79 Distinguish between string/number-valued interpolation nodes at the type level
Summary:
Changelog:
[General][Fixed] - Improved Flow type inference in Animated `.interpolate()`

Improves the ergonomics of `.interpolate()` by allowing Flow to infer the correct type for `outputRange`. This is achieved by adding a new type parameter `OutputT` to `interpolate()` (and `Animated.Interpolation` and `InterpolationConfigType`), which Flow infers as either `number` or `string` based on usage.

Admittedly, at the call site, this is not that much safer compared to something like `outputRange: $ReadOnlyArray<number | string>`, but it does document the intent of the API a bit better and provide some downstream type safety. For example, we can now express `Animated.Number` (D35869375) more precisely by excluding string-valued interpolation nodes.

Reviewed By: javache

Differential Revision: D35869725

fbshipit-source-id: e03ec22e9b3368ee196b392af011062ac99d8bb9
2022-05-03 12:04:02 -07:00
Moti Zilberman 9eb7629ac6 Add Animated.Numeric Flow type
Summary:
Changelog: [General][Added] - Add `Animated.Numeric` Flow type

Adds a Flow type to represent the various Animated node types that evaluate to numeric values and can be `interpolate()`d.

I'm including `AnimatedInterpolation` as "numeric" here even though it can technically evaluate either to a number or to a string, depending on its config. Note that calling `interpolate()` on a string-valued `AnimatedInterpolation` is a runtime error.

In a future diff, I'm planning to add a type argument to `AnimatedInterpolation` (and its config type), at which point we can refine `Animated.Numeric` to correctly include only `AnimatedInterpolation<number>`.

Reviewed By: javache

Differential Revision: D35869375

fbshipit-source-id: 2ff6754f1a5abc68c9da2c6836872c2022b25676
2022-05-03 12:04:02 -07:00
hduprat 79529a1c77 Add Vibration module mock (#30643)
Summary:
I wrote a test for a vibration feature in a react native app by importing the `Vibration` module and using `jest.spyOn(Vibration, 'vibrate')`.

I had the following error:
```
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'Vibration' could not be found. Verify that a module by this name is registered in the native binary.
```

That lead me to look for (and not find) a mock for the `Vibration` module in the code.

## Changelog

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

[General] [Fixed] - Add Jest mock for Vibration module

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

Test Plan:
I would be glad to provide a test plan for this, but as it is part of testing I don't really know how to do so.
Any suggestion or help is welcome!

Reviewed By: yungsters

Differential Revision: D36097003

Pulled By: cortinico

fbshipit-source-id: 58683120da34f40e142a44c4bef8a5fced04bac2
2022-05-03 11:29:48 -07:00
Riccardo Cipolleschi a649675160 Connect Ruby tests with CircleCI (#33747)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33747

This Diff connects the ruby tests setup with CircleCI, making sure that we are executing the same script in Sandcastle and CircleCI.

At the moment, the scripts runs somedummy tests to make sure that everything works.

## Changelog
[iOS][Changed] - Add ruby tests to circleci

Reviewed By: dmitryrykun

Differential Revision: D36091716

fbshipit-source-id: c432e5f8b5269754db2b7ec278b159dcedf3b3b9
2022-05-03 07:11:54 -07:00
Riccardo Cipolleschi 181d78bd75 Connect Ruby tests with Sandcastle
Summary:
This PR adds a step in the iOS legocastle script to run the ruby tests in the cocoapods folder.

These tests are executed before the pod installation step: this because we would like to fail as fast as possible in case of issues.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36006781

fbshipit-source-id: 8afbc1ccc751d2dc736bdc23ec382ebd7b5c7f4f
2022-05-03 07:11:54 -07:00
Riccardo Cipolleschi 8f15955099 Add dummy test to run ruby test suits
Summary:
This Diff prepares a set of dummy tests to make sure that our infra supports tests in ruby.

It also adds a scripts in the `__tests__` folder which can be invoked to run all the tests. The script performs a discovery of all the tests in the  cocoapods folder.

Next steps will configure Sandcastles and CircleCI.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D35968556

fbshipit-source-id: b8bf23d30dc5358ab603e396cce1c6639dd0f567
2022-05-03 07:11:54 -07:00
Paige Sun a0a45dcaba Minor comment on how to migrate UIManager.sendAccessibilityEvent
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D36086114

fbshipit-source-id: 70a05adffea0576731ccf62154a00785e8aceecd
2022-05-02 20:31:31 -07:00
Aniket Mathur 2e1e62f2bf Fix import path breakage (#33746)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33746

https://github.com/facebook/react-native/runs/6262282188?check_suite_focus=true

Cell imports aren't compatible with open source buck builds.

Reviewed By: alexmalyshev

Differential Revision: D36073197

fbshipit-source-id: 0b7c27cea2516c980e19c89eb4f313817b63c628
2022-05-02 19:23:38 -07:00
Aniket Mathur 05c594d2f5 Fixup query errors
Reviewed By: alexmalyshev

Differential Revision: D36068791

fbshipit-source-id: bf841fe8fcafae0fb60f6eefc2473784afbae5de
2022-05-02 11:27:38 -07:00
Paige Sun 422c224bb0 Add MC to check whether canSendEvents_DEPRECATED is needed
Summary:
Changelog: [Internal]

See T118587955

Reviewed By: RSNara

Differential Revision: D36026423

fbshipit-source-id: 26cfcf318af4a5061e94bd0286c0433c06886d8e
2022-05-01 13:36:09 -07:00
Paige Sun f9922a3f46 Fix AppState by removing guard for bridge, since it doesn't use bridge
Summary:
Changelog: [Internal][iOS] Fix AppState in Bridgeless mode by removing guard for bridge, since it doesn't use bridge

AppState doesn't use bridge because RCTAppState subclasses RCTEventEmitter, which calls `_callableJSModules invokeModule` in both Bridge and Bridgeless mode to send events to JS.

Reviewed By: fkgozali

Differential Revision: D35988515

fbshipit-source-id: fb19f0f2df5b270f0ef57637930f94686e39a9a1
2022-05-01 13:36:09 -07:00
George Zahariev d992ae0448 Codemod `Object.assign` with object literal first argument to object spread in Xplat
Summary:
Codemod `Object.assign` with object literal first argument (e.g. `Object.assign({}, foo)`) to object spread.

This adds several suppressions for exposed errors. The codemod produces errors as `Object.assign` is more unsafe than object spread. For example, `Object.assign` doesn't handle indexers, nor does it handle inexact objects properly, and when the (currently unsealed) empty object is supplied as the first argument, it also leads to unsafe behaviour:
https://flow.org/try/#0FAehAIGJwSQOwCYFMAeSBOBnYyDGAbAQ3SXADdjwBbQgBwC5wBvAbUwBd0BLOAcwF1GHbnwC+AbmDAAFAHkARgCskudgDpCmTF15xpTQowCMogDTU6ASkbyA9rfxJCcS+PBhwAfm8ymwcAGG4Eam-gFqETS0oaKu7hAAyrQkhAjgGOi2WOCa6Si0KuxICFIe0PCohKo5AGZF6HlV7DgqRCTklDyVqowGQpw8vOYRahJSCsqqGlo6en3gAEQAFlwL5vLGZuBdKE1xHjtN4Li2AK74abZkGVzI4AAG8vfgUvphOYzLq6EB4BvBP3CEUOqhi+0SyScaQyWUwOThqAKqmKpQg0AAqnBME5HGkalwsOwcuheDIJoVptpdPotvMTNZmDV7Iw4KcqPIMLE3B5vN4gA

The codemod is safe to do, despite some Flow errors, as `Object.assign` and object spread are equivalent at runtime, with the exception that `Object.assign` triggers setters on the target object. However the codemod [does not run](938dbdd6c3/lib/rules/prefer-object-spread.js (L283-L285)) if the first argument (object literal) has getters/setters, so we are fine.

```
ag -l 'Object.assign\(' | xargs ag -l 'flow' | xargs js1 lint --rule '{"prefer-object-spread":2}' --fix
```
Some manual fixes
```
arc f
```

Reviewed By: SamChou19815

Differential Revision: D36023786

fbshipit-source-id: b682562e670410acf4175ba59ab285c7bdcfe052
2022-04-28 19:40:55 -07:00
Nicola Corti 07a63a2376 Fix publish_release not running on release tags correctly.
Summary:
During RN 0.69 we realized that we're failing to publish a version.
The reason is that only the `prepare_hermes_workspace` was executed
after a TAG got published.

The problem is a missing `filter:` key which made CircleCI skipping
some steps for a tag. Here I'm fixing it.

Run for 0.69.0-rc0 (broken)
https://app.circleci.com/pipelines/github/facebook/react-native/13123/workflows/3cb781d2-f81c-4856-9686-2260c020c3bd
Run for 0.68.1
https://app.circleci.com/pipelines/github/facebook/react-native/12938/workflows/a1bcf306-9d81-4149-9d4a-bc7b988fb53f

Changelog:
[Internal] [Changed] - Fix publish_release not running on release tags correctly

Reviewed By: hramos

Differential Revision: D36005374

fbshipit-source-id: 5664369f008e60e334c1db5fa2e7c3089369d7ad
2022-04-28 10:44:06 -07:00
Héctor Ramos b873a4f4f7 Hermes: Include sdks/hermes-engine.podspec in release
Summary:
This file was added in D35300595 (ada6c7166b) and it needs to be part of the `react-native` release.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D35983108

fbshipit-source-id: 0a1c437b953e575c0229b0382743c72b6c91bd0b
2022-04-28 10:03:32 -07:00
Riccardo Cipolleschi fdbe4719e2 fix: Make WebSocketTests work in CI (#33721)
Summary:
This PR reestablish the WebSocketTest in CI which is making the `test_ios_unit` fail.

**Note:** the test_ios_unit is actually running integration tests...

## Changelog

[iOS] [Changed] - Fix the test_ios_unit test

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

Test Plan: The CI of this PR is green. 😬

Reviewed By: cortinico

Differential Revision: D36002823

Pulled By: cipolleschi

fbshipit-source-id: 20eeb08bfd02658ad6579085241f81654f74c1af
2022-04-28 08:53:24 -07:00
Christoph Purrer eb2a83b0be Allow ReactInstrumentationTest to use custom JSIModules
Summary:
Update ReactInstrumentationTest to allow passing in custom JSIModules

Also: 'Fixed' some improper ordering of Nullable annotations

Changelog:
Internal

Reviewed By: cortinico

Differential Revision: D35961806

fbshipit-source-id: aa1513bee34e04ac3aae37f794d9d2771e7cc501
2022-04-28 07:48:54 -07:00
Nicola Corti 4ea593b756 Fix release infrastructure failures discovered during .69 release
Summary:
During the release of .69, we (fortmarek and me) discovered a couple of bits that needed
some intervention.
- `sdks/.hermesversion` was gitignored, so we could not commit that.
- `scripts/bump-hermes-version.js` was not executable, so we had to chmod +x to
  make it runnable.

Here I'm fixing it.

Changelog:
[Internal] [Changed] - Fix release infrastructure failures discovered during .69 release

Reviewed By: cipolleschi

Differential Revision: D36003808

fbshipit-source-id: c4d82ed5e2c63988699035ac84b0e87ed8894540
2022-04-28 07:48:40 -07:00
Nicola Corti 208422fe8e Bump React Native Codegen to 0.0.15
Summary:
For RN 0.69, we want to ship all the changes we have on master
for React Native Codegen.

Changelog:
[Internal] [Changed] - Bump React Native Codegen to 0.0.15

Reviewed By: cipolleschi

Differential Revision: D35964934

fbshipit-source-id: d6b6c36a9a077cb53113907ea59da3148e18e5cd
2022-04-28 04:18:28 -07:00
Nicola Corti 63acead781 Remove the unused JavaGenerator from the React Native Gradle Plugin.
Summary:
I'm removing the Java generation as we're not using it for now, and we're not maintaining it.
Moreover is not feature complete, and still needs `react-native-codegen` to generate the Makefile/CMake/C++ code.
We can still resort it if we decide to switch to AST based generation.

Changelog:
[Internal] [Changed] - Remove the unused JavaGenerator from the React Native Gradle Plugin

Reviewed By: cipolleschi

Differential Revision: D35930746

fbshipit-source-id: 624c411cdc678b270a647efc3cc8236b50018bef
2022-04-28 02:34:07 -07:00
Sam Zhou 0c4c6ca319 Add annotations to unannotated variable declarations [manually-modified]
Reviewed By: panagosg7

Differential Revision: D35948108

fbshipit-source-id: 7d286c9dd66dbd25281e2d831691f8bb34504b5d
2022-04-27 19:15:55 -07:00
Héctor Ramos ff80493d6e Circle CI: Include pre-built Hermes compiler in react-native npm package (#33679)
Summary:
Build Hermes on Circle CI, and pull in the osx-bin, win64-bin, linux64-bin directories into sdks/hermesc when react-native is packaged for npm.

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

Changelog:
[General][Added] - Hermes Compiler binaries will be provided in react-native/sdks/hermesc

Reviewed By: cortinico

Differential Revision: D35793916

fbshipit-source-id: b9322abec29dd90b8bad6b803b1b1dff87d62669
2022-04-27 11:48:25 -07:00
Nicola Corti fbe72cf348 Bump React Native Gradle plugin to 0.0.7
Summary:
In order to release RN 0.69, we need to Bump React Native Gradle plugin to
the latest stable.

Changelog:
[Internal] [Changed] - Bump React Native Gradle plugin to 0.0.7

Reviewed By: cipolleschi

Differential Revision: D35964705

fbshipit-source-id: 0893fe092cfddffd5e79b70fc069f7c59ce33845
2022-04-27 09:41:11 -07:00
Nicola Corti c11785b90d Update the hermesc output to be inside the $buildDir
Summary:
Currently, we build Hermes by specifying the Cmake flag `-B ./hermes`. That means
that the output out the build is going to be placed along side the source code.

This is fine, as long as the user doesn't use the `REACT_NATIVE_OVERRIDE_HERMES_DIR`,
which is used inside the Hermes CI. In that case, the source location of Hermes can be
changed, leading to scenarios where `hermesc` can't be found.

Here I'm changing the flag to be `-B $buildDir/hermes`. Therefore the build output
will always be located within the `./ReactAndroid/hermes-engine/build` folder.
This is a more robust solution as the build output will be encapsulated within the
`build/` folder.

Changelog:i
[Internal] [Changed] - Update the hermesc output to be inside the $buildDir

Reviewed By: cipolleschi

Differential Revision: D35964402

fbshipit-source-id: aa7e0775b282897d5a99c1c46265884d19c5f289
2022-04-27 09:41:11 -07:00
Michał Pierzchała 24bb7f7380 Upgrade RN CLI to v8 alpha.4 (#33718)
Summary:
Upgrades the React Native CLI to v8 alpha.4. Includes `--generate-static-view-configs` metro flag for `bundle` command cc dmitryrykun kelset cortinico

## Changelog

[General] [Changed] - Upgrade RN CLI to v8 alpha.4

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

Test Plan: CI green.

Reviewed By: cipolleschi

Differential Revision: D35961818

Pulled By: cortinico

fbshipit-source-id: 54137cd32d4a5d546dbee17983a2c04321b9a3fc
2022-04-27 06:59:38 -07:00