Commit Graph
33137 Commits
Author SHA1 Message Date
Kudo ChienandBlake Friedman 3b64ed0097 Fix lazy import error from jest and Appearance.js (#47629)
Summary:
currently running jest test, it shows an error:

```
ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From __tests__/App.test.tsx.

      at getState (node_modules/react-native/Libraries/Utilities/Appearance.js:18:26)
      at addChangeListener (node_modules/react-native/Libraries/Utilities/Appearance.js:71:19)
      at subscribe (node_modules/react-native/Libraries/Utilities/useColorScheme.js:10:66)
      at subscribeToStore (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6232:10)
      at commitHookEffectListMount (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13038:26)
      at commitPassiveMountOnFiber (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14461:11)
      at commitPassiveMountEffects_complete (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14421:9)
      at commitPassiveMountEffects_begin (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14408:7)
      at commitPassiveMountEffects (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14396:3)
      at flushPassiveEffectsImpl (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16287:3)
      at flushPassiveEffects (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16236:14)
      at node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16051:9
      at workLoop (node_modules/scheduler/cjs/scheduler.development.js:266:34)
      at flushWork (node_modules/scheduler/cjs/scheduler.development.js:239:14)
      at Immediate.performWorkUntilDeadline [as _onImmediate] (node_modules/scheduler/cjs/scheduler.development.js:533:21)
```

it is a regression from https://github.com/facebook/react-native/issues/46123 that to have a lazy require.

this pr tries to mock `useColorScheme` to return `light`. i think we don't necessarily test the color scheme changes in jest runtime. originally `useColorScheme` also returns `light` because of [this statement](https://github.com/facebook/react-native/blob/9a60038a40e16925ea1adeb3e3c937c22a615485/packages/react-native/Libraries/Utilities/Appearance.js#L77-L83)

## Changelog:

[GENERAL] [FIXED] - Fixed jest error from Appearance.js

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

Test Plan:
```sh
$ npx react-native-community/cli init RN0762 --pm bun --version 0.76.2
$ cd RN0762
$ bun test run
```

Reviewed By: cipolleschi

Differential Revision: D66297456

Pulled By: huntie

fbshipit-source-id: 80d1460532e76bd1815c66964547b50d7f7b3558
2024-12-04 16:34:06 +00:00
Riccardo CipolleschiandBlake Friedman 5b2bbb84b1 Include autolinkin.h in OnLoad.cpp only if it exists (#47875)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47875

The old architecture looks broken because in the OnLoad.cpp file we try to include the autolinking.h header which is only generated when the New Architecture is enabled.

This fix guards the include and the usage of the function provided by the autolinking so that the old architecture should work as well.

## Changelog
[Internal] - Include autolinkin.h in OnLoad.cpp only if it exists

Reviewed By: blakef

Differential Revision: D66295318

fbshipit-source-id: 18461e6b70ac92af57b805bef51c0df49db02283
2024-12-04 16:33:46 +00:00
Rob HoganandBlake Friedman 304179d297 metro-config: Revert setting hermesParser: true in default Metro config (#47670)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47670

Now that we have `babel-plugin-syntax-hermes-parser` in `react-native/babel-preset` (since D63535216), it's no longer necessary to use `hermes-parser` directly in Metro in order to use newer Flow syntax.

Babel with `babel-plugin-syntax-hermes-parser` is generally preferable, because it intelligently falls back to parsing with Babel for any non-`flow` files.

See https://github.com/facebook/hermes/issues/1549 for context.

Changelog:
[General][Fixed] metro-config: Don't use `hermes-parser` by default, prefer `babel-plugin-syntax-hermes-parser`, which supports other syntax plugins.

Reviewed By: huntie

Differential Revision: D66002056

fbshipit-source-id: cf48acec347e2c0791872f8ca4b53f5f8af1c783
2024-12-04 16:33:31 +00:00
Nick GerlemanandBlake Friedman 73f6277175 Fix possible NSRangeException when updating typing attributes in response to new text content (#47737)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47737

We may see an NSRangeException when setting new AttributedString content, where setting the AttributedString itself changes selection (before we mutate it later).

It seems like the selection here is not in a good state yet in regards to the AttributedString backing exposed (since we are reading it while modifying it). So let's fold the logic for updating typing attributes into the collection of ignored work from non-user-selection updates, since programatically setting an AttributedString will already trigger updating typing attributes.

I also added a nil check here, which is unrelated to the crash, but it seems like we should have it for safety...

Changelog:
[iOS][Fixed] - Fix possible NSRangeException when updating typing attributes in response to new text content

Reviewed By: cipolleschi

Differential Revision: D66202986

fbshipit-source-id: fded492b5022c5fef5b9563f93a57549d06a7020
2024-12-04 16:33:16 +00:00
zhongwuzwandBlake Friedman bc04bb4072 Fabric: Adjusts the weight according to the font name (#47742)
Summary:
Fixes another font weight issue mentioned in https://github.com/facebook/react-native/issues/47656#issuecomment-2486282496. We can get the weight from font name if user not specify weight.

esbenvb Is this work for you ?

## Changelog:

[IOS] [FIXED] - Fabric: Adjusts the weight according to the font name

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

Test Plan: Demo in https://github.com/facebook/react-native/issues/47656#issuecomment-2486282496.

Reviewed By: cipolleschi

Differential Revision: D66236128

Pulled By: javache

fbshipit-source-id: d325a7fee28681a1e95fa0341cb7a16fcd9918c0
2024-12-04 16:32:58 +00:00
zhongwuzwandBlake Friedman 9f1c6bcc13 Fabric: Fixes custom font of weight is not honored (#47691)
Summary:
Fixes https://github.com/facebook/react-native/issues/47656 .

## Changelog:

[IOS] [FIXED] - Fabric: Fixes custom font of weight is not honored

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

Test Plan: Demo in https://github.com/facebook/react-native/issues/47656

Reviewed By: cipolleschi

Differential Revision: D66174732

Pulled By: javache

fbshipit-source-id: 5e6a8c870d3a13283548c736aed73193f7976bfc
2024-12-04 16:32:36 +00:00
Riccardo CipolleschiandBlake Friedman a1ac30193d Do not discard props when setNativeProps is used (#47669)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47669

When investigating [#47476](https://github.com/facebook/react-native/issues/47476), I found that the `secureTextInput` prop was not changing in the Mounting layer when changing it in JS.

I track down the problem to the `UIManager::cloneNode` method.
When we clone the node, we first merge the patch that arrives from React into the props controlled by setNativeProps, ignoring the patch's props that are controlled by React.

But then, we forgot to merge back the React's controlled property into the final props, effectively losing them.

This change adds an extra merging step, merging the props controlled with setNativeProps back into the patch of props controlled by React, and then using this new set of props as source of truth.

## Changelog:
[General][Fixed] - do not discard props in the patch when they are not null while using `useNativeProps`

Reviewed By: sammy-SC

Differential Revision: D65948574

fbshipit-source-id: db4f2b793f4a6348456933c95a151012252b8ebc
2024-12-04 16:32:15 +00:00
Alex HuntandBlake Friedman 0e8769e7cd Revert to @babel/eslint-parser in eslint-config (#47333)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47333

Motivated by https://github.com/facebook/hermes/issues/1549. This was originally changed in https://github.com/facebook/react-native/pull/46696, as our internal Flow support had diverged from `babel/eslint-parser` (https://github.com/facebook/react-native/issues/46601).

We effectively have three flavours of JavaScript in support:
- Flow@latest for the `react-native` package, shipped as source — uses `hermes-parser`.
- TypeScript for product code (community template, Expo) — uses `babel/plugin-syntax-typescript`.
- Plain JavaScript or Flow in product code, *which may be extended with additional user Babel plugins and needs lenient parsing* — uses `babel/plugin-syntax-flow` via `babel/eslint-parser` (**this change**).

I'd love to simplify this 😅.

Switching to `hermes-eslint` for the RN monorepo codebase (D63541483) is unchanged.

Changelog: [Internal]

Reviewed By: robhogan, cipolleschi

Differential Revision: D65272156

fbshipit-source-id: 3a2bbe3fcf8ed6057f6d994a0be4985e6bf46fa9
2024-12-04 16:27:07 +00:00
BIKI DASandBlake Friedman abbe117a7b Dispatch onMomentumScrollEnd after programmatic scrolling (#45187)
Summary:
in iOS on a scroll generated programatically, the `onMomentScrollEnd` is fired, though in case of android the same does not happen, this PR tries to implement the same behaviour for android as well, while diving through the code it seems we have two extra `onMomentumScrollEnd` events. Only one event should be fired.

**iOS Behaviour on Programmatic Scroll**

https://github.com/facebook/react-native/assets/72331432/fb8f16b1-4db6-49fe-83a1-a1c40bf49705

https://github.com/facebook/react-native/assets/72331432/9842f522-b616-4fb3-b197-40817f4aa9cb

**Android Behaviour on Programmatic Scroll**

https://github.com/facebook/react-native/assets/72331432/c24d3f06-4e2a-4bef-81af-d9227a3b1a4a

https://github.com/facebook/react-native/assets/72331432/d4917843-730b-4bd7-90d9-33efb0f471a7

If closely observed we can see the `onMomentumScrollEnd` does not gets called in Android unlike to iOS.

[Android][Fixed] - Dispatch onMomentumScrollEnd after programmatic scrolling

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

Test Plan:
i have added updates to the FlatList example and ScrollViewSimple
here is a ScreenRecording of `onMomentumScrollEnd` firing in android after the code changes

https://github.com/facebook/react-native/assets/72331432/f036d1a5-6ebf-47ba-becd-4db98a406b15

https://github.com/facebook/react-native/assets/72331432/8c788c39-3392-4822-99c5-6e320398714b

Reviewed By: javache

Differential Revision: D65539724

Pulled By: Abbondanzo

fbshipit-source-id: f3a5527ac5979f5ec0c6ae18d80fdc20c9c9c14b
2024-12-04 16:16:40 +00:00
Blake Friedman 2d337efc23 Update Podfile.lock
Changelog: [Internal]
2024-11-21 23:09:09 +00:00
Blake Friedman 3287014ee9 [LOCAL] fix GHA publishTemplate verification 2024-11-21 22:37:02 +00:00
React Native Bot 605e2e443b Release 0.76.3
#publish-packages-to-npm&latest
v0.76.3
2024-11-21 19:12:36 +00:00
Riccardo CipolleschiandBlake Friedman d8b727c6bf Allow downgrading CMake to build hermesc on Windows (#47867)
Summary:
CI is failing to build HermesC on windows due to a version mismatch of the CMake already installed

## Changelog:
[Internal] - Fix Windows CI for HermesC

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

Test Plan: GHA

Reviewed By: robhogan

Differential Revision: D66292617

Pulled By: cipolleschi

fbshipit-source-id: 5e8f4f45e33fbdd9ff163b4e8a09cb98d4366dc7
2024-11-21 16:21:31 +00:00
Blake FriedmanandBlake Friedman e70cad24f0 Support Windows sdkmanager.bat (#47874)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47874

We should be searching for the .bat file on Windows to remain compatible with some user setups.

Changelog: [Android][Fixed] look for sdkmanager.bat

Reviewed By: cipolleschi

Differential Revision: D66295240

fbshipit-source-id: 6b79a9aa40f77ed9c5b3d6ad92b1a62e78159223
2024-11-21 15:41:45 +00:00
Blake FriedmanandBlake Friedman 9946838bed CMake Windows path normalization (#47702)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47702

Use `file(TO_CMAKE_PATH` to normalize paths, and normalizing `input_SRC` as it's already a CMake path.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D66101321

fbshipit-source-id: e81af40551d2777901f9c7cf9a4175f2bce76ec8
2024-11-21 15:41:45 +00:00
Fouad MagdyandBlake Friedman 08b8300548 fix build failure on windows in android (#47641)
Summary:
This pull request addresses a CMake configuration issue where an invalid escape character in file paths caused the build process to fail. Specifically, it resolves the issue in the React Native CMake configuration file where the path separator was incorrectly handled, leading to an error in the build system.

the issue is in [This Issue](https://github.com/expo/expo/issues/32955) and [This](https://github.com/expo/expo/issues/32957)

## 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] [FIXED] - Corrected invalid escape character in CMake path handling

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

Test Plan:
To test the changes, I performed the following steps:

1. Cloned the repository and checked out the `fix-cmake-invalid-escape-character` branch.
2. Ran the CMake build on a Windows environment where the issue was previously occurring.
3. Verified that the build process completed successfully without the "invalid character escape" error.
4. Ensured that the path handling now works correctly in CMake on Windows platforms.

Reviewed By: rshest

Differential Revision: D66073896

Pulled By: cipolleschi

fbshipit-source-id: bd2a71bb00ce5c5509ed403842c995c32f58f91d
2024-11-21 15:41:45 +00:00
Riccardo Cipolleschi d01d01464b [LOCAL] Bump Podfile.lock 2024-11-18 11:00:33 +00:00
Blake Friedman ac61c14b58 Fix typo in template action watcher script (#47286)
Summary:
Trivial typo - static analysis would have been a good thing.

Changelog: [Internal]

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

Test Plan: eyes

Reviewed By: NickGerleman

Differential Revision: D65145600

Pulled By: blakef

fbshipit-source-id: 567ef3637441aa84651dce03f45b80068c5f4290
2024-11-15 10:23:57 +00:00
React Native Bot 81737c2b99 Release 0.76.2
#publish-packages-to-npm&latest
v0.76.2
2024-11-14 16:50:52 +00:00
Alex HuntandGitHub ff1261e7dc [0.76] Skip hermes-parser under Babel for non-Flow JS code (#47569) 2024-11-13 12:12:23 +00:00
Riccardo CipolleschiandBlake Friedman 1e659dc44e Fix Typo and skip generation of app-specific component registration (#47547)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47547

In [#47176](https://github.com/facebook/react-native/pull/47176) we disabled the generation of the component registration for app specific components as it was creating a circular dependency between the app and React Native.

However, we made a couple of typos that make it not work as expected and users picked up those typos soon.

This change fixes them for good.

## Changelog
[iOS][Fixed] - Properly stop generating component registration for components defined in app.

Reviewed By: blakef

Differential Revision: D65750433

fbshipit-source-id: 1a879c5be014905558b9fd05e6f16ac36b784ed6
2024-11-12 19:14:32 +00:00
Jakub PiaseckiandBlake Friedman 9f65442f2d Fix timers in headless tasks on bridgeless mode (#47496)
Summary:
Fixes https://github.com/facebook/react-native/issues/47495

`JavaTimerManager` is being registered to receive headless tasks events in the [`TimingModule`](https://github.com/facebook/react-native/blob/0ee963ea65bcc88122044d51027511e611bde584/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.kt#L28-L29). This module is not used on bridgeless: [1](https://github.com/facebook/react-native/blob/0ee963ea65bcc88122044d51027511e611bde584/packages/react-native/Libraries/Core/setUpTimers.js#L44-L61), [2](https://github.com/facebook/react-native/blob/0ee963ea65bcc88122044d51027511e611bde584/packages/react-native/Libraries/Core/setUpTimers.js#L123-L132) and since it's loaded lazily, the event listener is never registered.

This PR moves registration to the constructor of `JavaTimerManager` and deregistration to the `onInstanceDestroy` method. This way the event listener is always registered when an instance of the timer manager exists.

## Changelog:

[ANDROID] [FIXED] - Fix timers in headless tasks on bridgeless mode

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

Test Plan: See the reproducer from the issue

Reviewed By: javache

Differential Revision: D65615601

Pulled By: alanleedev

fbshipit-source-id: 6e1d36f8783e813065f79730a928b99c3e385718
2024-11-12 19:14:18 +00:00
Nicola CortiandBlake Friedman c4fd80f414 Use absolute path when compiling appmodules.so sources (#47379)
Summary:
Fixes https://github.com/facebook/react-native/issues/47352

This fixes a bug when the user is providing its own CMakeLists.txt file say because they want to compile more C++ code than we actually provide.

Previously the `*.cpp` will evalute file in the current directory, meaning that the app's default `OnLoad.cpp` file would be ignored.

## Changelog:

[ANDROID] [FIXED] - Use absolute path when compiling appmodules.so sources

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

Test Plan:
Tested against the reproducer provided in:
- Use absolute path when compiling appmodules.so sources

Reviewed By: cipolleschi

Differential Revision: D65428676

Pulled By: cortinico

fbshipit-source-id: 7f3e4d470da0fffc5191c1a2c7e8fec517fee496
2024-11-12 19:13:59 +00:00
Nicola CortiandBlake Friedman e9fc092156 Properly handle paths with spaces in autolinking (#47388)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47388

Fixes https://github.com/facebook/react-native/issues/47364
Fixes https://github.com/facebook/react-native/issues/47377
Fixes https://github.com/facebook/react-native/issues/37124

We're having problems is a path contains a space ' ' because when autolinking,
the `add_subdirectory()` function of CMake consider the path with space as 2 parameters.

This fixes it by properly quoting the path.

Changelog:
[Android] [Fixed] - Properly handle paths with spaces in autolinking

Reviewed By: cipolleschi

Differential Revision: D65434413

fbshipit-source-id: b9147482f98f7e222405cc8d9e6f3c17a5f4ed02
2024-11-12 19:13:31 +00:00
Alan LeeandBlake Friedman e8c4faaf08 fix Modal content being cut off when Android Activity is edge-to-edge (#47339)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47339

Fixing issue raised in https://github.com/facebook/react-native/issues/47307

This is a follow up from D62286026.
It appears there was a line that went missing while trying to refactor the code.

`fitsSystemWindows = true` is needeod for < API 30 to avoid content rendering under the system bars when Modal is shown with Activity that is edge-to-edge.

Changelog:
[Android][Fixed] Fix Regression - Modal content rendering below system bar on < API 30 when activity is edge-to-edge

Reviewed By: cortinico

Differential Revision: D65280014

fbshipit-source-id: 616ff739be55635f1295ef3bf8b997a27ef769ae
2024-11-12 19:12:32 +00:00
Nick GerlemanandBlake Friedman fbe38bb2a3 Fix missing emitter attributes on iOS TextInput when controlled component value specified using value instead of children (#47269)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47269

There were [reports](https://github.com/reactwg/react-native-releases/issues/595) that patching in the fixes for iOS controlled input did not work as expected.

I think tracked this down to a difference in how I tested, where the controlled component I used passed value as a child of the `TextInput`, instead of via `value`. Passing via `value` triggers a secondary bug, where we don't correctly pass a reference to correct ShadowView when creating attributedstring, specifically in the iOS TextInputShadowNode impl.

We previously passed nothing for the ShadowView (only the first two struct fields). This was exposed in D52589303 which enabled `-Wextra`, but there, I went with same behavior of passing empty ShadowView, instead of the correct behavior (like Android impl) of passing a ShadowView of the current ShadowNode.

After fixing this, we now correctly create event emitters in the passed attributedstring, which matches expectations for pargraph-level eventemitter now in typing attributes. We don't seem actually use this on iOS for TextInput right now (just Text), but this is likely the right foundation for events regardless.

Changelog:
[iOS][Fixed] - Fix missing emitter attributes on iOS TextInput when controlled component value specified using `value` instead of `children`

Reviewed By: cipolleschi

Differential Revision: D65108163

fbshipit-source-id: 499fe28439fabd2579eca6ded7fd13fd8ea2e43e
2024-11-12 19:11:55 +00:00
Nick GerlemanandBlake Friedman 40093d96d1 Fix cursor moving while typing quickly and autocorrection triggered in controlled single line TextInput on iOS (New Arch) (#46970)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46970

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

This one is a bit of a doozy...

During auto-correct in UITextField (used for single line TextInput) iOS will mutate the buffer in two parts, non-atomically. After the first part, after iOS triggers `textFieldDidChange`, selection is in the wrong position. If we set full new AttributedText at this point, we propagate the incorrect cursor position, and it is never restored.

In the common case, where we are not mutating text in the controlled component, we shouldn't need to be setting AttributedString in the first place, and we do have an equality comparison there currently. But it is defeated because attributes are not identical. There are a few sources of that:
1. NSParagraphStyle is present in backing input, but not the AttributedString we are setting.
2. Backing text has an NSShadow with no color (does not render) not in the AttributedText
3. Event emitter attributes change on each update, and new text does not inherit the attributes.

The first two are part of the backing input `typingAttributes`, even if we set a dictionary without them. To solve for them, we make attribute comparison insensitive to the attribute values in a default initialized control. There is code around here fully falling back to attribute insensitive comparison, which we would ideally fix to instead role into this "effective" attribute comparison.

The event emitter attributes being misaligned is a real problem. We fix in a couple ways.
1. We treat the attribute values as equal if the backing event emitter is the same
2. We set paragraph level event emitter as a default attribute so the first typed character receives it

After these fixes, scenario in https://github.com/facebook/react-native-website/pull/4247 no longer repros in new arch. Typing in debug build also subjectively seems faster? (we are not doing second invalidation of the control on every keypress).

Changes which do mutate content may be susceptible to the same style of issue, though on web/`react-dom` in Chrome, this seems to not try to preserve selection at all if the selection is uncontrolled, so this seems like less of an issue.

I haven't yet looked at old arch, but my guess is we have similar issues there, and could be fixed in similar ways (though, we've been trying to avoid changing it as much as possible, and 0.76+ has new arch as default, so not sure if worth fixing in old impl as well if this is very long running issue).

Changelog:
[iOS][Fixed] - Fix cursor moving in iOS controlled single line TextInput on Autocorrection (New Arch)

Reviewed By: javache, philIip

Differential Revision: D64121570

fbshipit-source-id: 2b3bd8a3002c33b68af60ffabeffe01e25c7ccfe
2024-11-12 19:11:55 +00:00
Riccardo CipolleschiandBlake Friedman 6f9ddd8f89 Add yoga to app search paths (#47195)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47195

When a user wants to create a Fabric Component i their app (not in a separate library) the app fails to build because:
- The custom component has to inherit from `RCTViewComponentView`
- `RCTViewComponentView` imports `ViewProps.h`
- `ViewProps.h` imports `HostPlatformViewProps.h`
- `HostPlatformViewProps.h` imports `BaseViewProps.h`
- `BaseViewProps.h` imports `YogaStylableProps.h`

which is a Yoga private header and the App has not visibility over it.

It is also not possible to fix this issue with forward declaring the `YogaStylableProps`, because `BaseViewProps` inherit from the yoga's props, so the compiler needs the full declaration of `YogaStylableProps` to work

This needs to be picked in 0.76

## Changelog
[iOS][Fixed] - Give apps access to Yoga headers

Reviewed By: blakef

Differential Revision: D64925222

fbshipit-source-id: e724076bbfb0a678948340dfab2ce609e6509533
2024-11-12 19:00:04 +00:00
Nick GerlemanandBlake Friedman 3ce4b80e6f Include existing attributes in newly typed text (#47018)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47018

This change makes it so that newly typed text in a TextInput will include the existing attributes present based on cursor position. E.g. if you type after an inner fragment with blue text, the next character will be blue (or, an event emitter specific to an inner fragment will also be expanded). This is a behavior change for the (admittedly rare) case of uncontrolled TextInput with initially present children AttributedText, but more often effect controlled components, before state update (we are after, less likely to need to reset AttributedString because of mismatch).

Originally included this in D64121570, but it's not needed to fix the common case since we include paragraph-level event emitter as part of default attributes, and has some of its own risk, so I decided it is better separate.

Changelog:
[iOS][Changed] - Include existing attributes in newly typed text

Reviewed By: cipolleschi

Differential Revision: D64352310

fbshipit-source-id: 90ef8c49f50186eadf777e81cf6af57e1aada207
2024-11-12 18:58:46 +00:00
Riccardo CipolleschiandBlake Friedman a09df751eb Add TS types for Codegen (#46484)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46484

We recently realized that we don't have TS types for Codegen.
These are needed to let our users use these types when writing Specs in TS

## Changelog
[General][Added] - Add CodegenTypes for TS

Reviewed By: christophpurrer

Differential Revision: D62644516

fbshipit-source-id: 92bb7e8998d31806f6eb63319fb6d406fcd65ad8
2024-11-12 18:58:36 +00:00
Blake Friedman 94d4bfd7c8 [LOCAL] Update Hermes
Adds fix: facebook/hermes@c2c4ee7
2024-11-12 18:57:54 +00:00
Riccardo Cipolleschi a35852f976 [LOCAL] Fix lint process 2024-10-31 11:20:25 +00:00
Szymon RybczakandGitHub 51b98c24bd Bump CLI to 15.0.1 (#47328) 2024-10-31 10:25:02 +00:00
bbe5e72768 fix logbox error stack (#47303)
* Re-enable integration tests (#46639)

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

These tests were skipped when we were switching to component stacks, which also hid a bug later in the stack. Re-enable them.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63349616

fbshipit-source-id: ccde7d5bb3fcd9a27adf4af2068a160f02f7432a

* Add integration tests for console errors + ExceptionManager (#46636)

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

Adds more integration tests for LogBox (currently incorrect, but fixed in a later diff).

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63349614

fbshipit-source-id: 8f5c6545b48a1ed18aea08d4ecbecd7a6b9fa05a

* Refactor LogBox tests to spies (#46638)

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

This is annoying, but in the next diff that fixes a bug I need to test using the default warning filter instead of a mock (really, all this mocking is terrible, idk why I did it this way).

Unfortunately, in Jest you can't just reset mocks from `jest.mock`, `restoreMocks` only resets spies and not mocks (wild right).

So in this diff I converted all the `jest.mock` calls to `jest.spyOn`. I also corrected some of the mocks that require `monitorEvent: 'warning',` like the warning filter sets.

I also added a test that works without the fix.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63349615

fbshipit-source-id: 4f2a5a8800c8fe1a10e3613d3c2d0ed02fca773e

* Fix errors with component stacks reported as warnings (#46637)

Summary:
Ok so this is a doozy.

## Overview
There was a report that some console.error calls were being shown as warnings in LogBox but as console.error in the console. The only time we should downlevel an error to a warning is if the custom warning filter says so (which is used for some noisy legacy warning filter warnings internally).

However, in when I switched from using the `Warning: ` prefix, to using the presence of component stacks, I subtly missed the default warning filter case.

In the internal warning filter, the `monitorEvent` is always set to something other than `unknown` and if it's set to `warning_unhandled` then `suppressDialog_LEGACY` is always false.

However, the default values for the warning filter are that `monitorEvent = 'unknown'` and `suppressDialog_LEGACY = true`. In this case, we would downlevel the error to a warning.

## What's the fix?
Change the default settings for the warning filter.

## What's the root cause?

Bad configuration combinations in a fragile system that needs cleaned up, and really really bad testing practices with excessive mocking and snapshot testing (I can say that, I wrote the tests)

## How could it have been caught?
It was, but I turned off the integration tests while landing the component stack changes because of mismatches between flags internally and in OSS, and never turned them back on.

Changelog: [General] [Fixed] - Fix logbox reporting React errors as Warnings

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

Reviewed By: huntie

Differential Revision: D63349613

Pulled By: rickhanlonii

fbshipit-source-id: 32e3fa4e2f2077114a6e9f4feac73673973ab50c

* [LOCAL] using older version of React Dev Tools

- Older version has old URL, updated tests
- Comments on test don't match what's being tested.  Updated.

---------

Co-authored-by: Rick Hanlon <rickhanlonii@meta.com>
2024-10-31 10:24:52 +00:00
Riccardo CipolleschiandGitHub dac6d508af [RN][JS] Fix setUpErrorHandling to show early JS errors (#47287) 2024-10-31 10:24:33 +00:00
Tommy NguyenandGitHub 0def73d1a6 fix: fix semver not being found in pnpm setups (#47310) 2024-10-31 10:24:21 +00:00
Blake Friedman 4fc2c8fd1f Update Podfile.lock
Changelog: [Internal]
2024-10-29 15:21:39 +00:00
React Native Bot b048659ceb Release 0.76.1
#publish-packages-to-npm&latest
v0.76.1
2024-10-29 10:55:33 +00:00
Blake Friedman 201b517de0 [CI]: verify template is published method
This step called an old reference, this function identifier was updated.

Changelog: [Internal]
2024-10-28 14:35:29 +00:00
Robert PasińskiandBlake Friedman 980f4b42ca fix: AppRegistry not callable from Native in bridgeless (#46480)
Summary:
AppRegistry was not treated as a Callable Module in bridgeless mode. This is breaking headless tasks on Android.

Fixes:

 - https://github.com/facebook/react-native/issues/46050

## Changelog:

[ANDROID] [FIXED] - Made AppRegistry callable from Native code in Bridgeless (fixes headless tasks)

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

Test Plan: Used repro from linked issue

Reviewed By: javache

Differential Revision: D62637486

Pulled By: cortinico

fbshipit-source-id: 756527003ac6d712e76c02c188e280d15c010068
2024-10-28 14:23:31 +00:00
zhongwuzwandBlake Friedman 621d4ee298 Fixes regression of RCTWindowFrameDidChangeNotification not fired (#47236)
Summary:
Fixes https://github.com/facebook/react-native/issues/47234. regression from https://github.com/facebook/react-native/commit/391680fe844aad887e497912378c699aed13464b#diff-b7fda5d350ac535115fa683faa7317b43aa11f3448f95266ef9ff051c3753a6fL63

bypass-github-export-checks

## Changelog:

[IOS] [FIXED] - Fixes regression of RCTWindowFrameDidChangeNotification not fired

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

Test Plan: Demo in https://github.com/facebook/react-native/issues/47234.

Reviewed By: blakef

Differential Revision: D65058105

Pulled By: cipolleschi

fbshipit-source-id: 0e286182ed93f289cb853710e2e00801ef2d4f73
2024-10-28 14:20:09 +00:00
Riccardo CipolleschiandBlake Friedman e8776240b4 Pin Xcodeproj to < 1.26.0 (#47237)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47237

The Xcodeproj gem has been released yesterday to version 1.26.0 and it broke the CI pipeline of react native.

This should fix the issue

## Changelog
[Internal] - Pin Xcodeproj gem to 1.26.0

Reviewed By: blakef

Differential Revision: D65057797

fbshipit-source-id: f4035a1d3c75dd4140eb1646ab2aa0ccb08fb16b
2024-10-28 14:20:04 +00:00
Joe VilchesandBlake Friedman defc0c8c21 Fix animating background colors in View (#47101)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47101

See https://github.com/facebook/react-native/issues/47011

borders do not have this problem because they call `removeAllAnimations` on the layer after changing it, which is what I am doing here

Changelog: [iOS] [fixed] - Fixed bug where background colors would sometimes animate when changing on Views

Reviewed By: cipolleschi

Differential Revision: D64493968

fbshipit-source-id: cf81549f21b124b67c6e7647c6ae827bfe80a9cf
2024-10-28 14:19:54 +00:00
Sunny LuoandBlake Friedman e56bd89eff Add jsBundleFile to DefaultReactNativeHost.kt (#47188)
Summary:
The JsBundleFilePath has been ignored when converting DefaultReactNativeHost to ReactHost

Changelog:
[Internal] [Changed] - Add jsBundleFile to DefaultReactNativeHost.kt

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

Reviewed By: javache

Differential Revision: D64914149

Pulled By: cortinico

fbshipit-source-id: d437ca81df5a170e0c5f01a22ccda83f43a09dd2
2024-10-28 14:19:49 +00:00
Riccardo CipolleschiandBlake Friedman 807500a63e Exclude generation of app-defined components from RCTThirdPartyFabricComponentsProvider (#47176)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47176

While writing the guide for the New Architecture, we realized that we need to exclude the generation of the Cls function in the RCTThirdPartyFabricComponentsProvider for components defined in the app.

This is needed because a component that is defined in the app will have those function defined in the app project. However, the RCTThirdPartyFabricComponentsProvider is generated in Fabric, inside the Pods project.

The pod project needs to build in isolation from the app and cocoapods then link the app to the pods project. But the compilation of the pods project fails if one of the symbol needed by the pods lives in the app.

By disabling the generation of that function in th RCTThirdPartyFabricComponentsProvider, we can successfully build the app.

The downside is that the user needs to register the component manually, but this is not an issue because if they are writing a component in the app space, they have all the information tomanually register it in the AppDelegate

## Changelog
[iOS][Fixed] - Do not generate the ComponentCls function in the RCTThirdPartyFabricComponentsProvider for components deined in the app.

Reviewed By: cortinico, blakef

Differential Revision: D64739896

fbshipit-source-id: 0eca818ea0198532a611377d14a3ff4c95cb5fe3
2024-10-28 14:19:41 +00:00
Blake FriedmanandBlake Friedman bea4535246 Let .xcode.env.local NODE_BINARY handle path spaces
Summary:
For users who may have node installed in a path with a space, this requires escaping.  For example:

```
NODE_BINARY=/Users/blakef/Library/Application Support/fnm/node-versions/v20.12.0/installation/bin/node
```

Needs to be:

```
NODE_BINARY=/Users/blakef/Library/Application\ Support/fnm/node-versions/v20.12.0/installation/bin/node
```

# Changelog
[iOS][Fixed] Generated NODE_BINARY in .xcode.env.local now supports paths with a space

Reviewed By: cipolleschi

Differential Revision: D64080118

fbshipit-source-id: 1045473e4fd284fc570fa538984618630be1af6d
2024-10-28 14:19:34 +00:00
Blake Friedman 699a94d938 Update Podfile.lock
Changelog: [Internal]
2024-10-23 13:58:04 -07:00
React Native Bot 2e10ba945f Release 0.76.0
#publish-packages-to-npm&latest
v0.76.0
2024-10-23 16:09:59 +00:00
Riccardo CipolleschiandGitHub 007a8e12b8 [LOCAL] Fix template publishing (#47116) 2024-10-18 11:13:11 +01:00
Riccardo Cipolleschi 1be8c51173 [LOCAL] Bump Podfile.lock 2024-10-17 19:06:26 +01:00