Commit Graph

12270 Commits

Author SHA1 Message Date
Rubén Norte 9235be3776 Add metadata to feature flag definitions (#46597)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46597

Changelog: [internal]

Adding explicit metadata to feature flags so they're easier to manage:
* Purpose: to indicate why the feature flags are added.
    * Release: gating features we don't want to expose in certain environments yet (e.g.: Fabric).
    * Experimentation: changes that we want to test before enabling them broadly. Should generally be short lived.
    * Operational: flags that enable certain behaviors in certain environments (e.g.: debugging logs).
* Date added: only for experimental flags, so we know how long we've been waiting to fully roll out the change (without having to go through the repository history, which could've been changed due to refactors).

Reviewed By: javache

Differential Revision: D62972237

fbshipit-source-id: ab51e989a2cddb8dc52197238b638609d30002f0
2024-09-23 04:40:37 -07:00
Pieter De Baets be7b78ec9d Use CopyOnWriteArrayList for ReactHostImpl lifecycle listeners (#46567)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46567

Switch to a simpler data structure which avoids locking and doesn't require copies when iterating. This is more consistent with other listener arrays in React Native.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62872893

fbshipit-source-id: b0ce6a904d25057f0217f7de7ec2928c8b2d1f34
2024-09-23 04:32:13 -07:00
Pieter De Baets e27259b3db Do not hold raw RuntimeScheduler pointer in BufferedRuntimeExecutor (#46542)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46542

If `bufferedRuntimeExecutor_` is referenced beyond the lifetime of the ReactInstance, it may point to invalid memory. RuntimeScheduler already holds weak references to the actual runtime, so it's safe to retain that instead.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D62748768

fbshipit-source-id: 1cd8fcb050dd561e7d54a11d91c89eda3a5ddaaa
2024-09-23 04:32:13 -07:00
Jakub Piasecki bd323929dc Add a workaround for text being measured incorrectly when ending with an empty line (#42331)
Summary:
It looks like `StaticLayout` used for measuring multiline text on the new architecture returns wrong metrics for the last line if it's empty, however, if it contains anything, then the returned values are correct.

Similar approach with measuring `I` was already used in `ReactEditText`: https://github.com/facebook/react-native/blob/258d8e51b451b221e557dad4647cbd210fe37392/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java#L1203-L1213

## 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] [FIXED] - Fixed text being measured incorrectly when ending with an empty line on the new architecture

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

Test Plan:
<details>
<summary>I tested the change on this simple code on React Native 0.73.2 (with the new arch enabled)</summary>

```jsx
import React from 'react';
import {useState} from 'react';
import {SafeAreaView, TextInput} from 'react-native';

export default function App() {
  const [text, setText] = useState('ABC\nDEF\nGHI\n');

  return (
    <SafeAreaView style={{flex: 1}}>
      <TextInput
        value={text}
        onChangeText={setText}
        style={{borderWidth: 1, margin: 20, padding: 30}}
        multiline
      />
    </SafeAreaView>
  );
}
```

</details>

Before:

https://github.com/facebook/react-native/assets/21055725/0787cc86-70c6-4238-b93a-87984e527a83

After:

https://github.com/facebook/react-native/assets/21055725/2acf619f-5cb4-4869-9576-cb8cc081c15b

Reviewed By: cipolleschi

Differential Revision: D62873674

Pulled By: cortinico

fbshipit-source-id: cc2481b1924a13af7326cfc16c59b9390f0d06d8
2024-09-21 06:34:21 -07:00
Oskar Kwaśniewski 1747f57c67 feat(iOS): add colors to codegen output (#46557)
Summary:
This PR is a quality-of-life improvement, adds colors to codegen output:

![CleanShot 2024-09-18 at 12 18 00@2x](https://github.com/user-attachments/assets/13290a1c-8411-40e4-8abe-8fce4b88b6e7)

Makes it a lot easier to grasp what's going on in the actions taken by codegen.

## Changelog:

[GENERAL] [ADDED] - Add color formatting to codegen output

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

Test Plan:
1. Run codegen
2. Expect colored output

Reviewed By: christophpurrer

Differential Revision: D63031248

Pulled By: cipolleschi

fbshipit-source-id: e86bc72f16582562dc9f1e3b55dc69af4c7838f5
2024-09-20 03:33:31 -07:00
Riccardo Cipolleschi 9e2e8c1a27 Prepare scripts to simplify E2E testing (#46545)
Summary:
Add tests to simplify running Maestro e2e tests locally.
Thanks to these scripts, users can just, from the root folder:

```sh
yarn install
cd packages/rn-tester

# build android for testing
yarn e2e-build- android

# run tests on android
yarn e2e-test-android

# build iOS for testing
yarn e2e-build-ios

# run tests on iOS
yarn e2e-test-ios
```

This is a preliminary step for a future umbrella issue. We can also use these command in CI to simplify the scripts.

## Changelog:
[Internal] - add script to simplify e2e testing

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

Test Plan: Tested the command locally

Reviewed By: cortinico

Differential Revision: D62879105

Pulled By: cipolleschi

fbshipit-source-id: 6f68aebb3f8112302a458ca9e118180d3dbaf180
2024-09-20 03:29:43 -07:00
David Vacca 151008f8c2 Back out "Convert ReactViewManager, ReactClippingViewManager to Kotlin" (#46581)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46581

Original commit changeset: 09a81c91a1c9

Original Phabricator Diff: D62776270

changelog: [internal] internal

Reviewed By: bvanderhoof

Differential Revision: D63076764

fbshipit-source-id: 9cbd8ab86be356a7c35e44c86a95b80342c3da76
2024-09-19 22:56:17 -07:00
David Vacca d721d83149 Back out "Convert ReactViewGroup to Kotlin" (#46580)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46580

Original commit changeset: 780350e7e449

Original Phabricator Diff: D62642663

changelog: [internal] internal

Reviewed By: bvanderhoof

Differential Revision: D63076763

fbshipit-source-id: 01d3949c13129b71d5c96f19682bb24c51ff2552
2024-09-19 22:56:17 -07:00
Jorge Cabiedes Acosta 1288e38423 Implement outline properties on iOS (#46444)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46444

This diff adds:

`outline-width`: https://developer.mozilla.org/en-US/docs/Web/CSS/outline-width
`outline-color`: https://developer.mozilla.org/en-US/docs/Web/CSS/outline-color
`outline-style`: https://developer.mozilla.org/en-US/docs/Web/CSS/outline-style
`outline-offset`: https://developer.mozilla.org/en-US/docs/Web/CSS/outline-offset

Using `BackgroundStyleApplicator`

Changelog: [iOS] [Added] - Outline properties `outline-width`, `outline-color`, `outline-style` & `outline-offset`

Reviewed By: joevilches

Differential Revision: D62273339

fbshipit-source-id: 0ed775218e7d1dfb13bbf1760bc6ec331a388b64
2024-09-19 16:41:46 -07:00
Thomas Nardone 66c3074c65 Convert ReactViewGroup to Kotlin (#46577)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46577

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D62642663

fbshipit-source-id: 780350e7e449ffd2d6378cbed6f4381e34636a24
2024-09-19 13:20:15 -07:00
Thomas Nardone d80e1e9be3 Convert ReactViewManager, ReactClippingViewManager to Kotlin (#46578)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46578

Pre-req for converting ReactViewGroup without affecting API visibility.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D62776270

fbshipit-source-id: 09a81c91a1c95685b36f4417cb1b1a2852dd7194
2024-09-19 13:20:15 -07:00
Pieter De Baets 5f49e279f0 Fix AnimatedEvent leaking topScrollEnded handler (#46576)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46576

We automatically add this handler in `addAnimatedEventToView` but we do not remove it in `removeAnimatedEventFromView`, which causes us to leak it. This is especially bad as we attach and detach the event handler multiple times while rendering.

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D63029768

fbshipit-source-id: 9ef2bc6887fecb7ab448af4dee94463f8be27768
2024-09-19 11:56:28 -07:00
zhongwuzw 052def0da0 Fabric: Add missing source properties of Image (#46460)
Summary:
Fabric: Add missing source properties of Image

## Changelog:

[IOS] [FIXED] - Fabric: Add missing source properties of Image

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

Test Plan: Missing props should worked.

Reviewed By: javache

Differential Revision: D62847594

Pulled By: cipolleschi

fbshipit-source-id: 83d7c836a2e96c9053aa94e0e9b8e706103d026f
2024-09-19 11:00:25 -07:00
Alex Hunt a026d6d250 Update relocated JS logs message (#46558)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46558

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D62937482

fbshipit-source-id: 323d4220443e2660ff2f0cb8c019477ee245a07d
2024-09-19 10:15:05 -07:00
Pieter De Baets d8aa664adf Clear out CreateReactInstanceTaskRef early when destroying (#46544)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46544

Experiments with `completeReactInstanceCreationOnBgThreadOnAndroid` have shown a native crash in this code path, but it also existed previously.

I believe this is due to the ordering of ReactInstance teardown: we first destroy the ReactInstance, and only then destroy the reference to it in mCreateReactInstanceTaskRef. When using the immediate executor and completeReactInstanceCreationOnBgThreadOnAndroid, we read the react instance from the task, which may no longer be valid at this point. Resetting the task at the earliest point should mitigate the issue.

Changelog: [Internal]

Reviewed By: markv

Differential Revision: D62872625

fbshipit-source-id: 5aaccd53433ca806d2b93f7e3dd2bcf9bf8c09a8
2024-09-19 07:52:59 -07:00
Riccardo Cipolleschi c6f32828b9 Fix crash when navigating away from screens (#46559)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46559

There is an edge case when we navigate away from a screen that contains a scroll view where one of the UISCrollViewDelegates does not implement the scrollViewDidEndDecelerating method.

This happens because the Macro used assumes that the event that we are forwarding is the actual method from where the macro is called. Which is not true when it comes to `didMoveToWindow`.

This change fixes that by explicitly expanding the macro in this scenario and passing the right selector.

## Changelog:
[iOS][Fixed] - Fixed a crash when navigating away from a screen that contains a scrollView

## Facebook
This should fix T201780472

Reviewed By: philIip

Differential Revision: D62935876

fbshipit-source-id: e29aadf201c8066b5d3b7b0ada21fa8d763e9af0
2024-09-19 03:24:41 -07:00
Nicola Corti 2524c8eb72 Fix init behavior for 0.76 (#46560)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46560

The `init` command should still keep on working till 2024-12-31

This handles this scenario as currently `npx react-native@next init` is broken.

Changelog:
[Internal] [Changed] - Clarify init behavior for 0.76

Reviewed By: huntie, cipolleschi

Differential Revision: D62958747

fbshipit-source-id: ce3d974df55162720d59a7ece7fcb816e257185d
2024-09-19 03:08:10 -07:00
Samuel Susla 0fe234cb60 execute task directly instead of going through runEventLoopTick (#46540)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46540

changelog: [internal]

avoid calling `runEventLoopTick` and execute task directly. runEventLoopTick is not designed to be called on re-entries.

Reviewed By: rubennorte

Differential Revision: D62871782

fbshipit-source-id: 259514d05eebed2e09d54233729994e56f2aa1a4
2024-09-18 18:02:06 -07:00
Joe Vilches 7e38cf32eb Fix crash that happens with shadow color with 0 alpha (#46551)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46551

We crash if we pass a shadow color with 0 alpha due to some divide by 0 logic. This fixes that for inset and outset shadows and adds a test for that case.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62899047

fbshipit-source-id: 2aff1d016dd97bed024df1c3f89bcc62e49f0306
2024-09-18 16:44:45 -07:00
David Vacca 40638b8c26 Fix logging of internals of React Native renderer (#46562)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46562

This diff if fixing the logging of internal statistics of React Native Android renderer

changelog: [internal] intenral

Reviewed By: javache

Differential Revision: D59985973

fbshipit-source-id: 5f5020a516d236ef41b0bff087b00e7d7c721bb8
2024-09-18 13:55:44 -07:00
Rubén Norte fea0aa7f83 Create feature flag to make estimation for remaining time in frame for view preallocation more precise (#46563)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46563

Changelog: [internal]

Our current implementation of view preallocation on Android runs very early in the frame (during the `animation` stage, after `input` and before `traversal`). In that implementation, we check the remaining time in the frame and we allocate half of that time for view preallocation.

This logic can make us drop frames unnecessarily, if the work that we need to do after this allocated time is longer than we expect. Because we don't know how long the `traversal` stage will be, we don't account for that time at all (or, at best, we do only use half of the remaining time).

This creates a feature flag to move view preallocation outside of the choreographer, so we can compute the remaining time considering all the work we did in the frame, and not just the work we did in the input stage.

Reviewed By: javache

Differential Revision: D62962341

fbshipit-source-id: 69aaeecc8596906e61b47af9adad23c1075a091a
2024-09-18 13:25:49 -07:00
Pieter De Baets 7f55dc0f45 Remove unused UIManager lookup in NativeAnimatedNodesManager (#46565)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46565

UIManager is initialized elsewhere in NativeAnimatedNodesManager so this is no longer required

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D62958646

fbshipit-source-id: af77ddbbc65124ed29d301340ad339d2a916f58c
2024-09-18 11:05:25 -07:00
Rubén Norte 68e55284c5 Ship correct fix for state updates after smooth scroll animation (#46564)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46564

Changelog: [internal]

I incorrectly set up an experiment to fix reported scroll position during smooth scroll animations on Android in D59233069. It was incorrect because I fixed the issue in "control", and I re-enabled the bug in "test".

That means we actually shipped the fix the moment we set up the experiment.

We can just apply the fix ungated.

Reviewed By: Abbondanzo

Differential Revision: D62965254

fbshipit-source-id: edf855619ff9ede6fd406f7f19b3c504ce89f1d6
2024-09-18 10:09:11 -07:00
Thomas Nardone 74aaf7baa1 Nullsafe react/views/view (#46490)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46490

Fix nulls to prepare this module for further Kotlin conversion

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D62641672

fbshipit-source-id: a426ae30bc0529cfd5057cae68f74f3a52cc514f
2024-09-18 09:47:13 -07:00
Rubén Norte a5dd56f7d0 Create flag to disable reentrancy in MountItemDispatcher (#46561)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46561

Changelog: [internal]

We have some logic in `MountItemDispatcher.tryDispatchMountItems` to recursively call itself for as long as there are new items to mount in the general queue. This queue is copied and processed every time `tryDispatchMountItems` is called, but it's possible that during this time new mount operations are added (either from JS or from the mount operations themselves).

This logic can cause frame drops, as we could be finish processing the current frame without processing new mount items (we could do that in the next frame, and in many cases it's just pre-rendering work and state updates that the user can't perceive anyway).

This creates a feature flag to test disabling this behavior and only process whatever mount items are queued at the start of the frame.

Reviewed By: sammy-SC

Differential Revision: D62958009

fbshipit-source-id: ca038c827715411375410215deb5d5e374f5fdb4
2024-09-18 09:10:00 -07:00
Dawid 42bad68220 fix app crashing when reloads overlap (#46416)
Summary:
Regarding the [issue](https://github.com/facebook/react-native/issues/44755) where the app sometimes crashes due to race condition when two reloads overlap in unfortunate way. This PR fixes it in some way by introducing throttling on reload command. For now I set it to 700ms as I was still able to reproduce it on 500-550ms for provided repro in the issue. The problem may still happen for bigger apps where reload may take more time to finish.

## 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
-->

[GENERAL] [FIXED] - throttle reload command

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

Test Plan: I've tested on provided repro and a smaller app trying to brake it.

Reviewed By: huntie

Differential Revision: D62847076

Pulled By: cipolleschi

fbshipit-source-id: 6471f792d6b692e87e3e98a699443a88c6ef43cd
2024-09-18 07:32:59 -07:00
Riccardo Cipolleschi 7de3111f9b Add Maestro test for New Arch Example (#46541)
Summary:
This change adds automated tests for the New Architecture Examples page in RNTester.
It also updates the NativeComponentExample to make sure that iOS and Android behaves in the same way and in a reliable way.

## Changelog:
[Internal] - Adds

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

Test Plan:
* Android:

https://github.com/user-attachments/assets/65ead328-9c4f-4e0f-8b9b-992ffb584566

* iOS:

https://github.com/user-attachments/assets/412a4f68-c9c9-4ff2-a3e9-ae7194deef77

Reviewed By: cortinico

Differential Revision: D62879289

Pulled By: cipolleschi

fbshipit-source-id: 59e15f48f5995b18fd8b3ee24aca726b93e04d9f
2024-09-18 06:15:58 -07:00
Dmitry Rykun 4b035d820d Ship shouldSkipStateUpdatesForLoopingAnimations (#46556)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46556

Changelog: [General][Breaking] - Native looping animation will not send React state update every time it finishes.

Facebook
The QE shows neutral results, and has been shipped https://www.internalfb.com/intern/qe2/rn_surface_loading_performance/skip_state_updates_for_looping_animations/wrapup/config

Reviewed By: javache

Differential Revision: D62877191

fbshipit-source-id: 5b04105b3a33535c0da3bc7835098a9c4571d482
2024-09-18 05:28:07 -07:00
Oskar Kwaśniewski 2f5adc3874 fix(iOS): subscribe to orientation changes only on iOS (#46531)
Summary:
This PR adds iOS ifdefs to `RCTUIManager` to subscribe to orientation changes on this platform.

The `UIDeviceOrientationDidChangeNotification` symbol is only available there.

## Changelog:

[IOS] [FIXED] - subscribe to orientation changes in RCTUIManager only on iOS

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

Test Plan: CI Green

Reviewed By: philIip

Differential Revision: D62864013

Pulled By: cipolleschi

fbshipit-source-id: 341df9ac765735273378d017b63fcb7a4d8e98e5
2024-09-18 03:28:26 -07:00
Riccardo Cipolleschi 405d982854 Add patch script to enable E2E tests in CI (#46546)
Summary:
This chang introduces a patch file that can be applied to run the E2E tests in CI.

From the root folder `react-native`, a user can just run:

```sh
git apply packages/rn-tester/scripts/enable-e2e-tests.patch
```

And then add a commit to their PR to see whether the newly added E2E tests are actually running

## Changelog:
[Internal] - add patch to simplify running E2E tests in CI

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

Test Plan: Tested locally

Reviewed By: NickGerleman

Differential Revision: D62880559

Pulled By: cipolleschi

fbshipit-source-id: 19d639b2641aaa50e4f3e0753018d426d2da81c9
2024-09-18 02:18:26 -07:00
Benoit Girard a5dd1be889 Fix setImmediate/clearTimeout mismatch in NativeAnimatedHelper (#46525)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46525

While debugging I noticed that my setTimout was being cleared by someone else. Upon further inspection I found NativeAnimatedHelper which was mismatching setImmediate timer handle with a clearTimeout. This isn't safe and needs to be fixed.

I used this to rename the timer to be more clear to reduce the changes of mismatches.

Changelog:
[General][Fixed] - Fix setImmediate/clearTimeout mismatch in NativeAnimatedHelper that could clear an unrelated setTimeout.

Reviewed By: javache, yungsters

Differential Revision: D62775703

fbshipit-source-id: c1669c60bd08f13a59dd6159be2f471a6c1beebd
2024-09-17 20:33:43 -07:00
Rodolfo Gomez Sirimarco bebd6531b5 Fix ActionSheetIOS crash attempt to insert nil object from objects (#46550)
Summary:
There is a crash on iOS when trying to show an action sheet, but `RCTPresentedViewController` returns null. The code attempts to print an error but fails when casting values.

The issue is that some values, like _title_ or _message_ could be `nil`, which causes a failure when casting them to use in `RCTLogError`.

Fixes: https://github.com/facebook/react-native/issues/46549

## Stacktrace:

```
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
  0   CoreFoundation                      0x00000001804ae0f8 __exceptionPreprocess + 172
  1   libobjc.A.dylib                     0x0000000180087db4 objc_exception_throw + 56
  2   CoreFoundation                      0x000000018051c84c -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 660
  3   CoreFoundation                      0x00000001804ac9cc +[NSDictionary dictionaryWithObjects:forKeys:count:] + 48
  4   AwesomeProject.debug.dylib          0x0000000106ed9138 __61-[RCTActionSheetManager showActionSheetWithOptions:callback:]_block_invoke_4 + 340
  5   libdispatch.dylib                   0x0000000103f3bec4 _dispatch_call_block_and_release + 24
  6   libdispatch.dylib                   0x0000000103f3d73c _dispatch_client_callout + 16
  7   libdispatch.dylib                   0x0000000103f4d3f8 _dispatch_main_queue_drain + 1228
  8   libdispatch.dylib                   0x0000000103f4cf1c _dispatch_main_queue_callback_4CF + 40
  9   CoreFoundation                      0x000000018040e960 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
  10  CoreFoundation                      0x0000000180409078 __CFRunLoopRun + 1936
  11  CoreFoundation                      0x00000001804084d4 CFRunLoopRunSpecific + 572
  12  GraphicsServices                    0x000000018ef2aae4 GSEventRunModal + 160
  13  UIKitCore                           0x00000001853d0a28 -[UIApplication _run] + 868
  14  UIKitCore                           0x00000001853d46b0 UIApplicationMain + 124
  15  AwesomeProject.debug.dylib          0x0000000106d47bec __debug_main_executable_dylib_entry_point + 96
  16  dyld                                0x0000000102fbd544 start_sim + 20
  17  ???                                 0x00000001030620e0 0x0 + 4345700576
  18  ???                                 0x4e6d800000000000 0x0 + 5651313844908195840
```

## Changelog:

[IOS] [FIXED] - Fix ActionSheetIOS crash `attempt to insert nil object from objects`

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

Test Plan:
I created an example project.

Example: https://github.com/RodolfoGS/react-native-fix-ios-actionsheet

### How to reproduce using the example above:
1. `git clone git@github.com:RodolfoGS/react-native-fix-ios-actionsheet.git`
2. `cd react-native-fix-ios-actionsheet`
3. `npm install`
4. `npm run ios`
5. Tap on _Show Action Sheet_ button on the app
6. Notice the crash

### Steps to create the example from scratch and reproduce the crash:
1. `npx react-native-community/cli@latest init AwesomeProject`
2. `cd AwesomeProject`
3. Install `patch-package` and add this patch to simulate a situation where `RCTPresentedViewController` returns null (https://github.com/RodolfoGS/react-native-fix-ios-actionsheet/blob/main/patches/react-native%2B0.75.3.patch)
4. `npm run ios`
5. Tap on _Show Action Sheet_ button on the app
6. Notice the crash

Reviewed By: caodoan

Differential Revision: D62897554

Pulled By: philIip

fbshipit-source-id: fb978c4648a6c4e36c609783e59367a5997e42cb
2024-09-17 17:22:54 -07:00
Nishan 6866968a79 fix(android): linear gradient with platform color (#46290)
Summary:
Fix platform color on android with linear gradient.

## Changelog:

[ANDROID] [FIXED] - Linear gradient with platform colors

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

Pick one each for the category and type tags:

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

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

Test Plan: Added example and testcases

Reviewed By: mdvacca

Differential Revision: D62277253

Pulled By: NickGerleman

fbshipit-source-id: 376ee5ebde61f3cb1ed32e82f71ad5479ebc50a5
2024-09-17 17:21:57 -07:00
javache (Meta Employee) bca232ad90 Fix misleading crash when view config is not found (#30970) (#46518)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46518

## Summary

When a view config can not be found, it currently errors with
`TypeError: Cannot read property 'bubblingEventTypes' of null`. Instead
invariant at the correct location and prevent further processing of the
null viewConfig to improve the error logged.

## How did you test this change?

Build and run RN playground app referencing an invalid native view
through `requireNativeComponent`.

Changelog: [General][Fixed] Improved error message when no view config is found.

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

Test Plan: Sandcastle tests

Reviewed By: jackpope

Differential Revision: D62760863

Pulled By: javache

fbshipit-source-id: c71dacc48fe8795b28840cfb3f53c1f9fc664a16
2024-09-17 14:13:38 -07:00
Eli White 6666df9fb8 Add a union of all the types (#46528)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46528

This is needed for a script that needs to switch over all possible type annotations in the codegen schema.

Reviewed By: GijsWeterings

Differential Revision: D62805189

fbshipit-source-id: 8fd113f4ad0b695b38e92b8d0fc45a991f597fb8
2024-09-17 13:20:04 -07:00
Samuel Susla 785123b9de fix isEventLoopScheduled_ getting stuck in true (#46538)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46538

changelog: [internal]

When we run synchronous task, it was able to get into a state where RuntimeScheduler stopped executing tasks in the queue and it wouldn't get unstuck. This appeared as non-responsive app.

The problem was that `isEventLoopScheduled_` was not being restarted in case `syncTaskRequests_` was bigger than 0. There is a unit test covering this scenario.

Reviewed By: rubennorte

Differential Revision: D62756582

fbshipit-source-id: 878b8445baea05e8b9eddae05ca0d11d5e93acb6
2024-09-17 13:15:54 -07:00
Rexogamer de2f9c0f77 fix: clean up various ESLint issues (#46379)
Summary:
this PR fixes a few small ESLint issues that were showing up under PR diffs.

## Changelog:

[INTERNAL] [FIXED] - Fix various ESLint issues

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

Test Plan: ran JS tests + linter; all passing

Reviewed By: cipolleschi

Differential Revision: D62385788

Pulled By: NickGerleman

fbshipit-source-id: b33d7ade4696bbaed2ac1a3fc2e0b3dff9bb04b7
2024-09-17 13:07:20 -07:00
Alex Hunt 188f99b17a Clarify behaviour of noop init command in 0.76 (#46547)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46547

While testing the 0.76 RCs, it was initially unclear to me that `npx react-native init` was both deprecated and **removed** (performs a noop). Update message for clarity.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D62881266

fbshipit-source-id: b9017e63360c7aee5483d437ce1510be9a14ef42
2024-09-17 10:40:35 -07:00
Yedidya Feldblum e9d48ae3c7 migrate from untagged array-range dynamic ctor (#46477)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46477

Reviewed By: NickGerleman

Differential Revision: D62582942

fbshipit-source-id: 24631924c4d2eb8001b7593594d0a3ed5d16e233
2024-09-17 10:19:12 -07:00
Alex Hunt 8972d0998f Add missing babel-jest dependency to react-native package (#46539)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46539

Resubmission of D62583665, addressing internal CI errors from dep relocation.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D62867287

fbshipit-source-id: d28d35e2c0a82d7d2bfdaa26c4f9fe8c3a5ef41a
2024-09-17 09:42:36 -07:00
Rubén Norte 89f824b081 Pass default values for feature flags to overrides providers (#46533)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46533

Changelog: [internal]

When defining overrides for feature flags, it's common to have this pattern:

```javascript
myFeatureFlag: () => someCondition ? value : defaultValueForFlag
```

But it's not always obvious how to get the default value defined in the feature flag system. This modifies the API so we receive the default value as a parameter to simplify the logic:

```javascript
myFeatureFlag: (defaultValueForFlag) => someCondition ? value : defaultValueForFlag
```

Reviewed By: mdvacca, rshest

Differential Revision: D62853299

fbshipit-source-id: 9421e31d00662e2a23f1e3fb43bdc9f5cf03fdf3
2024-09-17 09:16:41 -07:00
Rubén Norte 958d35ffd4 Make RN feature flags Flow strict (#46530)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46530

Changelog: [internal]

There's nothing preventing these modules from being `flow strict` instead of `flow strict-local`, so we can just make the change.

Reviewed By: mdvacca

Differential Revision: D62763719

fbshipit-source-id: 1821ef9ad2e8dc67b754eccc77e35ef34400ca0a
2024-09-17 09:16:41 -07:00
MasGaNo 1e59f2e3f8 fix(ios): allow pods mixte type settings on post-install (#46536)
Summary:
Following the discussion on https://github.com/facebook/react-native/issues/46505, this PR aims to allow mixte type configuration (String and/or Array of String) during the post installation of pods.

## 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] - allow pods mixte type settings on post-install

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

Test Plan: `packages/react-native/scripts/cocoapods/__tests__/utils-test.rb` test suits was updated to support array and works as expected

Reviewed By: shwanton

Differential Revision: D62870582

Pulled By: cipolleschi

fbshipit-source-id: c0ace6d9d20e6609ceae5aafd236d97fc9e86ddf
2024-09-17 09:11:26 -07:00
anirudh.bharti 7cdb87eb19 chore: replace mkdirp with mkdir fs (#46388)
Summary:
This pull request replaces the use of mkdirp with Node.js's built-in fs.mkdirSync({ recursive: true }) function, which is available in Node.js version 10.12.0 and above. This change reduces the number of external dependencies and simplifies the codebase by using the native capabilities of Node.js.

The motivation behind this change is to remove the unnecessary mkdirp dependency, as Node.js natively supports recursive directory creation since version 10.12.0. This streamlines the code and reduces the reliance on external libraries.

## Changelog:

[INTERNAL] [REMOVED] - Replaced mkdirp with fs.mkdirSync({ recursive: true }) in build scripts and codegen. Requires Node.js 10.12.0 and above.

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

Test Plan: I ran the build and codegen scripts locally with Node.js version 10.12.0 and above after replacing mkdirp, ensuring the scripts work as expected. No issues were encountered, and all processes, including directory creation and file handling, function correctly.

Reviewed By: cortinico

Differential Revision: D62852488

Pulled By: huntie

fbshipit-source-id: 76f44102a80b499521c156308d276a17d279ce38
2024-09-17 07:03:44 -07:00
Oskar Kwaśniewski 3c17beafe3 fix(iOS): move boost compiler flags and folly dep name to centralized config (#46513)
Summary:
This PR does some further cleanup on the flags passed to cocoapods.

I've moved `boost_compiler_flags` and `folly_dep_name` to `helpers.rb` file.

## Changelog:

[INTERNAL] [FIXED] -  move boost compiler flags and folly dep name to centralized config

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

Test Plan: CI Green

Reviewed By: cortinico

Differential Revision: D62846105

Pulled By: cipolleschi

fbshipit-source-id: dff07ddb49f1f4b559125f2ed8508b32f08d4975
2024-09-17 04:57:36 -07:00
Oskar Kwaśniewski e82743cf66 fix(internal): formatting of tsconfig.json (#46529)
Summary:
This PR is a small fix for the indentation of `tsconfig.json`

## Changelog:

[INTERNAL] [FIXED] -  fix for the indentation of `tsconfig.json`

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

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D62845892

Pulled By: cipolleschi

fbshipit-source-id: 52a0309027350cd9bba8c2c158887b23ea093876
2024-09-17 04:22:28 -07:00
legobt eacab6d420 chore(react-native): accept failing glog configure in setup script (#46358)
Summary:
Due to `set -e` shell option, missing `xcrun` may cause the setup script to fail on Linux.

Also makes the script continue even if the glog `./configure` call does not succeed.

### Related
- Follow-up to https://github.com/facebook/react-native/pull/44417

## Changelog:

- [Internal] [Fixed] - react-native: make missing xcrun not throw in `ios-configure-glog.sh`
- [Internal] [Fixed] - react-native: accept failing glog ./configure in `ios-configure-glog.sh`

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

Reviewed By: cortinico

Differential Revision: D62851737

Pulled By: cipolleschi

fbshipit-source-id: 3ed76a81b6f428a1697c364698a0dfdd3bbb74f2
2024-09-17 03:41:29 -07:00
Vin Xi cf42288181 fix(react-native-xcode): Add back BUNDLE_COMMAND (#46495)
Summary:
In this PR https://github.com/facebook/react-native/issues/45560  the BUNDLE_COMMAND initialization was removed while it is still being used. Without it, building from Xcode throws unknown options error for Physical iOS devices.

I have just brought back the initialization from the PR before that, so the bundle phase is successful.

## Changelog:
[IOS][Fixed] - Add back the BUNDLE_COMMAND

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

Test Plan: I have bundled release builds in Xcode. Everything seems to be fine.

Reviewed By: cortinico

Differential Revision: D62846877

Pulled By: cipolleschi

fbshipit-source-id: 3f07e8c0bc5acf98177582f1fee9a55ae77b31a1
2024-09-17 02:34:06 -07:00
Shawn Dempsey 9a6354fbbf Annotate DefaultTurboModuleManagerDelegate to avoid redex stripping dep in prod (#46527)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46527

Changelog: [Internal]

**Context**
- `DefaultTurboModuleManagerDelegate.kt` was being stripped by redex since there was no direct dependency.
- This was causing a crash in prod builds
```
Trace: java.lang.RuntimeException: Unable to create application com.facebook.mobilehome.MobileHomeAppShell: java.lang.ClassNotFoundException: Didn't find class "com.facebook.react.defaults.DefaultTurboModuleManagerDelegate" on path: DexPathList
```

**Change**
- Annotate `DefaultTurboModuleManagerDelegate.kt` with `DoNotStripAny`
- Don't strip `DoNotStripAny` annotated classes

Reviewed By: mdvacca

Differential Revision: D62766339

fbshipit-source-id: 7d9bfa04e252c392b94f739443bacf34f593e481
2024-09-16 20:03:07 -07:00
Nick Gerleman 51673e41ae Breaking: Remove ReactViewBackgroundManager and ReactViewBackgroundDrawable (#46166)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46166

## This Diff

This removes some of the legacy utilties used for background manipulation, no longer used anywhere (and very rarely used externally from some previous tests). These conflict with BackgroundStyleApplicator, which should be used instead.

## This Stack

This removes the non-Style-applicator background management paths of the different native components. There have been multiple conflicting changes, and bugs added bc harder to reason about, which motivates making this change as soon as possible. This also lets us formalize guarantees that BaseViewManager may safely manipulate background styling of all built in native components.

There is one still known issue, where BackgroundStyleApplicator does not propagate I18nManager derived layout direction to borders (compared to Android derived root direction). This is mostly an issue for apps that with LTR and RTL context, or force a layout direction, which I would guess is relatively rare, so my plan is to forward fix this later this by enabling set_android_layout_direction which will solve that problem mopre generically.

Changelog:
[Android][Breaking] - Remove ReactViewBackgroundManager and ReactViewBackgroundDrawable

Reviewed By: sammy-SC

Differential Revision: D61658084

fbshipit-source-id: 611f6d78fa4859574c063e9f0395c3dadc1588cc
2024-09-16 19:14:53 -07:00