27152 Commits

Author SHA1 Message Date
Distiller b95c87daa0 [0.72.2] Bump version numbers v0.72.2 2023-07-11 10:37:43 +00:00
Lorenzo Sciandra 63f78ea8de [LOCAL] remove stub types from dependencies 2023-07-10 14:24:51 +01:00
Lorenzo Sciandra 839091b33f Revert "[LOCAL] fix the metro-config version or it will pick the wrong one on CI"
This reverts commit 73ca044871.
2023-07-10 14:00:04 +01:00
Lorenzo Sciandra 73ca044871 [LOCAL] fix the metro-config version or it will pick the wrong one on CI 2023-07-10 13:55:27 +01:00
Lorenzo Sciandra f37386176c bumped packages versions
#publish-packages-to-npm
2023-07-10 13:31:11 +01:00
Lorenzo Sciandra ba5fa9c394 [LOCAL] bump CLI to 11.3.5 and Metro do 0.76.7 2023-07-10 13:30:38 +01:00
Riccardo Cipolleschi 978185077d Restore envinfo for test_windows (#38062)
Summary:
We had to disable the envinfo command on test_windows to get the CI back to green.

The reason why it started failing is because they released 7.9.0 which does not seem to have the executable on Windows, so `npx` fails to find what to run.

This fix restore the command in a way that it should display the envinfo using an older version of the package. I also added a task to come back to this periodically.

## Changelog:

[Internal] - Restore envinfo on windows

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

Test Plan: - CircleCI: test_windows stays green

Reviewed By: cortinico

Differential Revision: D47016995

Pulled By: cipolleschi

fbshipit-source-id: 368367caed7ea49d7419475580a39f9406c54757

# Conflicts:
#	.circleci/config.yml
2023-07-10 11:49:23 +01:00
Lorenzo Sciandra 21daa6e790 bumped packages versions
#publish-packages-to-npm
2023-07-10 11:46:37 +01:00
Riccardo Cipolleschi 470449722f Update when view are added to the ViewRegistry (#38223)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38223

Before this change, the InteropLayer was adding the view to the registry right before invoking a command and right after the command was invoked. This model was too strict as some view commands may have async behaviors that make the lookup in the registry fail.

After this change, we are going to register the view when it's created and we are going to remove it when the view is deallocated.

## Changelog:
[iOS][Changed] - Update logic to add and remove views in the view registry for the interop layer.

Reviewed By: sammy-SC

Differential Revision: D47262664

fbshipit-source-id: 503f4e29e03bfc7ad861c1502129822b383ffcc0
2023-07-10 11:44:18 +01:00
Kudo Chien 1683b1250f add InitializeCore in getModulesRunBeforeMainModule (#38207)
Summary:
the `IntializeCore` is critical to react-native for setup polyfills. without this, we would have some erros like undefined `global.performance`. since the effort is now proposing `react-native/metro-config` as universal metro-config, it is better to have the `IntializeCore` in it.

we ran into issues when using expo-cli in bare react-native projects. it happens when using [the default metro config](https://github.com/facebook/react-native/blob/5f84d7338f42fe9b1d5bf2a9b1c8321b59551f15/packages/react-native/template/metro.config.js) and starting metro server without the react-native-community-cli.

### Why the issue does not happen on `yarn react-native start`?

when using `yarn react-native start`, the react-native-community-cli will merge its internal metro-config with the `InitializeCore` ([https://github.com/facebook/react-native/issues/1](https://github.com/react-native-community/cli/blob/5d8a8478cd104adf4a4dd34c09c2e256325ae61d/packages/cli-plugin-metro/src/commands/start/runServer.ts#L56), [https://github.com/facebook/react-native/issues/2](https://github.com/react-native-community/cli/blob/e8e7402512da8c3fbbc58a195284ef0008c7491f/packages/cli-plugin-metro/src/tools/loadMetroConfig.ts#L51-L61)). that's why the issue doesn't happen on react-native-community-cli.

## Changelog:

[GENERAL][FIXED] - `global.performance` in undefined when starting metro from Expo CLI

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

Test Plan:
```sh
$ npx react-native init RN072 --version 0.72
$ cd RN072
$ yarn add expo
$ npx expo run:ios
# then it hits the exception because the global.performance is undefined.
```

Reviewed By: rshest

Differential Revision: D47257439

Pulled By: huntie

fbshipit-source-id: ae294e684047e503d674f0c72563b56d1803ba36
2023-07-10 11:44:10 +01:00
fergusean e163a131f1 fix: repairs $EXTRA_COMPILER_ARGS error with multiple args (#38147)
Summary:
Fixes a regression added [on merge of https://github.com/facebook/react-native/issues/37531](https://github.com/facebook/react-native/commit/260bcf7f1bf78022872eb2f40f33fb552a414809#diff-16a358d6a9dea8469bfdb899d0990df1c32b8c3b1149c86685bec81f50bd24beR179) (though oddly I don't see it in [https://github.com/facebook/react-native/issues/37531's diff](https://github.com/facebook/react-native/pull/37531/files#diff-16a358d6a9dea8469bfdb899d0990df1c32b8c3b1149c86685bec81f50bd24beR179), so perhaps added during conflict resolution?) where multiple arguments in `$EXTRA_COMPILER_ARGS` are now incorrectly wrapped in quotes, including RN's own sourcemap support:

```
runner@SeansMacBookGo sampleapp % /Users/runner/builds/y_x6gsp4/0/sampleapp/ios/Pods/hermes-engine/destroot/bin/hermesc -emit-binary -max-diagnostic-width=80 '-O -output-source-map' -out /Users/runner/builds/y_x6gsp4/0/sampleapp/ios/build/derived-data/Build/Intermediates.noindex/ArchiveIntermediates/sampleapp/BuildProductsPath/Release-iphoneos/sampleapp.app/main.jsbundle /Users/runner/builds/y_x6gsp4/0/sampleapp/ios/build/derived-data/Build/Intermediates.noindex/ArchiveIntermediates/sampleapp/BuildProductsPath/Release-iphoneos/main.jsbundle
hermesc: Unknown command line argument '-O -output-source-map'.  Try: '/Users/runner/builds/y_x6gsp4/0/sampleapp/ios/Pods/hermes-engine/destroot/bin/hermesc -help'
hermesc: Did you mean '-output-source-map'?
```

## 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] - Fix build error when there are multiple EXTRA_COMPILER_ARGS

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

Test Plan: Removing the quotes and running the command results a successful run of `hermesc` (exit code 0 and the expected files produced).

Reviewed By: rshest

Differential Revision: D47254412

Pulled By: cipolleschi

fbshipit-source-id: 96b71bb05c7a6939088816e76a9a2d02e89ed768
2023-07-10 11:44:03 +01:00
Nicola Corti ee8d5e0259 Compile hermes-engine with -DHERMES_ENABLE_DEBUGGER=False on Release (#38212)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38212

This mirrors the same logic that the Hermes team has on facebook/hermes.
Practically, we want to pass the CMake config flag `HERMES_ENABLE_DEBUGGER=False` only for Release
so that their CMake build is configured correctly.

Their build always enables the Debugger and allows us to selectively turn it off only for release
builds.

More context: https://github.com/facebook/hermes/commit/eabf5fcd25

Changelog:
[Internal] [Changed] - Compile hermes-engine with -DHERMES_ENABLE_DEBUGGER=False on Release

Reviewed By: cipolleschi

Differential Revision: D47252735

fbshipit-source-id: 9b5cd801dea3b540a3f80b0d0975e05984f1d9b9
2023-07-10 11:43:54 +01:00
evelant fe2964a84c Fix build failure on iOS with pnpm and use_frameworks! (#38158)
Summary:
Fix build failure on iOS with pnpm and use_frameworks! due to cocoapods copying symlinked headers to wrong paths

When using pnpm all packages are symlinked to node_modules/.pnpm to prevent phantom dependency resolution. This causes react-native iOS build to fail because Cocoapods copies headers to incorrect destinations when they're behind symlinks. The fix resolves absolute paths to the header_mappings_dir at pod install time. With absolute paths cocoapods copies the headers correctly.

This commit also adds a few missing header search paths in use_frameworks! mode.

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

## Changelog:

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

Pick one each for the category and type tags:

[IOS] [FIXED] - Build failure with pnpm and use_frameworks! due to incorrect header paths

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

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

Test Plan:
1. `pnpm pnpx react-native@latest init AwesomeProject`
2. `cd AwesomeProject`
3. `rm -rf node_modules yarn.lock`
4. `mkdir patches`
5. copy [react-native@0.72.1.patch](https://github.com/facebook/react-native/files/11937570/react-native%400.72.1.patch) to `patches/`
6. Add patch to package.json
```
"pnpm": {
    "patchedDependencies": {
        "react-native@0.72.1": "patches/react-native@0.72.1.patch"
    }
}
```
7. `pnpm install`
8. `cd ios`
9. `NO_FLIPPER=1 USE_FRAMEWORKS=static pod install`
10. `cd ..`
11. `pnpm react-native run-ios`

Hopefully an automated test of building with `pnpm` can be added to CI. I don't know how to make that happen, hopefully someone at facebook can do it.

Reviewed By: dmytrorykun

Differential Revision: D47211946

Pulled By: cipolleschi

fbshipit-source-id: 87640bd3f32f023c43291213b5291a7b990d7e1f
2023-07-10 11:43:46 +01:00
Matt Blagden 965169fe0c Enable debugging in debug build (#38205)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38205

Enable the preprocessor flag to allow debugging when in a debug build. This flag influences the Hermes headers included in the inspector, and causes them to include the debugging functionality.

Changelog:
    [General][Fixed] - Re-enabled debugging for debug builds

Reviewed By: lunaleaps, cortinico

Differential Revision: D47243235

fbshipit-source-id: 7982c69ab554335a9ad985394e4416ed69831137
2023-07-10 11:43:35 +01:00
Koichi Nagaoka 0759422053 Fix onChangeText not firing when clearing the value of TextInput with multiline=true on iOS (#37958)
Summary:
This fix fixes the TextInput issue in https://github.com/facebook/react-native/issues/37784 with onChangeText not working on iOS only.

## 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] - Fix onChangeText not firing when clearing the value of TextInput with multiline=true on iOS

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

Test Plan:
1. Run the repro code given in the issue (https://github.com/facebook/react-native/issues/37784).
2. Verified that onChangeText works after pressing the submit button.
3. Run the repro code from the issue (https://github.com/facebook/react-native/issues/36494) that caused this issue.
4. Verified that issue (https://github.com/facebook/react-native/issues/36494) is not reoccurring.

Reviewed By: rshest

Differential Revision: D47185775

Pulled By: dmytrorykun

fbshipit-source-id: 1a1a6534d6bf8b5bb8cf1090734dd894bab43f82
2023-07-10 11:43:27 +01:00
Samuel Susla 914db09a8e Disable nstextstorage_caching in OSS (#38129)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38129

changelog: [iOS] Disable NSTextStorage caching in OSS

A [bug was reported](https://github.com/facebook/react-native/issues/37944) for NSTextStorage caching. Even thought I fixed the bug in D47019250, I want to disable the feature in OSS until the fix is verified in Facebook app.
My plan is to pick this commit for 0.72.1 and reenable NSTextStorage caching once the fix is validated.

Reviewed By: NickGerleman

Differential Revision: D47127912

fbshipit-source-id: 97694e383eb751e89b776c0599969f2c411bac6f
2023-07-10 11:43:18 +01:00
louiszawadzki 7a4ae799b8 Fix pod install for swift libs using new arch (#38121)
Summary:
This fixes a bug that started with React Native 0.72.0 when using the new architecture and installing a native lib that has Swift code (in my case, `datadog/mobile-react-native`).

Running `pod install` errors with the following output (`DatadogSDKReactNative` is the pod containing the Swift code):

```
[...]
Analyzing dependencies
Downloading dependencies
Installing DatadogSDKReactNative 1.8.0-rc0
[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `DatadogSDKReactNative` depends upon `React-Fabric`, `React-graphics`, `React-utils`, and `React-debug`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
```

Indeed, this pods were added as dependencies in `packages/react-native/scripts/cocoapods/new_architecture.rb` but do not define modules contrary to the other pods in the list.

This PR is solving a problem that already occured in the past and was solved here: https://github.com/facebook/react-native/pull/33743
It's a new implementation for the PR initially opened here: https://github.com/facebook/react-native/pull/38039

## Changelog:
[IOS] [FIXED] - Fix pod install for libraries using Swift code when the new architecture is enabled

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

Test Plan:
1. Clone [this](https://github.com/louiszawadzki/react-native) repo
2. From `main`, add a Swift file to the `MyNativeView` native module in the RN tester app (see inspiration from [this commit](https://github.com/fortmarek/react-native/commit/26958fccf4b4ac90d0bf9bb3699f12760a6b2b58))
3. Try to run `RCT_NEW_ARCH_ENABLED=1 USE_HERMES=0 bundle exec pod install` inside the `packages/rn-tester`
4. Observe errors
5. Apply [the commit](https://github.com/facebook/react-native/commit/7b7c3ff530cae07daccc5b5ea6b72d239f913be0) from this PR
6. Both pod install and the subsequent build should succeed.
7. Revert the changes and repeat steps 2 to 6 with `RCT_NEW_ARCH_ENABLED=1 USE_HERMES=1 bundle exec pod install`

Reviewed By: cortinico

Differential Revision: D47127854

Pulled By: cipolleschi

fbshipit-source-id: bf7f65e0d126195a76a0fafbe2f3172f00d5adc1

# Conflicts:
#	packages/react-native/ReactCommon/react/renderer/debug/React-rendererdebug.podspec
2023-07-10 11:42:52 +01:00
Alex Hunt e2506760c0 Add global hook to assert that base Metro config is called (#38126)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38126

Towards https://github.com/react-native-community/cli/issues/1987. Will be paired with a CLI PR targeting React Native 0.72.1.

Changelog: None

Reviewed By: motiz88

Differential Revision: D47125080

fbshipit-source-id: b3b9d93ba747240f5168021ccb793ffe5d34251d
2023-07-10 11:40:10 +01:00
Adrian Hartanto 03b9b52990 Remove okhttp internal util usage (#37843)
Summary:
Remove okhttp internal `Util` usage so it can be compatible with [okhttp 5.0.0 alpha](https://square.github.io/okhttp/changelogs/changelog/#version-500-alpha7).

## Changelog:

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

[ANDROID] [CHANGED] - Remove okhttp3 internal util usage

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

Test Plan: None, the implementation is based on okhttp internal util

Reviewed By: NickGerleman

Differential Revision: D46764363

Pulled By: cortinico

fbshipit-source-id: e46770625f19057fa7374be15e92903d7966f880
2023-07-10 11:39:57 +01:00
Harry Yu a46a7cd1f6 Prevent crash in runAnimationStep on OnePlus and Oppo devices (#37487)
Summary:
We've been encountering a crash in `runAnimationStep` with "Calculated frame index should never be lower than 0" https://github.com/facebook/react-native/issues/35766 with OnePlus/Oppo devices as well, but don't have one on hand to test.

This just works around the issue: if the time is before the start time of an animation, we shouldn't do anything anyways, so we just log a message instead of throwing while in production. We still throw in debug mode though for easier debugging.

### Hypothesis of the root cause

Based on stacktrace in https://github.com/facebook/react-native/issues/35766 (which is the same one we see)

Normally, this should happen

1. Choreographer.java constructs a FrameDisplayEventReceiver
2. FrameDisplayEventReceiver.onVSync gets called, which sets the `mTimestampNanos`
3. FrameDisplayEventReceiver.run gets called, which then eventually calls our `doFrame` callback with `mTimestampNanos`. This then causes `FrameBasedAnimationDriver.runAnimationStep` to be called with the same timestamp

I suspect what's happening on OnePlus devices is that the `onVSync` call either doesn't happen or happens rarely enough that the `mTimestampNanos` when `run` is called is sometime in the past

### Fix

1. Add logging so we get the parameters to debug more if we end up getting this error
2. In production, just ignore past times instead of throwing an Error

## Changelog:

Pick one each for the category and type tags:

[ANDROID] [FIXED] - Prevent crash on OnePlus/Oppo devices in runAnimationStep

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

Test Plan: Ran our app using patched version and verified no issues showed up when using it

Reviewed By: cipolleschi

Differential Revision: D46102968

Pulled By: cortinico

fbshipit-source-id: bcb36a0c2aed0afdb8e7e68b141a3db4eb02695a
2023-07-10 11:39:28 +01:00
Luna d73b61c7c7 Do not create RuntimeExecutor on non-JSI executors (#38125) (#38142)
Co-authored-by: Pieter De Baets <pieterdb@meta.com>
resolved: https://github.com/facebook/react-native/pull/38125
2023-07-10 11:27:43 +01:00
Lorenzo Sciandra e22bd7f6a9 [LOCAL] update podlock 2023-07-05 14:26:25 +01:00
Distiller 73293f2c16 [0.72.1] Bump version numbers v0.72.1 2023-06-29 16:57:00 +00:00
Riccardo Cipolleschi 8ce471e2fa [LOCAL] Bump SocketRocket to 6.1.0 2023-06-29 15:52:06 +01:00
Lorenzo Sciandra a8cfeb92a4 [LOCAL] update podlock file for RNTester 2023-06-29 14:00:55 +01:00
Bernhard Owen Josephus 92d50d4f4c Resubmit D46501420 (#37790)
Summary:
Multiline text in Android shows some extra space. It's easily noticeable when you set the text `alignSelf` to `flex-start`. This is because we are using `layout.getLineWidth` which will include trailing whitespace.
<img width="300" alt="image" src="https://github.com/facebook/react-native/assets/50919443/8939092b-caef-4ad8-9b34-2ccef5d20968">

Based on Android doc, `getLineMax` exclude trailing whitespace.
<img width="625" alt="image" src="https://github.com/facebook/react-native/assets/50919443/0b32e842-5fab-4fc7-8fd9-299877b9c553">

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID] [FIXED] - Exclude trailing whitespace from newline character on measuring text line width

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

[ANDROID] [FIXED] - Exclude trailing whitespace from newline character on measuring text line width

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

Test Plan:
After applying the changes:
<img width="300" alt="image" src="https://github.com/facebook/react-native/assets/50919443/bfbf52b0-7e7d-4c89-8958-6af38d8bc1c7">

Code snippet:
```
<Text style={{backgroundColor: 'red', alignSelf: 'flex-start', color: 'white'}}>
    1{'\n'}
</Text>
```

Reviewed By: cortinico

Differential Revision: D46586516

Pulled By: NickGerleman

fbshipit-source-id: 3ea9c150ad92082f9b4d1da453ba0ef04b09ce51
2023-06-29 13:56:49 +01:00
Riccardo Cipolleschi 4ddfeb6181 Warn users when a component is registered in Rendere and in the interop (#38089)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38089

This change add a warning if a component is registered in both the New Renderer and in the Interop layer.

This can help users migrating their components once the library has been migrated.

[iOS][Added] - Add warning to help users migrate away from the interop layer.

Reviewed By: cortinico

Differential Revision: D47053556

fbshipit-source-id: cc2ba09db16aaa370947a77173b6ea6a0acfa519
2023-06-28 16:16:16 +01:00
Riccardo Cipolleschi f5372578ac Implement multiple manager lookup for the interop layer (#38093)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38093

In [this issue](https://github.com/facebook/react-native/issues/37905), the community detected a strict assumption in the interop layer for which, given a component `XXXView`, its ViewManager must be called `RCTXXXViewManager`.

That's not the case for some components, for example, `BVLinearGradient`, which View manager is `BVLinearGradientManager` and not `RCTBVLinearGradientManager`.

This diff adds a secondary lookup logic:
1. We look for the `RCTXXXViewManager`.
2. If not found, we look for `XXXViewManager`.

We will assess whether to generalize this logic once and for all or to expand other lookup cases on an example/failure basis as it's not a goal to have a 100% accurate interop layer. The Goal is to cover most use cases.

[iOS][Added] - Allow to lookup for ViewManager without the RCT prefix in the Interop Layer

Reviewed By: sammy-SC

Differential Revision: D47055969

fbshipit-source-id: 1d31f3f4bc6f1f543edbd157ce04ad9daf23dbc6
2023-06-28 16:06:34 +01:00
Lorenzo Sciandra 95db9f98f2 bumped packages versions
#publish-packages-to-npm
2023-06-28 15:35:42 +01:00
Lorenzo Sciandra da84901f78 [LOCAL] bump CLI to 11.3.3 2023-06-28 15:33:38 +01:00
Lorenzo Sciandra 10beefbbfa [LOCAL] reapply "Set kotlin.jvm.target.validation.mode=warning on user projects" by Nicola 2023-06-28 15:30:42 +01:00
Alex Hunt 78c1a7e322 Restore base config merge in metro-config (#38092)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38092

Reverts https://github.com/facebook/react-native/pull/36777.

This is motivated by reducing user friction when the widespread assumption is for `react-native/metro-config` to export a complete Metro config, as with Expo/rnx-kit, and like previously understood uses of `metro-config`. See https://github.com/facebook/metro/issues/1010#issuecomment-1609215165 for further notes.

Fixes:
- https://github.com/facebook/metro/issues/1010
- https://github.com/facebook/react-native/issues/38069
- https://github.com/kristerkari/react-native-svg-transformer/issues/276

Note that we do not intend for `react-native/metro-config` to directly export `assetExts` etc — these can be accessed on the `resolver` property from the full config object.

Changelog: [General][Changed] `react-native/metro-config` now includes all base config values from `metro-config`

Reviewed By: robhogan

Differential Revision: D47055973

fbshipit-source-id: 5ad23cc9700397110de5c0e81c7d76299761ef0a
2023-06-28 15:29:25 +01:00
Samuel Susla 69705a46b1 Add nullptr check to SharedFunction (#38075)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38075

changelog: [internal]

`SharedFunction<>` is created with nullptr for its internal `std::function`. If called after created with default constructor, it crashes app. It also does not have API to check if its internal function is not nullptr.

With image cancelation, there is a race between when native component calls `imageRequest.cancel()` and when cancelation function is set in `RCTImageManager`.
To fix this, this diff adds a nullptr check inside SharedFunction. So it is always safe to call.

Reviewed By: javache

Differential Revision: D47022957

fbshipit-source-id: 0a04a87cd1ffe6bf3ca2fded38f689f06cc92ca9
2023-06-28 15:29:17 +01:00
Tommy Nguyen ba46e5b2cd fix(virtualized-lists): react-test-renderer is not a runtime dependency (#37955)
Summary:
Installing `react-native` 0.72.x causes a warning about `react-test-renderer` because `react-native/virtualized-lists` has declared a peer dependency on it. As far as I know, it is not used for anything but tests.

```
➤ YN0002: │ react-native@npm:0.72.0-rc.6 [292eb] doesn't provide react-test-renderer (p5a2fb), requested by react-native/virtualized-lists
```

Note that while many package managers default to warnings in this case, there are still a number of users out there for which this is an error.

## Changelog:

[GENERAL] [FIXED] - `react-native/virtualized-lists` does not need `react-test-renderer` at runtime

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

Test Plan: n/a

Reviewed By: rshest

Differential Revision: D46871536

Pulled By: NickGerleman

fbshipit-source-id: 1e5e15608ab394bc43cd4e6ac727a74734874642
2023-06-28 15:29:10 +01:00
Pranav Yadav 4d8a6a225c Add README to RN Template App, added when npx react-native@latest init <AppName> (#37521)
Summary:
[skip-ci]
I noticed that; when a _new_ RN App is created using RN CLI there is ***NO*** *README* file added to the project.
Having a simple README file explaining what type of project it is, for example how other web projects do it, such as long lived `create-react-app`, now widely used `create-next-app`, etc.

Why not for React Native App then?

This PR; Adds README file to RN Template App , which should be added to the project when a new project is created using RN CLI.

### Website PR: https://github.com/facebook/react-native-website/pull/3732 🚀😇

bypass-github-export-checks

## Changelog:

[INTERNAL] [ADDED] - Add README to RN Template App 

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

Test Plan: - The README file should be included in the newly created RN App using RN CLI

Reviewed By: NickGerleman

Differential Revision: D46075719

Pulled By: cipolleschi

fbshipit-source-id: efcccc09d72c57a065b36de6e787594082000e15
2023-06-28 15:28:03 +01:00
Tommy Nguyen 0b96bdcf32 fix(ios): fix pod install --project-directory=ios failing (#37994) 2023-06-23 13:44:33 +02:00
Distiller 7a893e4110 [0.72.0] Bump version numbers v0.72.0 2023-06-21 14:15:09 +00:00
Riccardo Cipolleschi 386387762e [LOCAL] update podfile.lock 2023-06-13 18:01:31 -04:00
Distiller ec4771b79a [0.72.0-rc.6] Bump version numbers v0.72.0-rc.6 2023-06-13 19:39:32 +00:00
Lorenzo Sciandra a2df07ea2a [LOCAL] bump CLI to 11.3.2 2023-06-13 15:51:08 +01:00
Lorenzo Sciandra b2f273750b bumped packages versions
#publish-packages-to-npm
2023-06-13 15:50:05 +01:00
Gabriel Donadel 0817eaa301 Revert "fix: border width top/bottom not matching the border radius" (#37840)
Summary:
In an effort to fix https://github.com/facebook/react-native/issues/37753, this PR reverts the changes introduced by https://github.com/facebook/react-native/commit/cd6a91343ee24af83c7437b3f2449b41e97760e9 and https://github.com/facebook/react-native/commit/1d5103227851ab92de889d5e7e910393b5d8743a so border-radius width calculations work as expected

## Changelog:

[ANDROID] [FIXED] - Fix border-radius width calculations

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

Test Plan:
Test border colors along with border-radius through RNTester
<img width="538" alt="image" src="https://github.com/facebook/react-native/assets/11707729/4b148d4b-35dc-4737-be00-c5ff156b0865">

Reviewed By: dmytrorykun

Differential Revision: D46684071

Pulled By: cipolleschi

fbshipit-source-id: cf7a80d0d63009b457f03d690b632e332a9b4a02
2023-06-13 15:49:11 +01:00
Nicola Corti 0da7e06f3f Remove CallInvoker parameter from toJs method in Codegen (#37832)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37832

This parameter is currently unused and is causing Android builds to fail
as they compile with `-Wall`

This is a follow-up to https://github.com/facebook/react-native/pull/37454/ as that PR updated only the `fromJs` and not the `toJs` method as well.

Changelog:
[Internal] [Changed] - Remove CallInvoker parameter from toJs method in Codegen

Reviewed By: rshest

Differential Revision: D46647110

fbshipit-source-id: 1f3e22aca7a3df11ac02b5c4b89c9311b8b1798c
2023-06-13 15:49:04 +01:00
Gabriel Donadel 2d15f50912 Fix Android border clip check (#37828)
Summary:
Instead of requiring all  types of border color values to be present we should only take into consideration the left, top, right, bottom, and allEdges values and inject block values into  colorBottom and colorTop.

This PR only addresses the first issue described here (https://github.com/facebook/react-native/issues/37753#issuecomment-1587196793) by kelset

## Changelog:

[ANDROID] [FIXED] - Fix border clip check

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

Test Plan:
Test through rn-tester if border color is being applied

<img width="482" alt="image" src="https://github.com/facebook/react-native/assets/11707729/c8c8772c-da8d-4393-bc3f-5868eca5df15">

Reviewed By: lunaleaps

Differential Revision: D46643773

Pulled By: cipolleschi

fbshipit-source-id: efb1ea81bf2462c14767a2554880eb7c44989975
2023-06-13 15:48:58 +01:00
Gabriel Donadel 27600427a9 Fix loading NODE_BINARY inside Generate Legacy Components Interop (#37802)
Summary:
When trying to build an app using 0.72.0-RC.5 inside a project that uses `.xcode.env.local` the  `[CP-User] Generate Legacy Components Interop` Phase script fails to run due to a `Permission denied` error. That's because `.xcode.env.local` is not being loaded, resulting in `NODE_BINARY=" "` and then the `React-RCTAppDelegate` script tries to run `generate-legacy-interop-components.js` directly.

E.g

![image](https://github.com/facebook/react-native/assets/11707729/ce72d7d1-69ab-4477-a754-10cd52bb21a2)

In order to fix this we should run the `with-environment.sh` script instead of directly loading `.${PODS_ROOT}/../.xcode.env`

## Changelog:

[IOS] [FIXED] - Fix loading `NODE_BINARY` inside Generate Legacy Components Interop

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

Test Plan: Make sure you don't have a `.xcode.env` file and run locally a project that uses React-RCTAppDelegate

Reviewed By: cortinico

Differential Revision: D46596246

Pulled By: cipolleschi

fbshipit-source-id: 5616395f39b0fae7b2fa9e59bd72c70f39198b4d
2023-06-13 15:48:51 +01:00
Alexander Eggers 8ed2cfded5 Add support for building with Xcode 15 (#37758)
Summary:
Fixes https://github.com/facebook/react-native/issues/37748

This PR adds a patch which fixes a build issue in Xcode 15.

## Changelog:

[IOS] [ADDED] - Add support for building with Xcode 15

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

Reviewed By: cortinico

Differential Revision: D46524009

Pulled By: cipolleschi

fbshipit-source-id: 9f6c12e12a15c154467282a7b4a00e80e5cc0af2
2023-06-13 15:48:44 +01:00
Jakub Trzebiatowski 73f4a788f1 Fixed random styling for text nodes with many children (#36656)
Summary:
Attempting to fix the issue https://github.com/facebook/react-native/issues/33418

## 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 inconsistent styling for text nodes with many children

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

Test Plan:
No test plan yet. I'd like to ask for help with creating one.

##

Putting template aside, I'd like to ask for a review of the approach I'm suggesting.

React Native as-is (at least in some cases) [messes up the styles](https://github.com/facebook/react-native/issues/33418#issuecomment-1485305556) for text nodes with more than 85 children, just like that.

![image](https://user-images.githubusercontent.com/2590174/227981778-7ef6e7e1-00ee-4f67-bcf1-d452183ea33d.png)

All of this text should be blue.

The root cause is that code (on Android) assumes it can assign as many `Spannable` span priority values as we'd like, while in reality, it has to be packed in an 8-bit-long section of the flags mask. So 255 possible values. In the scenario I produced, React generates three spans per text node, and for 85 text nodes, it sums up to 255. For each span, a new priority value is assigned.

As I understand it, we don't need that many priority values. If I'm not mistaken, these priorities are crucial only for ensuring that nested styles have precedence over the outer ones. I'm proposing to calculate the priority value "vertically" (based on the node's depth in the tree) not "horizontally" (based on its position).

It would be awesome if some core engineer familiar with `ReactAndroid` shared their experience with this module, especially if there are any known cases when we _know_ that we'd like to create overlapping spans fighting over the same aspects of the style.

Reviewed By: cortinico

Differential Revision: D46094200

Pulled By: NickGerleman

fbshipit-source-id: aae195c71684fe50469a1ee1bd30625cbfc3622f
2023-06-13 15:48:36 +01:00
Janic Duplessis dfc64d5bcc Fix copy / paste menu and simplify controlled text selection on Android (#37424)
Summary:
Currently when using a TextInput with a controlled selection prop the Copy / Paste menu is constantly getting dismissed and is impossible to use. This is because Android dismisses it when certain method that affect the input text are called (https://cs.android.com/android/platform/superproject/+/refs/heads/master:frameworks/base/core/java/android/widget/Editor.java;l=1667;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176?q=Editor, https://cs.android.com/android/platform/superproject/+/refs/heads/master:frameworks/base/core/java/android/widget/TextView.java;l=6792;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176). The solution to fix this is to avoid calling those methods when only the selection changes.

I also noticed there are a lot of differences on how selection is handled in old vs new arch and a lot of the selection handling can actually be removed as it is partially the cause of this issue.

This implements 2 mitigations to avoid the issue:

- Unify selection handling via commands for old arch, like fabric. Selection is currently a prop in the native component, but it is completely ignored in fabric and selection is set using commands. I removed the selection prop from the native component on Android so now it is exclusively handled with commands like it is currently for fabric. This makes it so that when the selection prop changes the native component no longer re-renders which helps mitigate this issue. More specifically for the old arch we no longer handle the `selection` prop in `ReactTextInputShadowNode`, which used to invalidate the shadow node and cause the text to be replaced and the copy / paste menu to close.

- Only set placeholder if the text value changed. Calling `EditText.setHint` also causes the copy / paste menu to be dismissed. Fabric will call all props handlers when a single prop changed, so if the `selection` prop changed the `placeholder` prop handler would be called too. To fix this we can check that the value changed before calling `setHint`.

## Changelog:

[ANDROID] [FIXED] - Fix copy / paste menu and simplify controlled text selection on Android

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

Test Plan:
Tested on new and old arch in RNTester example.

Before:

https://github.com/facebook/react-native/assets/2677334/a915b62a-dd79-4adb-9d95-2317780431cf

After:

https://github.com/facebook/react-native/assets/2677334/0dd475ed-8981-410c-8908-f00998dcc425

Reviewed By: cortinico

Differential Revision: D45958425

Pulled By: NickGerleman

fbshipit-source-id: 7b90c1270274f6621303efa60b5398b1a49276ca

# Conflicts:
#	packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java
2023-06-13 15:48:22 +01:00
Lorenzo Sciandra bab5babc98 [LOCAL] bump hermes podlock 2023-06-06 10:13:53 +01:00
Distiller a98c7c6f54 [0.72.0-rc.5] Bump version numbers v0.72.0-rc.5 2023-06-01 09:35:34 +00:00