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
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
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
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
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
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
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
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
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
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
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
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
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
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37344
Changelog: [Internal]
in this diff we do the following:
- pass an error handler that's responsible for bubbling up the error metadata from the react instance obj-c wrapper (RCTInstance) to the actual react instance (ReactInstance)
- parse the error metadata in RCTHost and pass it up to its delegate
Reviewed By: cipolleschi
Differential Revision: D45720132
fbshipit-source-id: 996c7c43ed6feb72596296eedac18e204b960426
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37343
Changelog: [Internal]
in this stack i address the `jsErrorHandlingFunc` argument in the constructor of `RCTHost`.
currently in userland, the delegate of `RCTHost` is responsible for the following if they want to handle the errors fired in C++ land:
- importing the C++ class MapBuffer
- creating a C++ lambda method
- parsing the MapBuffer
in this diff stack i simplify this so we only need to implement a delegate method where userland only receives Foundation types. yay!
bypass-github-export-checks
Reviewed By: RSNara
Differential Revision: D45720131
fbshipit-source-id: b5541abe505140b4b85cbec1a8acecc1a3df7a72
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37398
Changelog: [Internal]
in this diff, i introduce an internal category and header for RCTHost for functionality that needs to be accessible for our purposes, but not an official part of our stable API.
after this change, we can remove `ReactInstanceForwarding`.
Reviewed By: cipolleschi
Differential Revision: D45760091
fbshipit-source-id: 88a82fc70a20934f5d8989041c3eb2ffe2d27b20
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37399
Changelog: [Internal]
in this stack, i remove the `ReactInstanceForwarding` protocol. it is super lean and is only used by two classes, and the polymorphic behavior never comes into play because we never have a pointer to `id<ReactInstanceForwarding>` in our codebase.
being able to call into JS from native is tablestakes behavior in userland, so i'm moving that to the public API. i also renamed it to be more clear that it's calling from native into JS, not the other way around.
Reviewed By: cipolleschi
Differential Revision: D45760090
fbshipit-source-id: 8ac99723796cb65891076e8e7d69aeefe3e94213
Summary:
X-link: https://github.com/facebook/yoga/pull/1294
Pull Request resolved: https://github.com/facebook/react-native/pull/37383
Add -Wextra to the build, and fixup some more instances of -Wunused-parameter that it sufaces which were not automatically fixable.
Reviewed By: javache
Differential Revision: D45772846
fbshipit-source-id: 29bf71006f63161521fe5869c3a7d8bf7aae9c81
Summary:
X-link: https://github.com/facebook/yoga/pull/1291
Pull Request resolved: https://github.com/facebook/react-native/pull/37371
This makes React Native use `libyogacore` as provided by Yoga's reference CMake build. This in turn matches Yoga in the OSS RN build to the same compilation settings we use internally. It also means less differences between all the builds (maintainability win).
This does not yet do the same for the Yoga JNI bindings.
Changelog:
[Android][Changed] - Use reference Yoga CMake Build
Reviewed By: cortinico
Differential Revision: D45764537
fbshipit-source-id: 1aafd221d2afa994b6efae3c267ee7ffbdf0faad
Summary:
> The `buildPropSchema` function in `parsers/typescript/components/props.js` and `parsers/flow/components/props.js` is the same. move it to `parser-commons` and use it in the original files.
part of https://github.com/facebook/react-native/issues/34872
- [x] Make the getTypeAnnotation signature from the Flow package to be equal to the typescript one. Specifically, the Typescript one needs an additional parameter withNullDefault that we can safely ignore in the implementation.
- [x] buildPropSchema signature can be updated to accept those two functions in input as callbacks. Then, the getProps function can feed the right functions based on the language to the shared build prop schema.
ref: https://github.com/facebook/react-native/issues/34872#issuecomment-1517519254
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] - Use `buildPropSchema` from parser-commons
Pull Request resolved: https://github.com/facebook/react-native/pull/37043
Test Plan: - [ ] `yarn jest react-native-codegen` pass
Reviewed By: rshest
Differential Revision: D45209982
Pulled By: cipolleschi
fbshipit-source-id: c241bc0542ba662c965d70d1dc283f48541e14ea
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37375
Adds internal helpers to YGConfig to make bit manipulation more readable. We also expose `hasErrata()` to YGNode beacuse checking that will be a common pattern. We intentionally don't add mutating functions to the node, since current model is to inval a node on commiting whole config.
This is not exposed via the C ABI.
Reviewed By: yungsters
Differential Revision: D45765971
fbshipit-source-id: eadaee4b9cf5204ac4984ecc52cc08650d144a30
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37372
For usage in shelling into the reference build. I separately looked at moving `cmake` to be inline inside of `yoga`, but this ends up having a worse structure than being at the top level.
I also cleaned up the dirsync naming to be more easy to understand.
Changelog: [Internal]
Reviewed By: yungsters
Differential Revision: D45764337
fbshipit-source-id: f810db5d6acc7c4c92003beb2ac3399bd78b9886
Summary:
This adds script to better work with RN Tester from the root of the repo.
- `yarn start` is broken as of today
- `yarn android` is not working fine and I've adapter it here.
This should make easier to work with RN Tester from within the Repo.
Changelog:
[Internal] [Changed] - Add scripts to `yarn start` and `yarn android` from root
Reviewed By: mdvacca, cipolleschi
Differential Revision: D45735926
fbshipit-source-id: eaebf80b8819ee42ccb9c14b67f8945167bf05e6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37243
X-link: https://github.com/facebook/litho/pull/944
X-link: https://github.com/facebook/yoga/pull/1279
Java bindings for Yoga rely solely on garbage collection for memory management. Each Java `YogaNode` has references to its children and parent Java Nodes. This means, for a node to be garbage collected, it cannot be reachable from any user accessible node. Each node then has single ownership of a `YGNodeRef`. When the `YogaNode` is garbage collected, a finalizer is run to call `YGNodeFree` and free the underlying native Yoga Node.
This may cause a use-after-free if finalizers are run from multiple threads. This is because `YGNodeFree` does more than just freeing, but instead also interacts with its parent and children nodes to detach itself, and remove any dangling pointers. If multiple threads run finalizers at once, one may traverse and try to mutate a node which another is freeing.
Because we know the entire connected tree is dead, there is no need to remove dangling pointers, so I want to expose a way to just free a Yoga Node, without it mutating the tree as a side effect.
This adds a currently private `YGNodeDeallocate` that frees without traversal. Ideally from naming this is what `YGNodeFree` would do, but we think changing the behavior of that might be too disruptive to OSS. At the same time there may be other memory safety related API changes we would like to eventually make, so this isn't made public beyond the JNI bindings to prevent needing to transition more APIs.
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D45556206
fbshipit-source-id: 62a1394c6f6bdc2b437b388098ea362a0fbcd0f7