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

24781 Коммитов

Автор SHA1 Сообщение Дата
Pieter De Baets 80f7367149 Replace NativeRunnable with fbjni implementation (#33776)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33776

The implementations of these modules is pretty much identical, and we're already shipping the fbjni version of this anyway.

Changelog: [Internal]

Reviewed By: mhorowitz

Differential Revision: D36200330

fbshipit-source-id: 135ee621e1e4c5eb9616ce7f442fc6d4b946f865
2022-05-09 05:13:38 -07:00
Anandraj Govindan 883a93871c Working around Long paths limitation on Windows (#33784)
Summary:
Cherry picking https://github.com/facebook/react-native/pull/33707 to main branch

This change is extending the changes made by alespergl to reduce the file paths and command lengths of ndk build commands
Essentially we are shortening the length of the source files by using relative paths instead of absolute paths as enumerated by the wildcard expression
This commit is extending the fix by including all the new modules introduced into RN for the new architecture, including the generated modules.
We are also reverting the ndk bump as ndk23 is crashing frequently when building RN with new arch. The reduced file paths lengths ensures the ndk bump is not required for relatively short application paths.

Fix building RN with new architecture on Windows boxes by using relative paths for C++ sources

## Changelog

Fix building RN with new architecture on Windows boxes by using relative paths for C++ sources

[CATEGORY] [TYPE] - Message

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

Test Plan: Verified building on windows box

Reviewed By: javache

Differential Revision: D36241928

Pulled By: cortinico

fbshipit-source-id: 1ce428a271724cbd3b00a24fe03e7d69253f169b
2022-05-09 04:42:53 -07:00
Riccardo Cipolleschi d96806bbc6 Move Flipper to dedicated flipper.rb
Summary:
This Diff moves all the Flipper.rb related setup in the cocoapods scripts to a dedicated script.

It also removes the not needed dummy files and add tests for flipper.

## Changelog

[iOS][Internal] - Extract Flipper setup in a separate file and add tests

Reviewed By: cortinico

Differential Revision: D36129808

fbshipit-source-id: 5446203a69b527146c893aa9611e98688e20b778
2022-05-09 02:55:30 -07:00
Pieter De Baets 0d9e054ec4 Cleanup JBackgroundExecutor and support thread naming (#33780)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33780

Currently this just has a default ThreadPool name, which can be confusing in systraces and crash reports.

Changelog: [Internal]

Reviewed By: ryancat

Differential Revision: D36200090

fbshipit-source-id: 22918993e7c822ed721ccaf79cdcd9d2a972193d
2022-05-09 02:07:26 -07:00
Dmitry Rykun 94341f0380 Fix Circle CI test_ios_template (#33761)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33761

Changelog:
[General][Fixed] - Add 'mkdirp' as a direct dependency to 'react-native' instead of assuming it being a transitive dependency of some other module.

Reviewed By: cortinico, cipolleschi

Differential Revision: D36138320

fbshipit-source-id: b2421aa6b22fca0b813bbb5bb0c7213540ca578d
2022-05-08 09:10:25 -07:00
Sam Zhou 23a160ebf6 Lock down constrain writes in some directories
Summary: Changelog: [internal]

Reviewed By: gkz

Differential Revision: D36214426

fbshipit-source-id: 8498ef0f646d8a38e5d523f4fd2deacf1b649fd2
2022-05-06 15:53:13 -07:00
Kudo Chien 6b6adcc111 add back hermes inspector support (#33778)
Summary:
the `WITH_INSPECTOR` build flag is missing from cmake migration. original we had it in [Application.mk](ed46ea2058/ReactAndroid/src/main/jni/Application.mk (L29))

this pr adds back the build flag and make hermes inspector (or debugging hermes in flipper) work again.

## Changelog

[Android] [Fixed] - add back hermes inspector support

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

Test Plan: test on rn-tester hermes variant

Reviewed By: cipolleschi

Differential Revision: D36204525

Pulled By: cortinico

fbshipit-source-id: 417874a7d0e05b5ee886f3160d526ff9c2df44ee
2022-05-06 11:38:00 -07:00
Evan Yeung 73a43901b4 Deploy 0.177.0 to xplat
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D36141544

fbshipit-source-id: 7e322faa6f902547bb68997d02a50352c525d543
2022-05-06 10:51:36 -07:00
Nicola Corti 6e2fea8127 Store Hermes Debug Symbols inside CircleCI (#33779)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33779

This diff adds a `store_artifacts` to CircleCI so the Hermes debug symbols are retained and can be used to symbolicate native crashes for Hermes.

Changelog:
[Internal] [Changed] - Store Hermes Debug Symbols inside CircleCI

Reviewed By: cipolleschi

Differential Revision: D36201978

fbshipit-source-id: ef9a71e2953180aef5caea9f5eb0047190ed6198
2022-05-06 10:50:10 -07:00
Nicola Corti 11601279b3 Fix comments on how to enable/disable Hermes on iOS
Summary:
This comment on how to enable/disable Hermes went out of sync with the release of the New Architecture. Got reported on the website here: https://github.com/facebook/react-native-website/issues/3105
I'm fixing it.

Changelog:
[Internal] [Changed] - Fix comments on how to enable/disable Hermes on iOS

Reviewed By: cipolleschi

Differential Revision: D36204189

fbshipit-source-id: 5831a9500477115ebe5fa5cb62176ceefc722839
2022-05-06 10:17:25 -07:00
islandryu 13a72e0ccc Fix items disappear when zooming VirtualizedList (#33765)
Summary:
fix https://github.com/facebook/react-native/issues/33705
Fixed the disappearance of items when scrolling after zooming VirtualizedList.
example https://github.com/islandryu/zoomVirtualizedList

Before modification

https://user-images.githubusercontent.com/65934663/166849127-9fc3ba84-5172-4ae1-bd44-dd6312f283ec.mov

After modification

https://user-images.githubusercontent.com/65934663/166868632-2f78e118-f705-442d-b94e-ff165bed26c7.mov

## 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] - Fixed the disappearance of items when scrolling after zooming VirtualizedList.

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

Test Plan:
Make the VirtualizedList zoomable with a prop such as maximumZoomScale.
Apply the patch and make sure that items in the VirtualizedList do not disappear when you scroll after zooming the VirtualizedList.

Or apply the patch from this repository and check it.
https://github.com/islandryu/zoomVirtualizedList

Reviewed By: javache

Differential Revision: D36169686

Pulled By: yungsters

fbshipit-source-id: 0f86255c2864be13f6d2dc5a58af1d11c9eedac3
2022-05-06 09:30:15 -07:00
Héctor Ramos 9328115b41 Hermes: Use Hermes commit sha as part of pod version
Summary:
Customize the Hermes version exposed to CocoaPods with one that refers to the facebook/hermes commit sha from which Hermes was built.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36145140

fbshipit-source-id: 4ff7546d2335ea6642dd9b10f4b7a9aba260d550
2022-05-06 08:33:07 -07:00
Héctor Ramos 09878c8acd Circle CI: Cache Hermes builds
Summary:
Use Circle CI caching to avoid re-building Hermes. The cache key will be determined by the Hermes tag specified in sdks/.hermesversion; if the file does not exist (as is the case in builds from main), the commit sha for the latest Hermes commit from facebook/hermes will be used.

This should significantly speed up builds across all workflows: builds from main (commitlies), nightlies, and release builds.

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D36158296

fbshipit-source-id: b80457fdefad0d63e62feeb4d509265e2762f253
2022-05-06 08:02:33 -07:00
Rob Hogan ed46ea2058 Clean up `yarn.lock` Metro dependencies -> 0.70.3
Summary:
Updates `yarn.lock` to resolve mixed/mismatched Metro versions between direct dependencies on `0.70.3` and indirect dependencies on `^0.70.1`, so that everything resolves to `0.70.3`.

Changelog: [Internal]

Reviewed By: jacdebug, cortinico

Differential Revision: D36131458

fbshipit-source-id: d1ad72432b664b7191b2431d3c3b95b70f3a81d7
2022-05-06 07:28:59 -07:00
Moti Zilberman 0301cb285b Stop publishing jest/preprocessor.js to npm
Summary:
Changelog:
[Breaking][General] Remove jest/preprocessor from the react-native package

Using `react-native/jest/preprocessor` outside of the React Native repo has been deprecated since D34820086 (c1e9aa9a27). Here, we make this file private and stop publishing it to npm.

The supported method of using Jest in React Native projects is using the [Jest preset](https://jestjs.io/docs/tutorial-react-native) shipped as part of the `react-native` package.

NOTE: We could probably make some of the other files under `jest/` private as well, but we should go through a separate deprecation cycle with those, in case they are also being used externally by some projects. I'm leaving that for future followup at the moment.

Reviewed By: GijsWeterings

Differential Revision: D36132939

fbshipit-source-id: 300ffa6cf16232573cd3a79a34c14daaafd7aa43
2022-05-06 04:43:09 -07:00
Pieter De Baets 9d3d5e13f0 Switch buck schema codegen to yarn_workspace_binary (#33773)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33773

I noticed this was a very slow part of my build because each instance of the binary would run its own yarn install. Instead use the yarn_workspace approach to share a single yarn setup.

Changelog: [Internal]

Reviewed By: d16r

Differential Revision: D36164350

fbshipit-source-id: 5290587010fe6021b758bda98bf01995fdf14acd
2022-05-06 04:31:37 -07:00
Michał Pierzchała 1e0226f933 Upgrade RN CLI to v8 alpha.5 (#33755)
Summary:
Upgrades the React Native CLI to v8 alpha.5. Includes Metro bump to 0.70.2 cc fortmarek kelset cortinico

## Changelog

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

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

Test Plan: CI

Reviewed By: motiz88, cipolleschi

Differential Revision: D36128899

Pulled By: cortinico

fbshipit-source-id: b9ce0b4f9fef356141a79be9ccdcabd841d6d1ea
2022-05-06 03:50:15 -07:00
Pieter De Baets bf405d7083 Fix definition of NativeAnimated.isEmpty
Summary:
Noticed in D36098912 (5de0f145ec) that the definition of NativeAnimatedModule's OperationQueue.isEmpty was incorrect as it didn't account for `mPeekedOperation`, while `drainQueueIntoList`  did.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D36109810

fbshipit-source-id: afd7059975ce6e5c65d1975d168a03f0881bd7c1
2022-05-06 02:45:47 -07:00
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