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

25957 Коммитов

Автор SHA1 Сообщение Дата
Lulu Wu f207cfddf3 Add atomic registerSegment method to test
Summary:
In the top js errors there are 2 mids related to segment fetching:
- requireForFacebook.js:unknownModuleError (https://www.internalfb.com/logview/details/facebook_android_javascripterrors/ba11461526aff8a6842401b35b02f5a4), 11.64 K vs. 524
- asyncRequire.js:verifySegment (https://www.internalfb.com/logview/details/facebook_android_javascripterrors/5452ba893b8d9ba8e97e070cf6976b65) 5.39 K vs. 180

Both errors will result in surface not loading.

A lot of traces have logs similar with the following:

```11-01 19:57:51.166 27735  7626 W fb4a.BridgelessReact: registerSegment(segmentId = "1090", path = "/data/data/com.facebook.katana/app_overtheair/resources/412137089/414433453/hbc-seg-1090__DELIM__main.jsbundle")
11-01 19:57:51.167 27735  7445 I ReactNativeJS: Module 39122 in segment 0 doesn not exist moduleDefiner
11-01 19:57:51.171 27735  7445 E ReactNativeJS: Error: Requiring unknown module "39122"., js build: 414433453
11-01 19:57:51.175 27735  7445 E ReactNativeJS: Error: Segment meta module is not setup properly. Details: segmentId = 1090, metaModule === undefined
11-01 19:57:51.175 27735  7445 E ReactNativeJS:
11-01 19:57:51.175 27735  7445 E ReactNativeJS: This error is located at:
```

RegisterSegment lives through 3 threads while in bridge there are only 2 threads involved (native & JS):
- Native thread, log printed (fb4a.BridgelessReact: registerSegment...)
- Background thread: no log, added in this diff (Finish registerSegment...)
- JS thread: logs not printed, should print logs here:

https://www.internalfb.com/code/fbsource/[60521987354ed1ef9a0d10bafc60db3c25302ab4]/xplat/ReactNative/venice/ReactInstance.cpp?lines=308-330

Since the JS thread logs aren't printed and there are segment errors right after calling registerSegemnt, I think registerSegment is not done. It could be caused by:
- ReactInstance being null, I added logs in background thread to verify (Finish registerSegment...) since dispatching to background thread relies on non-nullable ReactInstance.
- Work on JS thread hasn't been executed when trying to use/verify the segment. I added atomic method ```registerSegmentAtomic``` to make sure JS thread is blocked until segment is fully registered.

```registerSegmentAtomic``` will be tested behind gating added in D40917444.

Changelog:
[Android][Changed] - Add feature flag enableAtomicRegisterSegment

Reviewed By: RSNara

Differential Revision: D40921759

fbshipit-source-id: 84221aa81f0c549f931a4847b154187299639ef4
2022-11-02 21:01:53 -07:00
Héctor Ramos 4f3ca8facf cleanup publish-npm.js: --include-hermes is not used anywhere (#35166)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35166

The Hermes source code is not included in the RN npm package. This piece of code is a remnant from an early experimentation into integrating Hermes more tightly with React Native. We ended up using a combination of the scripts in `scripts/hermes` to fetch the source code from GitHub and relying on prebuilts for stable releases.

Added `strict()` flag to ensure the script fails immediately if an unrecognized flag is passed.

Avoid logging temp publishing folder value to console when `--help` is used.

Changelog: [internal]

Reviewed By: cortinico

Differential Revision: D40918939

fbshipit-source-id: 2e62ab16467c4c67f03efdf5211a156cb70e0b11
2022-11-02 20:59:03 -07:00
Ruslan Shestopalyuk a671d61b6d Add JS stub for PerformanceObserver specs
Summary:
This stubs all the type definitions for the [PerformanceObserver web perf APIs](https://www.w3.org/TR/performance-timeline/#the-performanceobserver-interface).

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D40892974

fbshipit-source-id: 31fe972fc069eb62e51bca82e9cd42ca65811753
2022-11-02 19:44:29 -07:00
Shawn Dempsey 714b22bb43 Local filenames with colon should be parsed correctly (#35123)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35123

**Context**

On RN Desktop, images can be copy/pasted into text inputs.
When copy/pasting local files w/ semi-colons in the filename (`/downloads/devices:pre-call-IMG_346C38284B2B-1.jpeg`), RN would throw this error.

{F785684529}

The error was due to no having the correct asset loader due to the local file path being parsed incorrectly.

To parse the url, we convert the string URI to a `NSURL` using a custom convertor fn.
The conversion was matching any `:` and assuming it was a network url scheme:
https://www.internalfb.com/code/archon_react_native_macos/[fde4113acd89fb13ee11636c48b59eac49c21bae]/React/Base/RCTConvert.m?lines=97-111

When an image path with `:` in the name was passed to this, it was assuming it was a valid network url and not file path.

Because this is a local filepath, the image path needs to be a filesystem url. Since this was parsed as network url, it did not have the `file://` prefix and would not pass this check, causing the loader to throw.l
https://www.internalfb.com/code/fbsource/%5B60d9d5e67383%5D/xplat/js/react-native-github/Libraries/Image/RCTImageLoader.mm?lines=220-230

## Changelog

[iOS] [Added] -  Add support for parsing files w/ `:` in filename

Reviewed By: christophpurrer, philIip

Differential Revision: D40729963

fbshipit-source-id: 2f3adcabc8f0f1f22cbfca69c3484e72b1d93d25
2022-11-02 19:00:07 -07:00
Nicola Corti e8d3fb87f1 Bump RNGP to 0.71.8
Summary:
Just bumping RNGP to make the new sources avialable to the template.

Changelog:
[Internal] [Changed] - Bump RNGP to 0.71.8

Reviewed By: robhogan

Differential Revision: D40948246

fbshipit-source-id: c6a193fcdc0675be9ef7f1320d63e884b8b65daa
2022-11-02 18:57:10 -07:00
Nicola Corti 46de03a46a Fix test_buck by not using lambdas inside ReactImagePropertyTest (#35181)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35181

As the title says, this unblocks `test_buck` by removign the lambdas used inside test.

Changelog:
[Internal] [Changed] - Fix test_buck by not using lambdas inside ReactImagePropertyTest

Reviewed By: cipolleschi

Differential Revision: D40958412

fbshipit-source-id: 60b8609a25985230dfd6c4dcdf983dc2a8cfaf64
2022-11-02 16:02:53 -07:00
Nick Gerleman 5d26ceaa23 Fixup TS Organization (#35169)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35169

This reorganizes typing structure a bit.

`Utilities.d.ts` was originally added for utilitiy types but I ended up leaving it a grab bag of types that didn't belong to any individual bit of code. Out of what is in it right now, `Insets` was actually public, and seems to have been imported.

We also run into files around the renderer which are [currently overwritten](e286da25fc/Libraries/Renderer/implementations/ReactNativeRenderer.d.ts) by the React sync script.

Finally, all of the top-level imports of `Utilities` were auto-generated by VS Code, but fail in real apps. I think this is because our tsconfig sets a `baseUrl` to allow resolution from the types folder, so the tooling in the RN repo will use that, but it breaks in real apps that don't have that mapping.

This splits all these up into a couple separate directories that are hopefully easier to reason about, and removes `Omit` which has been a builtin type for quite some time (we were actually already using built-in `Omit`).

Changelog:
[General][Fixed] - Fixup TS Organization

Reviewed By: cipolleschi

Differential Revision: D40932319

fbshipit-source-id: 0b6e3e3eda603885b4dc01dcb9f5233aa546d128
2022-11-02 14:58:37 -07:00
Nicola Corti b5405b2954 Make sure nightly versions are using the -SNAPSHOT artifacts (#35178)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35178

I forgot to add the logic to fetch the -SNAPSHOT version when on nightlies.
This code takes care of it.

Changelog:
[Internal] [Changed] - Make sure nightly versions are using the -SNAPSHOT artifacts

Reviewed By: cipolleschi

Differential Revision: D40939367

fbshipit-source-id: 29d60cf281d30b3dbd05d7ea1c766541a8fab90a
2022-11-02 10:55:23 -07:00
Pieter De Baets b5ea5a2c4d Fix WebSocketModule not closing connections on reload
Summary:
Saw in the logs an ever increasing number of warnings coming from WebSocketModule about requesting an instance that has already gone away.

On module invalidation we should close all outstanding websockets, as they will no longer be able to send events to JS.

Changelog: [Android][Fixed] On instance destroy, websockets are correctly closed

Reviewed By: mdvacca

Differential Revision: D40897255

fbshipit-source-id: 1578de8baa342479d14ee1070c3314d45c7fbd8d
2022-11-02 10:24:56 -07:00
Samuel Susla 6a23b131e5 Add file ReactNativeTypes.d.ts to fix CircleCI (#35173)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35173

changelog: [internal]

D40897093 (f49b2517d7) deleted TypeScript definitions.

Reviewed By: cipolleschi

Differential Revision: D40935747

fbshipit-source-id: 020cba21b8b40c8b0c92bb5ab2dc4f6ba5da610a
2022-11-02 08:43:22 -07:00
Lorenzo Sciandra c540ff7bd1 fix(local-e2e-script): add logic to handle maven local for iOS and Android accordingly (#35104)
Summary:
This PR is a follow up of https://github.com/facebook/react-native/pull/35075 and 1546666a6d to ensure that even in the local e2e testing scenario the new maven approach is followed - without this, RNTestProject on Android won't work, like so:
<img width="1905" alt="Screenshot 2022-10-27 at 12 15 38" src="https://user-images.githubusercontent.com/16104054/198334105-30fb2037-4e7c-4814-8c3f-2412ba0bd49f.png">

And iOS will always build everything from source every time.

This PR addresses both by generating the artifacts locally, and passing them to RNTestProject as if they were coming from a url (mimicking as closely as possible the behaviour for the final user)

In doing so, there's been some refactoring to prep the ground for follow up work.
* refactor CI to rely less on scripts directly in the CircleCI config, but invoke .js ones
* we should be able to trigger more the "manual" artifacts generation so that it will only happen once between RNTester and RNTestProject, and we can pass existing artifacts to the other flows.
* once all of this in place, a very good improvement would be to be able to download the maven artifacts kind of like nightlies and stables do. This will only be viable by checking that there's no local changes, after which there needs to be logic to pull down from CircleCI the artifacts based on git commit <-> circleCI job references.
 ---

While at it, I've also fixed the hermes-engine podspec logic for detecting if it's on CI: basically the local e2e script needs to align with the changes done here: 4b51207735

but as you can see there, the condition was actually inconsistent across the various files, so realigned to `CI === 'true'`. We probably didn't catch that so far 'cause the other condition in the hermes podspect (existence of `hermestag_file`) is only true on release branches and this new logic has not been in any release branches yet.

## 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] - add logic to local e2e script to handle maven local for iOS and Android accordingly

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

Test Plan:
Run ` yarn test-e2e-local -t RNTestProject -p Android` successfully.

Run ` yarn test-e2e-local -t RNTestProject -p iOS` successfully. On the pod install stage, you will see `[Hermes] Using pre-built Hermes binaries from local path.`

Reviewed By: dmytrorykun

Differential Revision: D40893239

Pulled By: cipolleschi

fbshipit-source-id: a31217ec4f177383c62292d00fabc4cbe4391cfd
2022-11-02 08:23:50 -07:00
Nicola Corti 0fd282f2cd Link against the app codegen if available (#35176)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35176

This commit extends the ReactNative-application.cmake logic so
that if the app is using codegen at the app level, the generate library
is properly built and linked.

It helps us simplify the RN Tester setup and makes it easier for app users
to use the codegen at the app level.

Changelog:
[Internal] [Changed] - [Android] Link against the app codegen if available

Reviewed By: cipolleschi

Differential Revision: D40936941

fbshipit-source-id: 26fa4d764fb369c987e94e0c3bce61841b982b27
2022-11-02 08:22:05 -07:00
Ruslan Shestopalyuk e89d223c31 Remove misleading comment about RootTag type not being opaque
Summary: Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D40902247

fbshipit-source-id: 5ed8f69bb46e35d5250bd04898765ead500d7db6
2022-11-02 07:44:34 -07:00
Samuel Susla 64c3906280 Remove redundant import from TextInputSharedExamples
Summary:
changelog: [internal]

Fix lint error

Reviewed By: cipolleschi

Differential Revision: D40936194

fbshipit-source-id: 24987f86f1f95d42f978baaa560bfd57381ca5a4
2022-11-02 06:06:52 -07:00
William Sawyer 74cb441e97 Corrected documentation to be more gramatically correct (#35141)
Summary:
The documentation for `useColorScheme()` suggested that the user's preferred color scheme will be 'Dark Mode'. Instead suggesting 'Dark Mode' as an example of what the user's preferred color scheme could be is more correct.

## Changelog
[INTERNAL] [FIXED] - Edited documentation for `useColorScheme()` hook
Edited
```javascript
/**
 * A new useColorScheme hook is provided as the preferred way of accessing
 * the user's preferred color scheme (aka Dark Mode).
 */
export function useColorScheme(): ColorSchemeName;
```
to
```javascript
/**
 * A new useColorScheme hook is provided as the preferred way of accessing
 * the user's preferred color scheme (e.g. Dark Mode).
 */
export function useColorScheme(): ColorSchemeName;
```

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

Test Plan: Documentation only - no testing required.

Reviewed By: cipolleschi

Differential Revision: D40934781

Pulled By: rshest

fbshipit-source-id: acac8947c3f99016839be27f505066e8992a20fa
2022-11-02 05:37:43 -07:00
Héctor Ramos 358b7a4458 hermes-utils.js: Add test coverage
Summary:
Improving test coverage in anticipation of some changes being made to `hermes-utils.js`.

Moved test scripts to `hermes/__tests__` and grouped related tests.

We have been delegating some of the work to local binaries via `execSync`, which can be hard to mock or test.  We now use a proxy `delegateSync` method that uses `spawnSync` internally to break down the invocation into `command`, `arguments`, `options`. Instead of simply mocking based on the command being executed, we can now conditionally mock based on the arguments being passed.

Added a `createTarballFromDirectory` method. This can be used later when creating different tarballs.

Added `populateMockFilesystemWithHermesBuildArtifacts()` to mock the filesystem state after Hermes has been built.

Changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D40871802

fbshipit-source-id: 4348d3c38926ec7eb13d794040a9040010879f58
2022-11-01 18:27:39 -07:00
Héctor Ramos b5bb227be8 Hermes: Include iOS debug symbols in Hermes XCFramework
Summary:
Include dSYMs when building the universal XCFramework for Hermes iOS.

CocoaPods should pick up dSYMs automatically when using `vendored_framework` if:
- `hermes.framework` has a `hermes.framework.dSYM` in the same base directory
- `hermes.xcframework` has a `dSYMs` folder with a `hermes.framework.dSYM` in it, for each slice

The dSYMs for the macOS hermes.framework are already being created.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D40790250

fbshipit-source-id: 50fcb3492434637b00458c1aa443ac6ec5472fac
2022-11-01 18:27:39 -07:00
Ramanpreet Nara 7964d484bc Introduce soft exceptions in the bridgeless core
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D40824468

fbshipit-source-id: c840610e923c35cc5c36b37e5c580d0296c1e46b
2022-11-01 17:14:11 -07:00
Mike Vitousek 91d58cf5b5 Codemod cycle annotations for xplat/js
Summary:
Add annotations using flow codemod annotate-cycles --write

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D40896688

fbshipit-source-id: 0c32932d17542be070360db29b7797f8e6e5978b
2022-11-01 17:13:27 -07:00
Héctor Ramos d71d0db51d hermes-utils: Strip debug symbols during tarball creation (#35162)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35162

The dSYMs for Apple will not be distributed as part of the prebuilts tarball. They can still be included in the tarball by passing a `-d` flag to the create-tarball script.

Changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D40813679

fbshipit-source-id: 26dee8251684c5ecad649ccd27ce688cfe88ec8f
2022-11-01 16:02:21 -07:00
Sam Zhou dbb9252d28 Annotate `Array.map` returns when the implicit return type is widened
Summary: Changelog: [Internal]

Differential Revision: D40840078

fbshipit-source-id: 0104444060d8d6a1a22066d63579ac06ff715226
2022-11-01 13:37:03 -07:00
Luna Wei cfe811ab18 Fix natively driven animated.event for bubbling PointerEvents
Summary:
Changelog: [Internal]

Override logic for determining whether a dispatched `Event` triggers a native `EventAnimationDriver`.

Natively driven AnimatedEvents on bubbling events is not supported.  `PointerEvents` requires this and this diff adds custom matching logic such that if a parent specifies an `AnimatedEvent` on `onPointerMove` and a child view dispatches it, the `AnimatedEvent` will still fire.

Reviewed By: javache

Differential Revision: D38722563

fbshipit-source-id: 7cde57eaff9584b33c6ab15f1fe85c0a9bac132e
2022-11-01 12:50:05 -07:00
Luna Wei 565a7439ac Refactor EventDriverAnimations to customize event match
Summary:
Changelog: [Internal] - Refactor match logic on determining whether to run an EventAnimationDriver (drivers for natively animated events) for an Event dispatched.

Previously, drivers were stored by key on the NativeAnimatedNodesManager (based on event handler and viewTag) and has been refactored to be stored in a list for easier matching.

This diff changes it so the match logic for running an EventAnimationDriver happens on the Event instance. This change is motivated by PointerEvents needing custom match logic (done on a following change).

Reviewed By: javache

Differential Revision: D40691002

fbshipit-source-id: e4f6742a2af3b751214aefa1fc069f65e8e71d77
2022-11-01 12:50:05 -07:00
Dmytro Voronkevych c565a770eb Migrating all qpl.markerAnnotate call sites to the new signature
Summary:
As part of unifying JS QPL interface, I'm bringing markerAnnotate to the parity with Web version.

At the moment it supports only string annotations, but I'm adding support for ints, arrays of ints, arrays of strings, etc.

## Changelog:
[Internal] [Changed] - Refactored markerAnnotateWithMap -> markerAnnotate

Reviewed By: eddyerburgh

Differential Revision: D40796535

fbshipit-source-id: 9831e353036835b97bb7b2f60085016034c04269
2022-11-01 12:25:00 -07:00
Dmytro Voronkevych e3eeadb63a Adding new markerAnnotateWithMap method
Summary:
## Changelog:
[Internal] [Added] - Adding new markerAnnotateWithMap to the QPL.

This is part of bigger effort to unify JS QPL interfaces across platforms.

Reviewed By: eddyerburgh

Differential Revision: D40796537

fbshipit-source-id: a75b97c20ca411653552228f7dc2fcbedd8ddca9
2022-11-01 12:25:00 -07:00
Xin Chen 58a1cd2367 Add unit test for ImageView to take null uri in source
Summary:
This is a follow up action item from S295231 and T136039462 where we want to make sure null uri in image source is handled properly. This diff adds an unit test to make sure we are using transparent image when uri is null.

Changelog:
[Android][Internal] - Add unit test to ImageView for null uri in source

Reviewed By: javache

Differential Revision: D40732791

fbshipit-source-id: fd468bfe7c33a4f3f8913ead3e84a1770d7c907f
2022-11-01 12:11:10 -07:00
Dmitry Rykun 6b8e13f53c Integrate Hermes with the Xcode build process
Summary:
## Context
If React Native is built from *main* of any non-stable commit, then Hermes is built from source. The build is performed by `build-ios-framework.sh` and `build-mac-framework.sh` scripts in `hermes-engine.podspec` `prepare_command` stage. Since those scripts have no access build target information, they build all possible architectures and platforms just in case. That takes ages.
## Solution
The idea is to integrate build script into Xcode *run script* phase, and use build target information to build Hermes for active architecture only.
## Implementation
- Existing behaviour remains unchanged for local tarball and remote prebuild cases.
- `build-hermesc-xcode.sh` builds Hermesc as `hermes-engine.podspec` `prepare_command`. Default build location is `react-native/sdks/hermes-engine/build_host_hermesc`.
- `build-hermes-xcode.sh` builds Hermes in 'Build Hermes' Xcode script phase. It uses `$PLATFORM_NAME`, `$CONFIGURATION`, `$ARCHS`, `$IPHONEOS_DEPLOYMENT_TARGET` and `$MACOSX_DEPLOYMENT_TARGET` environment variables to configure cmake project so it builds only active architecture. The script also gets RN version, *cmake* path and *hermesc* path from the podspec.
- `copy-hermes-xcode.sh` copies Hermes.framework inside the app bundle. This script phase is added to the user app target in a `post_install` hook, after pods are integrated in a user project.
- `OTHER_LDFLAGS -framework "hermes"` added to the user project to enable linking against Hermes.framework.
- If `HERMES_OVERRIDE_HERMESC_PATH` is set, then Hermesc building is skipped, and `HERMES_OVERRIDE_HERMESC_PATH` is used for `build-hermes-xcode.sh`.
- `HERMES_CLI_PATH` is injected into user project config to enable Hermes source maps in `react-native-xcode.sh`.
## Things that didn't work
- *Running build-hermesc-xcode.sh in Xcode run script phase*. This doesn't work because Hermesc is supposed to be built for macos, and if build target is ios, then Xcode configures environment in such a way that Hermesc build fails.
- *Installing Hermesc into CocoaPods download folder*. So it then ends up in `Pods/hermes-engine/build_host_hermesc`, and all the housekeeping is handled by CocoaPods. This doesn't work because cmake uses absolute paths in a configured project. If configured project is moved to a different location, nothing builds.
- *Installing Hermesc directly into Pods/hermes-engine*. This doesn't work because CocoaPods runs prepare_command before Pods folder clean up, and everything gets wiped.
## Known issue
-  If `Pods/hermes-engine` is manually removed, then `sdks/hermes-engine/build_host_hermesc` must also be removed before running `pod install`. Otherwise cmake will complain about stale cache:
```
CMake Error: The source "<CocoaPodsCache>/hermes-engine/<hash2>/CMakeLists.txt" does not match the source
"<CocoaPodsCache>/hermes-engine/<has1>/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.
```
## Benchmark
MacBook M1 2021 32 GB.
```
export REACT_NATIVE_PATH=~/fbsource/xplat/js/react-native-github
cd $REACT_NATIVE_PATH/packages/rn-tester
pod install
rm -rf $REACT_NATIVE_PATH/sdks/hermes-engine/build_host_hermesc
cd $REACT_NATIVE_PATH/packages/rn-tester/Pods/hermes-engine
echo 't1=$(date +%s); $@; t2=$(date +%s); diff=$(echo "$t2 - $t1" | bc); echo Operation took $diff seconds.' > /tmp/benchmark.sh
```
```
# Before
export BUILD_TYPE=Debug
export JSI_PATH=$REACT_NATIVE_PATH/ReactCommon/jsi
export RELEASE_VERSION=1000.0
export IOS_DEPLOYMENT_TARGET=iphonesimulator
export MAC_DEPLOYMENT_TARGET=12.6
cd $REACT_NATIVE_PATH/packages/rn-tester/Pods/hermes-engine
. /tmp/benchmark.sh $REACT_NATIVE_PATH/sdks/hermes-engine/utils/build-ios-framework.sh
# Operation took 252 seconds
. /tmp/benchmark.sh $REACT_NATIVE_PATH/sdks/hermes-engine/utils/build-mac-framework.sh
# Operation took 179 seconds
```
```
# After
. /tmp/benchmark.sh source $REACT_NATIVE_PATH/sdks/hermes-engine/utils/build-hermesc-xcode.sh $REACT_NATIVE_PATH/sdks/hermes-engine/build_host_hermesc
# Operation took 59 seconds.
. /tmp/benchmark.sh xcodebuild -workspace $REACT_NATIVE_PATH/packages/rn-tester/RNTesterPods.xcworkspace -scheme hermes-engine
# Operation took 106 seconds.
```
|Before|||After|||
|--|
|iOS framework (s)|Mac framework (s)|Total (s)|Hermesc (s)|Target-specific framework (s)|Total (s)|
|252|179|431|59|106|**165 (-266) (-61%)**|
The performance win is fixed, and does not depend on the project size and structure.
As an example, this is how these changes affect build time of RNTester.
|Before||||After|||
|--|
||Pod install (s)|Xcode build (s)|Total (s)|Pod install (s)|Xcode build (s)|Total (s)|
|Clean build|1219|132|1352|734 (-485)|249(+117)|**983 (-369)**|
|Incremental build|82|30|112|105 (+23)|**34 (+4)**|139 (+27)|
The most important values here are the total clean build time and the incremental Xcode build time. The first one went down by 369 seconds, the second one went up by 4 seconds. I consider it a reasonable tradeoff.
The extra 4 seconds in  the incremental Xcode build time can potentially be mitigated by setting up output file lists for the new script phases.

allow-large-files

Changelog:
[iOS][Changed] - Hermes is integrated into Xcode build.

Reviewed By: hramos

Differential Revision: D40063686

fbshipit-source-id: e6993d62225789377db769244bc07786cc978a27
2022-11-01 11:55:41 -07:00
Samuel Susla f49b2517d7 React Native sync for revisions 54f297a...ab075a2
Summary:
This sync includes the following changes:
- **[ab075a232](https://github.com/facebook/react/commit/ab075a232 )**: Do not unmount layout effects on initial Offscreen mount ([#25592](https://github.com/facebook/react/pull/25592)) //<Samuel Susla>//
- **[765805bf8](https://github.com/facebook/react/commit/765805bf8 )**: Fix type check for null ([#25595](https://github.com/facebook/react/pull/25595)) //<Sebastian Markbåge>//
- **[2ac77aab9](https://github.com/facebook/react/commit/2ac77aab9 )**: Clean up vestige of useOpaqueIdentifier ([#25587](https://github.com/facebook/react/pull/25587)) //<Andrew Clark>//
- **[bdd3d0807](https://github.com/facebook/react/commit/bdd3d0807 )**: Extract logic for detecting bad fallback to helper //<Andrew Clark>//
- **[952dfff3f](https://github.com/facebook/react/commit/952dfff3f )**: Split suspended work loop logic into separate functions //<Andrew Clark>//
- **[d2c0ab10d](https://github.com/facebook/react/commit/d2c0ab10d )**: In work loop, add enum of reasons for suspending //<Andrew Clark>//
- **[5450dd409](https://github.com/facebook/react/commit/5450dd409 )**: Strict Mode: Reuse memoized result from first pass ([#25583](https://github.com/facebook/react/pull/25583)) //<Andrew Clark>//
- **[d2a0176a1](https://github.com/facebook/react/commit/d2a0176a1 )**: Detect and warn if use(promise) is wrapped with try/catch block ([#25543](https://github.com/facebook/react/pull/25543)) //<Andrew Clark>//
- **[cf3932be5](https://github.com/facebook/react/commit/cf3932be5 )**: Remove old react-fetch, react-fs and react-pg libraries ([#25577](https://github.com/facebook/react/pull/25577)) //<Sebastian Markbåge>//
- **[28a574ea8](https://github.com/facebook/react/commit/28a574ea8 )**: Try assigning fetch to globalThis if global assignment fails ([#25571](https://github.com/facebook/react/pull/25571)) //<Sebastian Markbåge>//
- **[09def5990](https://github.com/facebook/react/commit/09def5990 )**: [Float] handle noscript context for Resources ([#25559](https://github.com/facebook/react/pull/25559)) //<Josh Story>//
- **[17204056d](https://github.com/facebook/react/commit/17204056d )**: [Float] fix coordination of resource identity and hydration ([#25569](https://github.com/facebook/react/pull/25569)) //<Josh Story>//
- **[d925a8d0b](https://github.com/facebook/react/commit/d925a8d0b )**: Flight client error stack ([#25560](https://github.com/facebook/react/pull/25560)) //<Josh Story>//
- **[996b00b78](https://github.com/facebook/react/commit/996b00b78 )**: [Tiny] Fixed incorrect import in `react-server-dom-webpack` ([#25554](https://github.com/facebook/react/pull/25554)) //<Leo Lamprecht>//
- **[e7c5af45c](https://github.com/facebook/react/commit/e7c5af45c )**: Update cache() and use() to the canary aka next channel ([#25502](https://github.com/facebook/react/pull/25502)) //<Sebastian Markbåge>//
- **[fa77f52e7](https://github.com/facebook/react/commit/fa77f52e7 )**: Unify promise switch statements //<Andrew Clark>//
- **[7572e4931](https://github.com/facebook/react/commit/7572e4931 )**: Track thenable state in work loop //<Andrew Clark>//
- **[7fc3eefd8](https://github.com/facebook/react/commit/7fc3eefd8 )**: Revert yieldy behavior for non-use Suspense (in Flight, too) //<Andrew Clark>//
- **[61f9b5e97](https://github.com/facebook/react/commit/61f9b5e97 )**: [Float] support <base> as Resource ([#25546](https://github.com/facebook/react/pull/25546)) //<Josh Story>//
- **[1d3fc9c9c](https://github.com/facebook/react/commit/1d3fc9c9c )**: Bug fix when resolving cache ([#25545](https://github.com/facebook/react/pull/25545)) //<Sebastian Markbåge>//
- **[cce18e350](https://github.com/facebook/react/commit/cce18e350 )**: [Flight] Use AsyncLocalStorage to extend the scope of the cache to micro tasks ([#25542](https://github.com/facebook/react/pull/25542)) //<Sebastian Markbåge>//
- **[caa84c8da](https://github.com/facebook/react/commit/caa84c8da )**: Revert fetch instrumentation to only RSC ([#25540](https://github.com/facebook/react/pull/25540)) //<Sebastian Markbåge>//
- **[0c11baa6a](https://github.com/facebook/react/commit/0c11baa6a )**: add warnings for non-resources rendered outside body or head ([#25532](https://github.com/facebook/react/pull/25532)) //<Josh Story>//
- **[9236abdb5](https://github.com/facebook/react/commit/9236abdb5 )**: when float is enabled only push title and script as a single unit ([#25536](https://github.com/facebook/react/pull/25536)) //<Josh Story>//
- **[dd5c20825](https://github.com/facebook/react/commit/dd5c20825 )**: Revert yieldy behavior for non-use Suspense ([#25537](https://github.com/facebook/react/pull/25537)) //<Andrew Clark>//
- **[934177598](https://github.com/facebook/react/commit/934177598 )**: fix transposed escape functions ([#25534](https://github.com/facebook/react/pull/25534)) //<Josh Story>//
- **[d1ced9fd5](https://github.com/facebook/react/commit/d1ced9fd5 )**: [Float] support all links as Resources ([#25515](https://github.com/facebook/react/pull/25515)) //<Josh Story>//
- **[973b90bdf](https://github.com/facebook/react/commit/973b90bdf )**: [Float] support meta tags as Resources ([#25514](https://github.com/facebook/react/pull/25514)) //<Josh Story>//
- **[79c582981](https://github.com/facebook/react/commit/79c582981 )**: Let ReactDOM initialize in RSC ([#25503](https://github.com/facebook/react/pull/25503)) //<Sebastian Markbåge>//
- **[1f7a2f577](https://github.com/facebook/react/commit/1f7a2f577 )**: [Float] support title tags as Resources ([#25508](https://github.com/facebook/react/pull/25508)) //<Josh Story>//
- **[c63580787](https://github.com/facebook/react/commit/c63580787 )**: Support `use` in `act` testing API ([#25523](https://github.com/facebook/react/pull/25523)) //<Andrew Clark>//
- **[65e32e58b](https://github.com/facebook/react/commit/65e32e58b )**: Add fetch Instrumentation to Dedupe Fetches ([#25516](https://github.com/facebook/react/pull/25516)) //<Sebastian Markbåge>//
- **[9336e29d9](https://github.com/facebook/react/commit/9336e29d9 )**: [useEvent] Lint for presence of useEvent functions in dependency lists ([#25512](https://github.com/facebook/react/pull/25512)) //<lauren>//
- **[3cc792bfb](https://github.com/facebook/react/commit/3cc792bfb )**: [useEvent] Non-stable function identity ([#25473](https://github.com/facebook/react/pull/25473)) //<lauren>//
- **[987292815](https://github.com/facebook/react/commit/987292815 )**: Remove feature flag enableStrictEffects ([#25387](https://github.com/facebook/react/pull/25387)) //<Samuel Susla>//
- **[8e2bde6f2](https://github.com/facebook/react/commit/8e2bde6f2 )**: Add cache() API ([#25506](https://github.com/facebook/react/pull/25506)) //<Sebastian Markbåge>//
- **[9cdf8a99e](https://github.com/facebook/react/commit/9cdf8a99e )**: [Codemod] Update copyright header to Meta ([#25315](https://github.com/facebook/react/pull/25315)) //<Andrew Clark>//
- **[e54015e26](https://github.com/facebook/react/commit/e54015e26 )**: Refactor: fill in the flow missing type ([#25496](https://github.com/facebook/react/pull/25496)) //<c0dedance>//
- **[3b1fd5767](https://github.com/facebook/react/commit/3b1fd5767 )**: refactor: Flow: typing of Scheduler ([#25485](https://github.com/facebook/react/pull/25485)) //<bubucuo>//
- **[14072ce64](https://github.com/facebook/react/commit/14072ce64 )**: Add detach to Offscreen component ([#25265](https://github.com/facebook/react/pull/25265)) //<Samuel Susla>//
- **[3bb71dfd4](https://github.com/facebook/react/commit/3bb71dfd4 )**: Rename react-server-dom-webpack entry points to /client and /server ([#25504](https://github.com/facebook/react/pull/25504)) //<Sebastian Markbåge>//
- **[71f2c8cf1](https://github.com/facebook/react/commit/71f2c8cf1 )**: move resource acquisition to mutation phase ([#25500](https://github.com/facebook/react/pull/25500)) //<Josh Story>//
- **[500bea532](https://github.com/facebook/react/commit/500bea532 )**: Add option to load Fizz runtime from external file ([#25499](https://github.com/facebook/react/pull/25499)) //<Andrew Clark>//
- **[4494f2a86](https://github.com/facebook/react/commit/4494f2a86 )**: [Float] add support for scripts and other enhancements ([#25480](https://github.com/facebook/react/pull/25480)) //<Josh Story>//
- **[9ecf84ed7](https://github.com/facebook/react/commit/9ecf84ed7 )**: Bugfix: Suspending in shell during discrete update ([#25495](https://github.com/facebook/react/pull/25495)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 54f297a...ab075a2

jest_e2e[run_all_tests]

Reviewed By: kassens

Differential Revision: D40897093

fbshipit-source-id: 6a040315834dea5c0ab994ea94d91f5605b9d6b0
2022-11-01 10:45:24 -07:00
Riccardo Cipolleschi 40ad31eacf Set C++ version for libs (#35160)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35160

With the simplified migration to the new arch, we are offering a function in cocoapods that takes care of configuring all the dependencies for libraries.

That function was not setting the proper version of C++ for the library. This could lead to build problems.

This Diff make sure that the libraries that are created with this function call have the proper C++ version.

NOTE: we already have a post install hook that was setting the the proper C++ version, but that was only working for the project. Plus, we can't read that version from the React-Core podspec because at the podspec definition time, cocoapods has not read that yet. Therefore, I just hardcoded the C++ version on top of the file, so it will be easier to update if we decide to change it.

## Changelog
[iOS][Fixed] - Make sure that libraries created with `install_modules_dependencies` has the right C++ version.

Reviewed By: dmytrorykun

Differential Revision: D40894561

fbshipit-source-id: a5187be2d85888a335d4c033f16fdacaf2c945f9
2022-11-01 07:47:23 -07:00
Oleksandr Melnykov 1e6945e19e Back out "Add perftest dev support manager"
Summary: Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D40879099

fbshipit-source-id: ff302819829aa21a1dd7c19c06ed8c29821ba815
2022-10-31 23:01:40 -07:00
Marco Fiorito 745e26288c refactor(rn tester app): change dimensions example to hooks (#35084)
Summary:
This pull request migrates the dimensions example to using React Hooks.

## Changelog
[General] [Changed] - RNTester: Migrate Dimensions to hooks

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

Test Plan: The animation works exactly as it did as when it was a class component

Reviewed By: yungsters

Differential Revision: D40779014

Pulled By: NickGerleman

fbshipit-source-id: e740684d3022a945da5abc33b2e8834c6cfabb97
2022-10-31 16:23:54 -07:00
George Zahariev 07bd590843 exact_empty_objects is on by default in 0.191, delete usage in fbsource
Summary:
`exact_empty_objects` is on by default in 0.191, delete usage

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D40822684

fbshipit-source-id: 8e84f0542e6b66049cac34e429f0b724f85a9557
2022-10-31 15:31:29 -07:00
Héctor Ramos 8f124be40e Hermes scripts: rename tarball methods to distinguish between source code and prebuilt artifacts (#35156)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35156

There are two tarballs: the source code for Hermes that is downloaded from GitHub, and the hermes-runtime-darwin-{}-v{}.tar.gz tarball with prebuilt artifacts that is built in CI.
Renamed some methods to make it clearer which tarball they work with.

Changelog: [internal]

Reviewed By: cipolleschi, dmytrorykun

Differential Revision: D40812290

fbshipit-source-id: a2c865e1d1461829fe8d468f52deeb55f3565cb0
2022-10-31 15:30:02 -07:00
Ruslan Lesiutin 20eeb1bfe3 refactor(react-native-github): remove AsyncStorage from JS
Summary:
## Changelog
[JS][Removed] - Removed AsyncStorage module from react-native

Reviewed By: NickGerleman

Differential Revision: D40302352

fbshipit-source-id: 9377ea12036e498dde0b4b0f56de5c4fb9bd2461
2022-10-31 14:39:19 -07:00
Ruslan Lesiutin 4de2aaba50 refactor(AsyncStorage): move iOS files from react-native-github
Summary:
## Changelog:
[iOS][Removed] - Removed AsyncStorage module

Reviewed By: lunaleaps

Differential Revision: D40283712

fbshipit-source-id: 5e74c71915c2fbba4363e3fc917555039069038e
2022-10-31 14:39:19 -07:00
Ruslan Lesiutin 5738fe6426 refactor(AsyncStorage): move android files from react-native-github
Summary:
## Changelog:
[Android] [Removed] - Removed AsyncStorage module

Reviewed By: lunaleaps

Differential Revision: D40175995

fbshipit-source-id: b583579b8c2fa6c502f265ffe464b81672bd7da5
2022-10-31 14:39:19 -07:00
Antoine Doubovetzky 83e2126b57 Extract isModuleRegistryCall function in parsers/utils (#35139)
Summary:
This PR is a task from https://github.com/facebook/react-native/issues/34872:
> Extract the function isModuleRegistryCall ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/utils.js#L175-L211) [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/utils.js#L167-L203)) into a single function in the parsers/utils.js file and replace its invocation with this new function.

## 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] - Extract the function isModuleRegistryCall in parsers/utils

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

Test Plan: I tested using Jest and Flow commands.

Reviewed By: rshest

Differential Revision: D40850471

Pulled By: cipolleschi

fbshipit-source-id: 34ec8ea4d7175e205315d60f200df093f1204b7b
2022-10-31 13:56:27 -07:00
Antoine Doubovetzky 56d7a87e84 Fix assertGenericTypeAnnotationHasExactlyOneTypeParameter throwing wrong error (#35134)
Summary:
1. I noticed there was a mistake in the [IncorrectlyParameterizedGenericParserError](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/errors.js#L159):
```
if (
  genericTypeAnnotation.typeParameters.type ===
    'TypeParameterInstantiation' &&
  genericTypeAnnotation.typeParameters.params.length !== 1
) {
```

Here we should replace ` 'TypeParameterInstantiation'` with ` 'TSTypeParameterInstantiation'` when the language is `TypeScript`.

The result is that we get a ["Couldn't create IncorrectlyParameterizedGenericParserError"](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/errors.js#L172) error instead of ["Module testModuleName: Generic 'typeAnnotationName' must have exactly one type parameter."](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L88).

I added a [test case](2f161166c0) to cover this case:
<img width="1008" alt="Capture d’écran 2022-10-30 à 13 55 56" src="https://user-images.githubusercontent.com/17070498/198879598-ab5a6092-8cbf-422a-9993-2f3f92c9d84c.png">

2. Looking closely at where IncorrectlyParameterizedGenericParserError is used, I noticed that the logic was duplicated in [assertGenericTypeAnnotationHasExactlyOneTypeParameter](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L65).

I believe that the logic should reside in `assertGenericTypeAnnotationHasExactlyOneTypeParameter` so I split the `IncorrectlyParameterizedGenericParserError` in 2 different errors.

## 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] - Fix assertGenericTypeAnnotationHasExactlyOneTypeParameter throwing wrong error

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

Test Plan: I tested using Jest and Flow commands.

Reviewed By: rshest

Differential Revision: D40853200

Pulled By: cipolleschi

fbshipit-source-id: 7040e57e0a2f511ba23fd4c54beae2ccff2fa89d
2022-10-31 13:56:27 -07:00
Gabriel Donadel Dall'Agnol ea55e3bf8d chore: Unify codegen Flow and TS default case from translateTypeAnnotation (#35086)
Summary:
This PR unifies the Flow and TS `default:` case from codegen `translateTypeAnnotation` function into a single function
called `translateDefault` inside `parser-commons.js` as requested on https://github.com/facebook/react-native/issues/34872.

## Changelog

[Internal] [Changed] - Unify codegen Flow and TS default case from translateTypeAnnotation

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

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

![image](https://user-images.githubusercontent.com/11707729/197931439-a0f0f7cd-eee7-4908-a7f1-856b40954178.png)

Reviewed By: cortinico

Differential Revision: D40801612

Pulled By: cipolleschi

fbshipit-source-id: 612768d6fabe091ac428e7d8416c6da059fe1332
2022-10-31 13:56:27 -07:00
Riccardo Cipolleschi ab7b4d4cd8 Restore Filtering platform in codegen (#35028)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35028

**This Diff require a bump in the react-native-codegen (including this [commit](7680bdeb4f)) to work**

This diff sets up iOS and Android to pass their platform to the codegen so that we can have platform-specific specs.

## Changelog
[General][Added] - Enable platform-specific Codegen Specs

Reviewed By: cortinico

Differential Revision: D40516395

fbshipit-source-id: 0624f0bfb93c90f78131a605a4847e780783bbaf
2022-10-31 12:31:00 -07:00
Riccardo Cipolleschi a2166b24f8 bump codegen to v0.71.1 (#35154)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35154

This diff bumps the codegen to v0.71.1, preparing it for the branch cut.

## Changelog
[General][Changed] - Bump codegen version

Reviewed By: dmytrorykun

Differential Revision: D40852498

fbshipit-source-id: ba1dc87f3726bc27cbd176f160c62a0bdc291433
2022-10-31 12:31:00 -07:00
Christoph Purrer 76c7ccaa60 Enable ManagedObjectWrapper on react-native-macOS (#35146)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35146

This class is used by Fabric - but does not compile on macOS yet.

Changelog:
[iOS][Fixed] Make ManagedObjectWrapper compile on macOS

Reviewed By: javache

Differential Revision: D40839241

fbshipit-source-id: 73b93a9963db89af19529fbfd60a64f4e5aaf036
2022-10-31 05:31:13 -07:00
Gabriel Donadel Dall'Agnol e3e635ef84 feat: Add "option" to available role values (#35137)
Summary:
As pointed out by efoken on https://github.com/facebook/react-native/issues/34424#issuecomment-1283854395 we forgot we add the `option` value to the `role` prop, so this PR adds this missing value as requested on https://github.com/facebook/react-native/issues/34424.

## Changelog

[General] [Added] - Add "option" to available role values

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

Test Plan: Ensure that CI is green as there isn't much to test in this case because we're just adding a value that maps to `undefined`

Reviewed By: jacdebug

Differential Revision: D40849497

Pulled By: NickGerleman

fbshipit-source-id: 5e3e24c0ff05c361a7a8dc1ee1f20ba3fb6988ca
2022-10-31 04:47:35 -07:00
Nick Gerleman f3d9f2ea23 Map `accessibilityRole: grid` to `UIAccessibilityTraitNone`
Summary:
D38121921 (5ddb9977e6) added a grid accessibilityRole to Flow typings and RNTester example shared with iOS. It it forwarded on Android, but doesn't have an equivalent UIAccessibilityTrait mapping.`RNTesterSnapshotTests/testScrollViewExample` reports an error:
```
Failure: RedBox errors: (
    "Error setting property 'accessibilityRole' of RCTScrollView with tag #125: Invalid UIAccessibilityTraits 'grid'. should be one of: (
    adjustable,
====================== 38 lines skipped ======================
) (NSInternalInconsistencyException)
Path: <unknown>
Line: 0
```

This adds the grid mapping, which I think should fix this error.

Changelog:
[ios][Fixed] - Map `accessibilityRole: grid` to `UIAccessibilityTraitNone`

Reviewed By: christophpurrer

Differential Revision: D40848904

fbshipit-source-id: 80f72bcd4e4826cc0d535693117a6c1e5fbd1d7d
2022-10-31 04:18:44 -07:00
Christoph Purrer 84737e0069 Remove unused #import <UIKit/UIGestureRecognizerSubclass.h> import which breaks macOS (#35131)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35131

Changelog:
[iOS][Fixed] - Remove unused #import <UIKit/UIGestureRecognizerSubclass.h> import which breaks macOS

Reviewed By: cortinico

Differential Revision: D40797971

fbshipit-source-id: 29839913a642247576caba9fe34724129c2bd3ba
2022-10-31 04:17:13 -07:00
atp ad5e3f6b9a Fix typo syncronization -> synchronization (#35132)
Summary:
Fix typo

## Changelog
[General][Fixed] - Fixed typo syncronization -> synchronization
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[CATEGORY] [TYPE] - Message

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

Reviewed By: christophpurrer

Differential Revision: D40832387

Pulled By: rshest

fbshipit-source-id: 834ece525e4469c942e678e2a3d4ecf30be4f550
2022-10-31 02:32:58 -07:00
Christoph Purrer 87c356d56c Add Map / indexed object support for TypeScript parser (#35098)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35098

Changelog:
[General][Fixed] [react-native-codegen] react-native-codegen : Add Map / indexed object support for TypeScript parser

In flow we can expose Maps via the following syntax in TM specs

`
+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};
`

In TypeScript writing the same spec:

`
readonly getMap: (arg: { [key: string]: number | null; }) => { [key: string]: number | null; };
`

leads to an exception the TypeScript code-gen parser

```UnsupportedObjectPropertyTypeAnnotationParserError: Module NativeTurboModuleCxx: 'ObjectTypeAnnotation' cannot contain 'TSIndexSignature'.
    at react-native-github/packages/react-native-codegen/src/parsers/typescript/modules/index.js:309:23```
```
This change fixes the TypeScript parser

Reviewed By: cipolleschi

Differential Revision: D40753368

fbshipit-source-id: 0eef8ecb63d1ed049fde1e75cc6f2ec627f1f232
2022-10-30 05:48:57 -07:00
Gabriel Donadel Dall'Agnol 87d65803ab chore: Extract codegen case 'Float' into a single emitFloat function (#35124)
Summary:
## Summary

This PR extracts the content of the codegen case `'Float'` into a single `emitFloat` 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 `emitFloat` function.

## Changelog

[Internal] [Changed]  - Extract the content of the case 'Float' into a single emitFloat function

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

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

![image](https://user-images.githubusercontent.com/11707729/198704932-202e2cd7-5b04-4009-b47e-b4999fee6c98.png)

Reviewed By: rshest

Differential Revision: D40828746

Pulled By: cipolleschi

fbshipit-source-id: 9c7cecf7268f16aaef29065c1983ad9a4dd18dbe
2022-10-29 06:40:54 -07:00
Nicola Corti cec9a34f6c Sets the namespace via Gradle and not via AndroidManifest (#35094)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35094

Currently the build on console is firing this warning:
```
> Task :app:processDebugMainManifest
package="com.androidtemplateproject" found in source AndroidManifest.xml: /tmp/AndroidTemplateProject/android/app/src/main/AndroidManifest.xml.
Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated.
Please instead set the namespace (or testNamespace) in the module's build.gradle file, as described here: https://developer.android.com/studio/build/configure-app-module#set-namespace
This migration can be done automatically using the AGP Upgrade Assistant, please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.
```

This diff fixes it so users won't see it anymore on 0.71

Changelog:
[Android] [Fixed] - Sets the namespace via Gradle and not via AndroidManifest

Reviewed By: cipolleschi

Differential Revision: D40724654

fbshipit-source-id: 9b01748a22e9993b60e17bf25acbc68ba8e4eb77
2022-10-29 06:35:38 -07:00
Riccardo Cipolleschi ec5a4301a3 Separatedly enable TM/Fabric (#35117)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35117

This mimics some behavior we have in Android that allow uesers to turn on selectively TM and Fabric.

Notice that if fabric is enabled, TM must be enabled as well, otherwise the app won't work

## Changelog
[iOS][Added] - Added the possibility to selectively enable TM and Fabric with the new Architecture

Reviewed By: cortinico

Differential Revision: D40794328

fbshipit-source-id: b7fc7bb819d05566dcd335832cab224f80b23346
2022-10-29 04:00:24 -07:00