Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44709
Add some extra logging to try to figure out heisenbug, where we cannot find MapBuffer key that we should expect to be present, only during view preallocation.
ReadableMapBuffer toString() will itself iterate through MapBuffer entries, so this might not return something sane if underlying MapBuffer is corrupt or wrongly oriented, but should give us more context.
We also need to be careful here, to avoid logging the actual state mapbuffer or its binary which may contain text content. Only the paragraph attributes.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D57925730
fbshipit-source-id: cecca1a1fe53b4b417d520e65c30d47243cb2fb2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44707
Changelog: [Internal]
For DrawerLayoutAndroid in New Architecture, when we use ReactDev Tools layout inspection, incorrect node is being shown in the inspector tools.
This is because pointerEvents is not set to either `box-none` or `none` based on the drawer open/close state for the drawer child wrapper `View`.
Reviewed By: hoxyq
Differential Revision: D57873834
fbshipit-source-id: b2b82633969922189a0b96feea2115ddc0b2ebb5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44726
Changelog: [internal]
## Context
We ran an experiment to test synchronous state updates in Fabric and we saw some crashes on Android. Those crashes were caused by mounting operations not being applied in the correct order.
There were 2 root causes for that problem:
1. State updates triggered during mount would be committed and mounted synchronously during that specific mount operation. That caused problems like trying to clip views that weren't created already (as we were processing the state update for the content offset before we actually created the child views).
2. Same problem as before, but with mount operations that were processed when the root view wasn't available yet (this is a separate queue).
We tried to fix the problem in https://github.com/facebook/react-native/pull/44015, but the solution for 2) was incorrect, as we didn't account for those operations being in a different queue (it was reverted in https://github.com/facebook/react-native/pull/44724).
## Changes
I think the right solution for point 2) is that, instead of marking the root view as available and then process all pending operations, we flip those operations.
That was, if there are any mount operations as a side-effect of processing that queue, those will also be added to the same queue, instead of being processed immediately in `MountItemDispatcher`.
Reviewed By: sammy-SC
Differential Revision: D57968937
fbshipit-source-id: 93d10cdeced0c837d4301768aee8575d2c940b10
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44725
Changelog: [internal]
## Context
We're currently testing synchronous state updates in Fabric (committing shadow trees for state updates synchronously in the thread where they were dispatched, instead of always scheduling it in the JS thread).
In these experiments we saw a problem caused by a recent change in the Android mounting layer (done to fix a problem with the Event Loop) where we were doing the mount operations inside a mutex lock. The problem is that we didn't have recursive commit+mount operations (because we were dispatching state updates in the JS thread) but now that we do we get a deadlock here.
{F1659804385}
These recursive commit+mount operations happen because it's possible to trigger state updates while we mount changes in the host platform (e.g.: we create the scroll view and we update the state to set the content offset). Those state updates trigger more mount operations, which deadlock in the mentioned place.
## Changes
This fixes the described issue by restricting the lock only to access the list of pending operations, but not to apply them. In the current implementation, `mountingManager->executeMount` is protected by the lock, whereas in the new version it isn't (so it can be safely called recursively). The synchronization of the mount operations is done directly at the mounting layer on Android.
Reviewed By: sammy-SC
Differential Revision: D57968936
fbshipit-source-id: 52f996d212cad691646610632b03b5223e7e90ca
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44724
Changelog: [internal]
Batching operations at this layer was wrong because these are the operations that were already flushed by the mounting layer but were accumulated in `SurfaceMountingManager` because the root view wasn't created.
These operations should be executed before anything else that's scheduled in the `MountItemDispatcher`, so we should never batch them. The problem this was trying to solve is solved in a different way in D57968937.
This was gated so this shouldn't affect any current usages.
Reviewed By: sammy-SC
Differential Revision: D57968939
fbshipit-source-id: e9131614cdc76e9d553540757611bc8b0736c927
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44727
This is a re-land of https://github.com/facebook/react-native/pull/44048
Reverting it caused even bigger regression, so my earlier assessment was wrong. The initial regression was caused by something else.
Changelog: [Internal] - Let's keep the changelog entry form the original diff.
Reviewed By: fkgozali
Differential Revision: D57970133
fbshipit-source-id: c683d661a805d44434f5491e89dd4b7218379bee
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44716
Move to listr2 which handle non-TTY environment, outputting to CircleCI logs in a useful way. This gives our CI users more useful debugging information, but limits the output when running locally.
If you want more explicit output locally, do something like:
```
yarn run build | cat
```
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D57915369
fbshipit-source-id: ae9f87b0b9608f16ee035b791c5f7b81544c498c
Summary:
On React Native macOS (I am not sure with the current state of React Native), the Xcode Unit and Integration tests are a bit flaky. Rather than set "retry on failure up to 3 times" through the pipeline config (in our case, Azure Pipelines), I realized my earlier PR to use Xcode test plans (https://github.com/facebook/react-native/pull/36443) means we can have Xcode retry the test. This should be faster than retrying it on the pipeline, because it retries just the failing test, not the entire "test" step. I did this on React Native macOS, so I'm doing it upstream so we can remove a diff.
## Changelog:
[INTERNAL] [CHANGED] - Set `retryOnFailure` for Xcode Unit and Integration tests
Pull Request resolved: https://github.com/facebook/react-native/pull/44642
Test Plan: CI should pass (faster)
Reviewed By: cortinico
Differential Revision: D57662523
Pulled By: cipolleschi
fbshipit-source-id: 8de2ab0ea15ba4d38c3b5bf96108c0c7ff5e9f32
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44708
Changelog: [internal]
We had a fallback to use a Hermes internal API if the native module exposing `queueMicrotask` wasn't available. This is no longer necessary as the module is available everywhere we enable the event loop, so we can remove it.
Reviewed By: christophpurrer
Differential Revision: D57922076
fbshipit-source-id: 0ca48abacd77a75ce8559db08f55c78a3e0ec815
Summary:
Add synchronous JS bindings installation for TurboModules. That would help some 3rd party JSI based modules to install JS bindings easier.
Re-create from https://github.com/facebook/react-native/issues/43110 but for iOS
## Changelog:
[IOS] [ADDED] - Add BindingsInstaller for TurboModules
Pull Request resolved: https://github.com/facebook/react-native/pull/44486
Test Plan: Added test in RN-Tester TurboModule test case
Reviewed By: javache
Differential Revision: D57224891
Pulled By: philIip
fbshipit-source-id: fabe5c4f8d2087ac9a465f2cb90d884b83265a68
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44705
`focusable` props behaviors are inconsistent across different flavors of Touchable components. Some use the disabled prop to check if the component should be focusable, others do not.
This ensures all Touchable* component flavors use the disabled prop.
## Changelog
[General][Fixed] Fixed inconsistency in TouchableX component disabled / focusable behavior
Reviewed By: yungsters
Differential Revision: D57910488
fbshipit-source-id: af17227403338fcd5bebd9ba7c3172b4c6776e1f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44706
We didn't ship this, and asking around, I don't think mdvacca was looking at this actively (though is on PTO right now).
Changelog: [Internal]
Reviewed By: rozele
Differential Revision: D57913491
fbshipit-source-id: 86afd5a6bb5e7ce6be540f2295aa407134a6d81c
Summary:
Expose host delegate methods that users can do some customize work.
## Changelog:
[IOS] [ADDED] - Bridgeless: Expose host delegate methods
Pull Request resolved: https://github.com/facebook/react-native/pull/44158
Test Plan: Users can do some customized work by `RCTRootViewFactory`.
Reviewed By: sammy-SC
Differential Revision: D56521470
Pulled By: cipolleschi
fbshipit-source-id: dd22d0978b9fd4385380945a514eb6596b7d874f
Summary:
XCode privacy files might not contain a `NSPrivacyAccessedAPITypes` key, which causes the following error:
```
[!] An error occurred while processing the post-install hook of the Podfile.
undefined method `each' for nil
node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:111:in `block (4 levels) in get_used_required_reason_apis'
node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in `each'
node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in `block (3 levels) in get_used_required_reason_apis'
```
## 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
-->
[IOS] [FIXED] - Privacy Manifest aggregation failing due to no `NSPrivacyAccessedAPITypes` key
Pull Request resolved: https://github.com/facebook/react-native/pull/44628
Test Plan: I tested this patch on our own app and it solved the issue.
Reviewed By: christophpurrer
Differential Revision: D57618425
Pulled By: cipolleschi
fbshipit-source-id: 1a36ab5a1bb45b8507d3663b782c95258d97c8a4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44699
Changelog: [Internal]
In Fabric, overflow props for ScrollView is not passed down. Hence, the overflow props is ignored and FlatList content is always clipped.
Reported from OSS https://github.com/facebook/react-native/issues/44683
Reviewed By: sammy-SC
Differential Revision: D57895399
fbshipit-source-id: 6ce65bea0803971060e8229b66563123dd6fc114
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44695
Changelog: [internal]
We tested this feature flag at Meta and it's neutral when used outside the event loop. We'll handle its effects on the event loop as part of the event loop experiment itself (when enabling paint blocking).
Reviewed By: tdn120
Differential Revision: D57861195
fbshipit-source-id: 11a208ef5433321a464cfc16f4ff026d52988b42
Summary:
Currently, if the `Animated.sequence` animation is finished, and then the `start()` method is called without a `reset()` method being invoked beforehand, the failure happens: ```undefined is not an object (evaluating 'animations[current].start')```.
Use cases:
- sequence animation started, finished, and then started again
- sequence animation is used in `Animation.loop` with `resetBeforeIteration` set to `false`, which essentially does the same as the previous case
Related issues:
- https://github.com/facebook/react-native/issues/43120
- https://github.com/facebook/react-native/issues/37611
## Changelog:
[General] [Fixed] - Fix sequence restart failure
Pull Request resolved: https://github.com/facebook/react-native/pull/44031
Test Plan: Test cases are included: 1 for regression and 2 for mentioned use cases in the summary
Reviewed By: cipolleschi
Differential Revision: D56015346
Pulled By: dmytrorykun
fbshipit-source-id: 8b0f46c8a33397fece807634463ce630c89d28af
Summary:
When running the Analyzer in Xcode, I got a warning denoting that `viewDidLoad` was not called on `super` in the overridden `RCTRedBox.viewDidLoad`. While I have not observed any anomalies, it is best practice to call on super in the overridden view controller life cycle methods.
## Changelog:
[iOS] [FIXED] - Add missing call to `[super viewDidLoad]` in `RCTRedBox.mm`.
Pull Request resolved: https://github.com/facebook/react-native/pull/44686
Test Plan:
Running the RNTester yielded the following screenshot:
<img width="549" alt="Screenshot 2024-05-27 at 11 26 40" src="https://github.com/facebook/react-native/assets/2263015/b91e126c-9dc1-4e52-8a6b-50ea8bea2c3f">
Reviewed By: fabriziocucci
Differential Revision: D57856354
Pulled By: javache
fbshipit-source-id: d76a4779e02f40af69eed156489e57299968d4be
Summary:
The `mapbufferjni` was not exposed via prefab. I'm adding it to make possible for react-native-live-markdown to integrate on top of React Native via prefab. Based on https://github.com/facebook/react-native/issues/36166.
## 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
-->
[ANDROID] [CHANGED] - Expose `mapbufferjni` via prefab.
Pull Request resolved: https://github.com/facebook/react-native/pull/44684
Reviewed By: fabriziocucci
Differential Revision: D57856389
Pulled By: javache
fbshipit-source-id: 9926b02724950f4025c7f867257e8229d44c43a3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44655
Required to compile with clang
This is because previously it was comparing size_t with int which is not allowed under compilation with clang
Changelog: [Internal] [Fixed] - Replaced old style for loop with new style to avoid clang errors with size_t to int comparisons
Differential Revision: D57721635
fbshipit-source-id: 2738f7b415d668c37536f7f93b2e0985fa2cc5e6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44672
Swaps out and simplifies the internals of the debugger launch flow.
We observed that we could achieve better launch/windowing behaviour by passing the `--app` argument directly to the detected Chrome path.
This shares the user's default Chrome profile:
- Fixes unwanted behaviour such as a separate dock icon on macOS (which, when clicked, would launch an unwanted empty window).
- Enables settings persistence.
This change also removes the `LaunchedBrowser.kill` API.
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D57726649
fbshipit-source-id: fc3a715dc852a50559048d1d1c378f64aeb2013f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44638
Reverts the debugger launch flow to use the default `ChromeLauncher` profile. This is the approach used in the current `--experimental-debugger` experiment and by Expo.
This is motivated after a review of the tradeoffs of a guest profile — which allow us to programatically quit the browser process, however takes over system URL handling.
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D57619542
fbshipit-source-id: 3713e1cf8eed61e7a70ed1e4eb58f02da845155f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44496
When doing performance profiling on a React Native iOS app and trying to identify bottlenecks on the native side it can be helpful to correlate actions to what is happening inside React Native. We already have the SystraceSection class for this, but it does nothing in open source. This diff allows SystraceSection to feed into the Instruments signpost API on iOS/macOS.
Changelog:
[iOS][Added] - Add Instruments signposts API for SystraceSection
Reviewed By: sammy-SC
Differential Revision: D56280451
fbshipit-source-id: 4e962e932b6b6e09e5953abdc1aa621a2723c91e
Summary:
This PR adds percentage support in translate properties for android. Isolating this PR for easier reviews.
## Changelog:
[Android] [ADDED] - Percentage support in translate
<!-- 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/43193
Test Plan:
- Checkout TransformExample.js -> Translate percentage example.
- Added a simple test in `processTransform-test.js`. The regex is not perfect (values like 20px%, 20%px will pass, can be improved, let me know!)
Related PRs - https://github.com/facebook/react-native/pull/43191, https://github.com/facebook/react-native/pull/43192
Reviewed By: joevilches
Differential Revision: D57723216
Pulled By: NickGerleman
fbshipit-source-id: c9da007678341b62745df858f043821bcc662a98
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44646
We can remove most of the code for clipping children to border radius, and recalculating paths, in ReactViewGroup, and rely on the padding box path/rect already set.
I will move this to something more generic up the stack so other native components can reuse this logic.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D57668976
fbshipit-source-id: 8b8cf956dc8689827bccba5e41751b465fd85eeb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44590
emitDeviceEvent is frequently used for perf-critical operations such as sending network responses from native to JS. We don't need to go through JavaScriptModule Proxy (which is missing caching in bridgeless) and instead can immediately invoke the callable JS module.
Changelog: [Internal]
Reviewed By: philIip
Differential Revision: D57435750
fbshipit-source-id: 1c120073ac80afd95deb8e3e6f1c00c2d3d80133
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44576
Store callable modules as either a factory function or an object, so we can skip invoking the factory function for frequently accessed objects.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D57338528
fbshipit-source-id: cd39ccbe7168c6f093a0e62d5880cbbcd5209c8e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44631
Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module enums
This is a follow up to https://github.com/facebook/react-native/pull/44630
This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.
Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
NA,
NB,
}
export interface Spec extends TurboModule {
+getStrEnum: (arg: EnumNone) => EnumStr;t
}
export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```
Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
^^^
```
Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```
## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)
Reviewed By: cipolleschi
Differential Revision: D57602082
fbshipit-source-id: 9ebd68b8059dfbc6e2ec11065915cf049aa3cb0b