Commit Graph

38536 Commits

Author SHA1 Message Date
Adam Cmiel 23fad5e2db Annotate free functions (#37458)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37458

Changelog:
Add nullability annotations for RCTInstanceRuntimeDiagnosticFlags and RCTInstanceSetRuntimeDiagnosticFlags

Reviewed By: ebgraham

Differential Revision: D45908542

fbshipit-source-id: 1f3edb566133c8e6198f39f049acf7b0284e7e5e
2023-05-17 07:51:51 -07:00
Samuel Susla 0a4a95f568 Add a feature flag to disable [CATransaction commit] during mount (#37459)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37459

changelog: [internal]

Let's try to dissable manual `[CATransaction commit]`. This may reduce UI thrash in case several Fabric transactions are committed within single UIRunLoop tick.

While working on [the new architecture benchmarks](https://github.com/reactwg/react-native-new-architecture/discussions/123), with the help of instrumentation I noticed two paints on some occasions. This was happening around 50% of the time I executed a scenario. It dropped the rendering time on 5k of <Text /> from ~800ms down to ~600ms.
Also, the original reason why `[CATransaction commit]` was added has passed. It was added to make Screenshot tests less flaky but we no longer use screenshot tests.

Reviewed By: javache

Differential Revision: D45870408

fbshipit-source-id: 23112c2d92451aba40ad770ffd34f4d5f0ea585f
2023-05-17 04:50:08 -07:00
Antoine Doubovetzky f05252ae4e refactor(codegen): extract throwIfArgumentPropsAreNull function in error-utils (#37252)
Summary:
This PR contains task 117 from https://github.com/facebook/react-native/issues/34872:
> [Codegen 117] Extract the code that throws if argumentProps are null in a throwIfArgumentPropsAreNull function in the error-utils.js file. Use it in the [flow/components/events.js](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/flow/components/events.js#L240-L242) and in the [typescript/components/event.js](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/typescript/components/events.js#L230-L231) files

bypass-github-export-checks

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Changed] - Extract throwIfArgumentPropsAreNull function in error-utils

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

Test Plan: I tested using Jest and Flow commands.

Reviewed By: dmytrorykun

Differential Revision: D45865671

Pulled By: cipolleschi

fbshipit-source-id: 6711dbed0a5ccd56075e0d13ffa13b222979b8c7
2023-05-17 03:45:34 -07:00
Kyaw Thura b5c01ee945 Add a nullLiteralTypeAnnotation: string property into the Parser object (#37387)
Summary:
Part of https://github.com/facebook/react-native/issues/34872
> [Codegen 110] Add a nullLiteralTypeAnnotation: string property into the Parser object and implement it in the FlowParser (returning
NullLiteralTypeAnnotation) and in the TypeScriptParser(returning TSNullKeyword). Replace them in the [parsers/flow/components/events.js](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/flow/components/events.js#L137-L138) and [parsers/typescript/components/events.js](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/typescript/components/events.js#L157).

bypass-github-export-checks

## Changelog:

[Internal][Added]: Add nullLiteralTypeAnnotation property in Parser object

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

Test Plan: `yarn test react-native-codegen`

Reviewed By: dmytrorykun

Differential Revision: D45779075

Pulled By: cipolleschi

fbshipit-source-id: 4ebcf8e1039d7e9188fdfe811fae1720fcba1994
2023-05-17 03:45:34 -07:00
shubham0142 9301c8fea5 codegen 107: add interfaceDeclaration prop in parsers (#37361)
Summary:
part of codegen issue https://github.com/facebook/react-native/issues/34872

> Add a interfaceDeclaration: string property to the Parser class. Implement it in the Flow parser so that it returns InterfaceDeclaration and in the TypeScriptParser so that it returns TSInterfaceDeclaration. Replace the case in the switch  in the [parsers/typescript/utils.js](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/typescript/utils.js#L69) with this prop.

bypass-github-export-checks

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal][Added]: Add interfaceDeclaration property in parsers

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

Test Plan: yarn test

Differential Revision: D45769316

Pulled By: cipolleschi

fbshipit-source-id: a7f3c6339984e643e3e35fb5b920442aea027b78
2023-05-17 03:45:34 -07:00
tarunrajput 91c60cb365 Codegen 106: add enumDeclaration property in parser class (#37355)
Summary:
Part of Codegen Issue: https://github.com/facebook/react-native/issues/34872

> Add a enumDeclaration: string property to the Parser class. Implement it in the Flow parser so that it returns EnumDeclaration and in the TypeScriptParser so that it returns TSEnumDeclaration. Replace the case in the switch  in the [parsers/flow/utils.js](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/flow/utils.js#L66) and [parsers/typescript/utils.js](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/typescript/utils.js#L78) with this prop.

bypass-github-export-checks

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal][Added] - Add enumDeclaration property in parser class

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

Test Plan: ```yarn test```

Reviewed By: christophpurrer

Differential Revision: D45736088

Pulled By: cipolleschi

fbshipit-source-id: 706a9f1fff52563e12dd6fc54cb0e89c396bba7c
2023-05-17 03:45:34 -07:00
tarunrajput 0de476803c Codegen 105: add typeAlias prop in parsers (#37334)
Summary:
Part of Codegen Issue: https://github.com/facebook/react-native/issues/34872
> Add a typeAlias: string property to the Parser class. Implement it in the Flow parser so that it returns TypeAlias and in
> the TypeScriptParser so that it returns TSTypeAliasDeclaration. Replace the case in the switch  in the [parsers/flow/utils.js](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/flow/utils.js#L57) and [parsers/typescript/utils.js](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/typescript/utils.js#L60) with this prop.

bypass-github-export-checks

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal][Added]: Add typeAlias property in parsers

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

Test Plan: ```yarn test```

Reviewed By: dmytrorykun

Differential Revision: D45691915

Pulled By: cipolleschi

fbshipit-source-id: efe5c87afc3193f6a35325190a67f98d64426ab3
2023-05-17 03:45:34 -07:00
Siddarth Kumar e09d5856f4 Add getResolvedTypeAnnotation to Parsers (#37373)
Summary:
[Codegen 104] This PR introduces `getResolvedTypeAnnotation` to the Parser class and implements this function in Typescript and Flow Parsers.

We also get rid of usages `resolveTypeAnnotation` from :
- `packages/react-native-codegen/src/parsers/typescript/utils.js`
-  `packages/react-native-codegen/src/parsers/flow/utils.js`

and replace it with `parsers.getResolvedTypeAnnotation` as requested on https://github.com/facebook/react-native/issues/34872

bypass-github-export-checks

## Changelog:

[Internal] [Changed] - Add `getResolvedTypeAnnotation ` to Parsers and update usages.

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

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

Reviewed By: dmytrorykun

Differential Revision: D45865651

Pulled By: cipolleschi

fbshipit-source-id: fdce6e5059306ebe67121aa1b212e67de864bf84
2023-05-17 03:45:34 -07:00
Philip Heinser 6d6b1fdc75 logbox footer buttons fix safearea (#36427)
Summary:
The logbox buttons on iOS are not easy to reach since they draw in the safe area. This pr should fix that.

## Changelog

[IOS] [FIXED] - logbox footer buttons respect safe area

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

Test Plan:
| after  | before  |
|---|---|
| ![IMG_3296](https://user-images.githubusercontent.com/3705499/224150030-b2637977-9fbc-4a5e-9efb-86a42a62b31a.PNG) | ![IMG_9BF70BD03E1B-1](https://user-images.githubusercontent.com/3705499/224150681-dc84295b-134a-4840-9773-23c601b24e01.jpeg)

Reviewed By: NickGerleman

Differential Revision: D43957242

Pulled By: javache

fbshipit-source-id: 9d26bc52b45c110f7bc3b0d6c1da1ed2d31a154c
2023-05-17 02:48:29 -07:00
Phillip Pan a3102175c5 get rid of unnecessary self dereference in RCTDevLoadingView (#37455)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37455

Changelog: [Internal]

these are not needed

Reviewed By: sammy-SC

Differential Revision: D45757478

fbshipit-source-id: b7c228639ade40cbfcf638ac3abd858476b47bbf
2023-05-16 18:16:20 -07:00
Phillip Pan 840e2b980d mark RCTInstance constructor as designated initializer (#37362)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37362

Changelog: [Internal]

this class should not be instantiated without its dependencies

Reviewed By: RSNara

Differential Revision: D45747779

fbshipit-source-id: ac2869858ad0ee67fbf9c04c58ff0a2bdf98c224
2023-05-16 17:47:06 -07:00
Phillip Pan a2708c8766 replace host reload notifications with hostDidStart: (#37444)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37444

Changelog: [Internal]

In this change, I'm removing these public notification strings that are used to listen to CMD + R reload by replacing them with a more general, lifecycle callback. Consumers can use this if there's anything in userland that they need to do once React is ready, such as doing some work with any native modules.

Reviewed By: sammy-SC

Differential Revision: D45760847

fbshipit-source-id: 2601ce083df827f79ea3f888f13fff1fc53c9564
2023-05-16 17:36:32 -07:00
Luna Wei b23cf101f7 Refactor set-rn-version and add tests (#37291)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37291

Changelog: [Internal] Add tests for `rn-set-version` script and refactor for clarity

Reviewed By: NickGerleman

Differential Revision: D45248915

fbshipit-source-id: f6b8566d553d0954647ba81c55767fab6a2caf1c
2023-05-16 16:44:34 -07:00
javache (Meta Employee) 2c4e809beb Always set RN$stopSurface (#26808)
Summary:
## Summary
To support incremental adoption of bridgeless logic we want to default
to using these globals whenever they're available.

## How did you test this change?
https://github.com/facebook/react-native/pull/37410

DiffTrain build for commit https://github.com/facebook/react/commit/a389046a529c6d22ba5895dd7f5d4b0b8d17c345.

Reviewed By: hoxyq

Differential Revision: D45816985

Pulled By: javache

fbshipit-source-id: 592e0f1eb726261335f703502c74a2548f7da2bc
2023-05-16 15:19:13 -07:00
hoxyq (Meta Employee) ada6c51943 fix[devtools]: fixed duplicated backend activation with multiple renderers (#26807)
Summary:
## Summary
Initially reported in https://github.com/facebook/react/issues/26797.
Was not able to reproduce the exact same problem, but found this case:

1. Open corresponding codepen from the issue in debug mode
2. Open components tab of the extension
3. Refresh the page

Received multiple errors:
- Warning in the Console tab: Invalid renderer id "2".
- Error in the Components tab: Uncaught Error: Cannot add node "3"
because a node with that id is already in the Store.

This problem has occurred after landing a fix in
https://github.com/facebook/react/pull/26779. Looks like Chrome is
keeping the injected scripts (the backend in this case) and we start
backend twice.

DiffTrain build for commit https://github.com/facebook/react/commit/67a05d03e38b9837e27c9fe0a673557e63ff03c5.

Reviewed By: javache

Differential Revision: D45815160

Pulled By: hoxyq

fbshipit-source-id: 99f3c45009b07a0fb89f0674ccfb24f170cdb29d
2023-05-16 15:19:13 -07:00
kassens (Meta Employee) 2a58b06863 reduce dynamic SchedulerFeatureFlags (#26617)
Summary:
For these values we're not using dynamic values. We can statically
compile in the values we're running.

DiffTrain build for commit https://github.com/facebook/react/commit/df12d7eac40c87bd5fdde0aa5a739bce9e7dce27.

Reviewed By: tyao1

Differential Revision: D45751304

Pulled By: kassens

fbshipit-source-id: d00e441ab75bf8fe038bb0e80eeb392421344657
2023-05-16 15:19:13 -07:00
acdlite d157767964 Fix nightly job to publish to "canary" channel (#26799)
Summary:
When I was renaming the next channel to canary, I updated the
`publish_preleases` workflow correctly, but I skipped over
`publish_preleases_nightly`. Oops.

DiffTrain build for commit https://github.com/facebook/react/commit/7cd98ef2bcbc10f164f778bade86a4daeb821011.

Reviewed By: mofeiZ

Differential Revision: D45720403

fbshipit-source-id: 13ab5d0d0af6cc899944507249b39b03adbcb994
2023-05-16 15:19:13 -07:00
acdlite fc1f51b1d6 Change yarn test to default to experimental (#26741)
Summary:
The idea is that the default `yarn test` command should be the one that
includes the most bleeding edge features, because during development you
probably want as many features enabled as possible.

That used to be `www-modern` but nowadays it's `experimental` because
we've landed a bunch of async actions stuff in experimental but it isn't
yet being tested at Meta.

So this switches the default to `experimental`.

DiffTrain build for commit https://github.com/facebook/react/commit/b5810163e913e8c95a7a0a6dee039bc102e3c987.

Reviewed By: mofeiZ

Differential Revision: D45719891

fbshipit-source-id: 7c820b8b546f1c90bb3d77993befde86e42d399b
2023-05-16 15:19:13 -07:00
Pieter De Baets eb0db6f9f5 Unbreak RNTester buck unit tests (#37432)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37432

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D45861483

fbshipit-source-id: cdb3a0ff29af427b4a375a8008fc84f489b58934
2023-05-16 13:26:05 -07:00
Nick Gerleman 2b932c3820 Change how we set cmake policy (#37349)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37349

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

Fixes https://github.com/facebook/yoga/issues/1283

New versions of CMake add "policies" which control how the build system acts wrt breaking changes. By default, CMake will emulate the behavior of the version specified in `cmake_minimum_required`.

Setting a policy to true (to opt into new behavior where `cmake_minimum_required` is lower than the current version) seems actually just error out on the old versions.

Googling around, apparently the way I should be doing this is to specify `<policy_max>` as part of `cmake_minimum_required `. https://gitlab.kitware.com/cmake/cmake/-/issues/20392

This should I think use new policies introduced up to 3.26 (what we test on right now), while letting 3.13 be the minimum.

Reviewed By: cortinico

Differential Revision: D45724864

fbshipit-source-id: 120cc2015a043605e7c07ef0459667643a4284b7
2023-05-15 15:21:56 -07:00
Phillip Pan 11251c3db0 create fallback contextContainer (#37441)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37441

Changelog: [Internal]

i just noticed that `[_delegate createContextContainer]` can be null because it returns `shared_ptr`, we should protect against that!

Reviewed By: javache

Differential Revision: D45805196

fbshipit-source-id: 645815812da1718e1025c7e6b2763e698d86b59a
2023-05-15 15:05:16 -07:00
Phillip Pan a6c658ff69 use self instead of class name when doing strong / weak dance (#37442)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37442

Changelog: [Internal]

this better describes what's going on and is more standard obj-c

Reviewed By: javache

Differential Revision: D45805034

fbshipit-source-id: d8e5938c856f356ce96a3f6d393eaddbb02aa555
2023-05-15 15:05:16 -07:00
Phillip Pan 5f9a11c7d1 delete unused methods on RCTSurfacePresenter (#37440)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37440

Changelog: [Internal]

this is not used, remove

Reviewed By: javache

Differential Revision: D45804534

fbshipit-source-id: 4379680504b867eefefa517faaa1392abd698a26
2023-05-15 15:05:16 -07:00
Ramanpreet Nara 979828a140 Setup: Route all TurboModules through interop layer (#37394)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37394

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

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D45781151

fbshipit-source-id: c65ae3757f6ad6459797dc44b2d1f35b7764fb98
2023-05-15 15:04:25 -07:00
Ramanpreet Nara 0be3b5b162 Finish the JS side of the TurboModule interop layer (#37396)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37396

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

## Changes
This diff hooks up global.nativeModuleProxy to the TurboModule interop layer.

Now, when you call NativeModules.Foo, the TurboModule system will create the Foo legacy module, and return it to JavaScript.

## Example
global.nativeModuleProxy.Foo:
- ObjC++: Use RCTTurboModuleManager to create the ObjC legacy module for Foo
- C++: Use the ObjC legacy modules to create and return a ObjCInteropTurboModule object to JavaScript.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D45781152

fbshipit-source-id: 9059cd0de294aa17dcbf120322d7e86e7c7a83ed
2023-05-15 15:04:25 -07:00
Ramanpreet Nara 25b88e0f52 Introduce ObjCInteropTurboModule (#37392)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37392

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

## Changes
This diff introduces ObjCInteropTurboModule.

ObjCInteropTurboModule implements method dispatch for legacy native modules (i.e: modules that aren't schematized).

**Note:** This method dispatch relies on the RCT_EXPORT_METHOD macros, not the TurboModule system's C++ codegen.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D45781153

fbshipit-source-id: 9b700472f111ed2911e24f47cb2ad434e13a8531
2023-05-15 15:04:25 -07:00
Ramanpreet Nara 5ce042f0b2 Allow the TurboModule system to create legacy modules (#37395)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37395

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

When the TurboModule interop layer is enabled, it should create modules that conform to RCTBridgeModule (i.e: legacy and turbo modules).

When the TurboModule interop layer is disabled, it should only create modules that conform to RCTTurboModule (i.e: turbo modules).

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D45781155

fbshipit-source-id: 2bf2c6cdbe0db99a57fce0d0c21c66aee3465e0d
2023-05-15 15:04:25 -07:00
Ramanpreet Nara 853695ebd2 Integrate TurboModuleManager with legacy module registration (#37393)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37393

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

## Rationale
In Bridgeless mode, the TurboModule system needs to integrate with the legacy native module registration mechanisms.

That way, it knows what legacy native modules it's responsible for creating.

## Context
There are three ways to register native modules with the Bridge.

### A) Class loads (i.e: +load)
1. Write an [RCT_EXPORT_MODULE()](https://www.internalfb.com/code/fbsource/[ee3eaa48f826202c6c0e2ee663916ef62fb135d0]/xplat/js/react-native-github/packages/rn-tester/NativeComponentExample/ios/RNTMyLegacyNativeViewManager.mm?lines=25) macro in the module's implementation.
2. This macro [generates a +load](https://www.internalfb.com/code/fbsource/[ee3eaa48f826202c6c0e2ee663916ef62fb135d0]/xplat/js/react-native-github/packages/react-native/React/Base/RCTBridgeModule.h?lines=70%2C76-79) method on the native module class. When the ObjC runtime loads the native module class (during app start), it executes the class's +load method, which [inserts the native module class into a global array (i.e: RCTModuleClasses)](https://www.internalfb.com/code/fbsource/[daf070f990c6a701677f4db3de8bf6fd3d00c6a4]/xplat/js/react-native-github/packages/react-native/React/Base/RCTBridge.m?lines=43-44%2C58-61)
4. Then, when the application starts the bridge, the bridge [registers all these native module classes (in RCTModuleClasses) with itself](https://www.internalfb.com/code/fbsource/xplat/js/react-native-github/packages/react-native/React/CxxBridge/RCTCxxBridge.mm?lines=412).

### B) App provides modules eagerly (i.e: extraModulesForBridge)

1. The application provides an RCTBridgeDelegate to the Bridge. This delegate implements [extraModulesForBridge:](https://www.internalfb.com/code/fbsource/[ee3eaa48f826202c6c0e2ee663916ef62fb135d0]/xplat/js/react-native-github/packages/react-native/React/Base/RCTBridgeDelegate.h?lines=13%2C23%2C25-39)
2. The Bridge [registers these extra modules with itself](https://www.internalfb.com/code/fbsource/[574e410dcffbc900152cea60a50e750d833a2534]/xplat/js/react-native-github/packages/react-native/React/CxxBridge/RCTCxxBridge.mm?lines=389%2C410%2C412%2C799%2C804-805), when it starts up.

### C) App provides modules lazily (i.e: bridge:didNotLoadModule)
1. The application provides an RCTBridgeDelegate to the Bridge. This delegate implements [bridge:didNotFindModule:](https://www.internalfb.com/code/fbsource/[ee3eaa48f826202c6c0e2ee663916ef62fb135d0]/xplat/js/react-native-github/packages/react-native/React/Base/RCTBridgeDelegate.h?lines=13%2C23%2C57)
2. When module lookup fails on the bridge, the bridge [calls the delegate's bridge:didNotFindModule](https://www.internalfb.com/code/fbsource/[ee3eaa48f826202c6c0e2ee663916ef62fb135d0]/xplat/js/react-native-github/packages/react-native/React/CxxBridge/RCTCxxBridge.mm?lines=585%2C618-619)
3. In this method, the delegate [loads the native module class from *somewhere*](https://www.internalfb.com/code/fbsource/[0f0f48a4723c830310c6e2c194822b6a5ba3000e]/fbobjc/Apps/Wilde/FBReactModule2/FBReactModuleAPI/FBReactModuleAPI/Exported/FBReactModule.mm?lines=1072%2C1074-1075), and [registers it with the bridge](https://www.internalfb.com/code/fbsource/[0f0f48a4723c830310c6e2c194822b6a5ba3000e]/fbobjc/Apps/Wilde/FBReactModule2/FBReactModuleAPI/FBReactModuleAPI/Exported/FBReactModule.mm?lines=1072%2C1083-1085)

## Changes
This diff integrates the TurboModule system with +loads and extraModulesForBridge.

It does not integrate with the lazy module registration mechanism, because I believe that mechanism isn't used in open source.

Changelog: [Internal]

Reviewed By: dmytrorykun

Differential Revision: D45781154

fbshipit-source-id: 6b27f65e6066ddf7a0f341109725a582f7b39ac1
2023-05-15 15:04:25 -07:00
Ramanpreet Nara 132b41a539 Disable TurboModule interop by default (#37391)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37391

This was accidentally set to true by default.

This resulted in the TurboModule interop layer being enabled on Standalone apps.

Changelog: [Internal]

Reviewed By: dmytrorykun

Differential Revision: D45783832

fbshipit-source-id: e88f2bc8cba06356b9caab2ba25bcdd9da82b37e
2023-05-15 15:04:25 -07:00
Patryk Ozga 066f0b76d4 remove extra semis from arfx/atlas/modules and deps attempt 2
Summary:
X-link: https://github.com/facebook/yoga/pull/1299

X-link: https://github.com/facebook/igl/pull/22

deletes semicolons and adds whitespace sometimes

moved the runtime ipc chages int a seperate diff

Reviewed By: KSRandom

Differential Revision: D45835378

fbshipit-source-id: 2890e93620af4cadd33b9c8c9149157d9078fa32
2023-05-15 13:15:29 -07:00
Carmen Krol d246e5a1a8 Fix wording for unselected checkbox state (#37415)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37415

Previously, when focusing on an unchecked checkbox in React Native Paper with VoiceOver, it was announcing as "not selected".  iOS voiceover uses "unselected" instead ("not selected" is used on Android Talkback).  Update code to use "unselected".

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D45799922

fbshipit-source-id: 30f7813ed9f1fdad817e18b28c4fcf99cb4b884f
2023-05-15 10:16:22 -07:00
Carmen Krol 12f4a19306 Announce checkbox and radio button roles on VoiceOver (#37414)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37414

Previously, when focusing on a checkbox or radio button in React Native Fabric with VoiceOver, it wasn't announcing the role, e.g. "checkbox".  Instead it would just say [label][state], e.g. "Automatically check for updates, unchecked".  This is an extremely confusing experience for screen reader users because they don't know what kind of element they are focusing, including how to interact with it.

"checkbox" and "radio button" aren't recognized as [Apple iOS traits](https://developer.apple.com/documentation/uikit/uiaccessibilitytraits?language=objc), but we'd like to have consistency with the mobile safari experience.

Reviewed By: cipolleschi

Differential Revision: D45797554

fbshipit-source-id: 418e73342aaa8d0986e330bfd54078be27d3491f
2023-05-15 10:16:22 -07:00
Riccardo Cipolleschi 81e2974037 Introduce CI tests to test dynamic frameworks in check (#37272)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37272

This change enables some tests on RNTester and on the Template to verify that we won't be breaking `use_frameworks!` again in the future.

## Changelog:
[iOS][Added] - Add tests to check use frameworks with dynamic linking.

Reviewed By: cortinico

Differential Revision: D45605977

fbshipit-source-id: 06f05aba427e78a7bb1d8dc835fa83d8550586db
2023-05-15 08:14:59 -07:00
Riccardo Cipolleschi ce116b653b Add support to register New Renderer components from the AppDelegate. (#37273)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37273

When using dynamic frameworks, we can't rely on Codegen to register all the components into the renderer. That's because, we would have to codegen a new target, which depends on ALL the 3rd party dependencies that expose a UI component.

The previous PR adds support for distributed automatic registration when components are loaded in memory.

However, not to slow down the adoption of the New Architecture, there could be apps that need to register a component that does not support the distributed approach yet. Thanks to this method, apps can register those components.

## Changelog:
[iOS][Added] - Added a mechanism to register components into the renderer from the user app.

Reviewed By: dmytrorykun

Differential Revision: D45605688

fbshipit-source-id: 3583913f2700be4d6cb33a862429486aca675acf
2023-05-15 08:14:59 -07:00
Riccardo Cipolleschi b6b09a7e72 Add support for distributed registration of Fabric Components with Dynamic Libraries (#37274)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37274

With dynamic frameworks, we can't use floating C functions.

The way in which dynamic frameworks work is that they need to be self contained. They are built in isolation so that other frameworks can be linked against them to solve their dependencies.

Currently, when working with 3rd party libraries, we are Codegenerating a RCTThirdPartyComponentProvider which tries to invoke floating C functions that are defined in other modules. React-RCTFabric has no visibility on those modules, therefore it fails building.

The implemented solution exclude the generation of those symbols and leverage a the Objective-C runtime to automatically register libraries when they are loaded.

**This mechanism is applied ONLY when the flag RCT_DYNAMIC_FRAMEWORKS is turned on.** There will be no impact on internal meta apps, nor on any apps that are not using Dynamic Frameworks.

This change requires a small migration in all the Fabric components libraries that wants to support dynamic frameworks. They have to implement a
```
+ (void)load
{
  [super load];
}
```
method in their ComponentView.

Not to slow down the adoption of the new architecture, waiting for a migration in the ecosystem, the next diff introduce a secondary, declarative loading mechanism for Fabric Components, which follows the same approach used by TurboModules.

## Changelog:
[iOS][Changed] - Add support for distributed registration of  Fabric Components with Dynamic Libraries.

Notes that this change is NOT breaking as dynamic frameworks were not working before in the New Architecture. Static Libraries and Static Frameworks continue working as usual.

Reviewed By: dmytrorykun

Differential Revision: D45605441

fbshipit-source-id: e609fbf6f92fddfbaa676227fde60962d6b0faa4
2023-05-15 08:14:59 -07:00
jcdhlzq d8ced6f895 Fix ReactTextView setPadding applying logic error (#36999)
Summary:
Fix the logic error when setPadding int ReactTextView.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

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

Reviewed By: NickGerleman

Differential Revision: D45773288

Pulled By: javache

fbshipit-source-id: ed4681aeab58ed4c3d2e04edb2d096b50932c088
2023-05-15 03:42:30 -07:00
Intl Scheduler 1b5c1c7d2a translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907879438055
Sandcastle Job Instance ID: 22517999084228724
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D45859379

fbshipit-source-id: 1b96a86de194ec676f8dfb15a2582f95f2d3bf15
2023-05-15 01:47:37 -07:00
Nick Gerleman 02ec60bd3e Native ARIA Roles: Android Paper + Fabric (#37306)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37306

### Stack

ARIA roles in React Native are implemented on top of accessibilityRole. This is lossy because there are many more ARIA roles than accessibilityRole. This is especially true for RN on desktop where accessibilityRole was designed around accessibility APIs only available on mobile.

This series of changes aims to change this implementation to instead pass the ARIA role to native, alongside any existing accessibilityRole. This gives the platform more control in exactly how to map an ARIA role to native behavior.

As an example, this would allow mapping any ARIA role to AutomationControlType on Windows without needing to fork to add new options to accessibilityRole.

It also allows greater implementation flexibility for other platforms down the line, but for now, iOS and Android behave the same as before (though with their implementation living in native).

### Diff

This replicates the roles to Java. When using MapBuffer we pass the role by ordinal, assuming they keep in sync. We otherwise still pass by string matching the JS side.

Previous implementation kept `accessibilityRole` on a view tag of the native view. This adds `role` as a view tag as well.

For now, to reuse the existing code, we then expose a single function to query `AccessibilityRole` from the combined view tags. This will do the same mapping previously done in JS, so that any code previously reading for an `AccessibilityRole` will now get one derived from the role view tag if present.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D45431381

fbshipit-source-id: a72c7880d41b5cf2c4e1c1f3ebfa6832ce8b4250
2023-05-13 13:12:42 -07:00
Nick Gerleman 9db5fa215e Native ARIA Roles: Shared code (#37305)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37305

### Stack

ARIA roles in React Native are implemented on top of `accessibilityRole`. This is lossy because there are many more ARIA roles than `accessibilityRole`. This is especially true for RN on desktop where `accessibilityRole` was designed around accessibility APIs only available on mobile.

This series of changes aims to change this implementation to instead pass the ARIA role to native, alongside any existing `accessibilityRole`. This gives the platform more control in exactly how to map an ARIA role to native behavior.

As an example, this would allow mapping any ARIA role to [`AutomationControlType`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.automation.peers.automationcontroltype?view=windowsdesktop-7.0&viewFallbackFrom=dotnet-uwp-10.0) on Windows without needing to fork to add new options to `accessibilityRole`.

It also allows greater implementation flexibility for other platforms down the line, but for now, iOS and Android behave the same as before (though with their implementation living in native).

### Diff

This syncs the Fabric representations of Roles to the current state of the world in JS, and adds usage to the view configs.
1. `Role` enum for the View `role` prop (ARIA role)
2. Sync enums and conversions to JS `AccessibilityRole`
    1. This parsing is done for `TextAttributes` only. `View` uses the string directly
    2. Add ARIA roles, and parse those to their enum form.
    3. Move enums from attributedstring primitves to accessibility primitives
3. Add to viewconfig to allow it to be passed

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D45431372

fbshipit-source-id: 0150538345bbb6cb4d9426c4eebd0f67c2a33f3d
2023-05-13 11:03:19 -07:00
Nick Gerleman 1b0e8b1de4 Better TypeScript support for package.json exports field (#37377)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37377

For 0.72 I enabled `moduleResolution: "nodenext"` which allows some package exports support, but this is imperfect. E.g. RN will typecheck against the `node` condition and there are some more restrictions than we need.

D45720238 bumped TypeScript to 5.0 for RN 0.73, along with D45721088 which brought the tsconfig inline. This lets us switch to the new [`moduleResolution: "bundler"`](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#moduleresolution-bundler) and instructs `tsc` to follow the `react-native` export condition.

See even more context at: https://github.com/microsoft/TypeScript/pull/51669

Changelog:
[General][Added] - Better TypeScript support for package.json exports field

Reviewed By: christophpurrer

Differential Revision: D45769740

fbshipit-source-id: 1ad450b8157bfd0d539289835bed097fd950cf78
2023-05-13 09:38:17 -07:00
Phillip Pan 61335a1367 rename host preload -> start (#37422)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37422

Changelog: [Internal]

in this simple change, i renamed the `preload` API, which triggers all the rct instance / javascript runtime creation to `start`. `preload` is a confusing API on the host because the host should be agnostic of when the timing to create its dependencies are, and the consumer should determine when initialization is lazy, early, etc.

Reviewed By: cipolleschi

Differential Revision: D45760583

fbshipit-source-id: bea26d21f950474352280292426a5facbe52b60f
2023-05-12 22:26:10 -07:00
Phillip Pan a620498856 move creation of javascript engine responsibility out of RCTHostDelegate (#37327)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37327

Changelog: [Internal]

in this diff, we enforce at the API level that the `RCTHostDelegate` is not responsible for creating the js engine instance.

Reviewed By: cipolleschi

Differential Revision: D45596321

fbshipit-source-id: 7862344d8b42e9d70e7fb7c7e9980953f0d66a8b
2023-05-12 22:26:10 -07:00
Junfeng Li cd223d6740 Revert D45722118: remove extra semis from arfx/atlas/modules and deps
Differential Revision:
D45722118

Original commit changeset: a749ca9e979d

Original Phabricator Diff: D45722118

fbshipit-source-id: 9316f2946966e001f0884af17bf733a1a48e75cc
2023-05-12 15:57:47 -07:00
Patryk Ozga e985470097 remove extra semis from arfx/atlas/modules and deps (#37360)
Summary:
X-link: https://github.com/facebook/yoga/pull/1289

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

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

X-link: https://github.com/facebook/igl/pull/21

Reviewed By: nlutsenko, NickGerleman

Differential Revision: D45722118

fbshipit-source-id: a749ca9e979d4447e65d075493c251169f81c289
2023-05-12 12:44:37 -07:00
Pieter Vanderwerff 107234f1fd Deploy Flow v0.206 in fbsource (#37389)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37389

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D45756834

fbshipit-source-id: f9f03d6cfe3ff0b84f7584cb663b524d23080e4b
2023-05-12 12:02:35 -07:00
Pieter Vanderwerff 6392b5320c Presuppress Flow errors for 0.206 in fbsource (#37390)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37390

X-link: https://github.com/facebook/react-fbsource-import/pull/4

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D45756542

fbshipit-source-id: 255e02362aba9a41ab8e9588127db7b2752f481d
2023-05-12 11:12:35 -07:00
Pieter De Baets 98f6e75720 Fix react unit tests on Android (#37409)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37409

Changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D45812628

fbshipit-source-id: 9074b872425ee771eaa8a34289f5ffa596272927
2023-05-12 08:17:26 -07:00
Pieter De Baets 9c51de87a0 Fix getDebugProps implementation for LayoutableShadowNode
Summary:
The core implementation for ShadowNode's `getDebugProps` lives in ConcreteViewShadowNode, but is not actually specific to that class. Additionally, `LayoutableShadowNode` overrides `getDebugProps` in a way that doesn't concat props from its base class. Instead, override the method properly so we only need the implementation in `LayoutableShadowNode`.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D45729105

fbshipit-source-id: 946d8d97b86fde0488527ce00db5a019c95e31af
2023-05-12 05:44:31 -07:00
Intl Scheduler c9c245901e translation auto-update for i18n/analyticsapp.config.json on master
Summary:
Chronos Job Instance ID: 1125907877584145
Sandcastle Job Instance ID: 13510799829561479
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D45811159

fbshipit-source-id: 521d8c689fff922d019daaaab9696f5a85acd6ca
2023-05-12 03:08:26 -07:00
Phillip Pan a320dce2fd introduce RCTHostCreationHelpers (#37328)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37328

Changelog: [Internal]
in this diff, i introduced a C function to be used to create RCTHost that obfuscates away all the C++ arguments. i expect this to be the API that the vast majority of the community will use to create `RCTHost`.

Reviewed By: cipolleschi

Differential Revision: D45678970

fbshipit-source-id: e3479db1bb68d93b3ee2f02598413d2080bb5ea9
2023-05-11 21:45:50 -07:00