Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38222
Changelog: [Android] [Fixed] - W3CPointerEvents: include screen coordinates in pointer events
The [spec](https://www.w3.org/TR/uievents/#idl-mouseevent) says there should be properties on mouse events (and hence pointer events) indicating the screen coordinates of the event (i.e. coords relative to screen of the device).
This change adds those properties.
Reviewed By: javache
Differential Revision: D47162962
fbshipit-source-id: 5bb9780882459b3550bbac792b7d7cf9f5c10860
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38201
Changelog: [Android] [Internal] - W3CPointerEvents: fix unintentional shallow copy of coordinates
When normalizing pointer event state, we previously only made a shallow copy and thus unintentionally modified the coordinate values in the original event state. This change fixes the issue by creating new coordinate arrays for the normalized event state instead of reusing the existing ones.
Reviewed By: javache
Differential Revision: D47230953
fbshipit-source-id: b29118c1ec32cd80fc0f05b2a55f283ef060f244
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38197
Changelog: [Android] [Fixed] - W3CPointerEvents: include modifier key properties in Android pointer events
The [spec](https://www.w3.org/TR/uievents/#idl-mouseevent) says there should be properties on mouse events (and hence pointer events) indicating whether ctrl, alt, shift, and/or meta are pressed during the event.
This change adds those properties.
Reviewed By: javache
Differential Revision: D47162963
fbshipit-source-id: fa76795217c08ef410fbc5467e9547074b47f3f7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38195
`onResponderGrant`'s return value drives the `blockNativeResponder` value for the `setIsJSResponder` native callback. On Android this is used to call `requestDisallowInterceptTouchEvent`, which can be used to prevent a scrollview from activating while another responder is active.
Changelog: [Improved] Exposed ability to block native responder in Pressability. Pressables using `cancelable={false}` will now prevent scrolling and other native gestures from activating.
Reviewed By: yungsters
Differential Revision: D47225928
fbshipit-source-id: 27f1c677436da3add301ecdcda6b018b9038829e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38217
Marks more filename patterns as "internal call sites" which has the effect of collapsing them by default in LogBox (and skipping them for the purpose of providing a code frame).
Changelog: [General][Fixed] Hide Babel helpers and other core files from LogBox stack traces by default
Reviewed By: cortinico, huntie
Differential Revision: D47230876
fbshipit-source-id: fe2d59d975c61cbdfd7b8da42288e284f3ab0739
Summary:
For the contentType Parameter of the method slice in Class Blob which was fixed for
https://github.com/facebook/react-native/pull/38078
the typescript declaration is missing.
## Changelog:
[GENERAL] [ADDED] - Added contentType parameter to Blob declaration
<!-- 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/38163
Test Plan: I ran yarn run test-typescript and check with Webstorm and VSCode.
Reviewed By: rshest
Differential Revision: D47228992
Pulled By: javache
fbshipit-source-id: fd767bb47c5e64657bfafba4c84d1d8671857109
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
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
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
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
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38202
## Context
Native modules can synthesize these bridge/bridgeless-agnostic abstractions:
- viewRegistry_DEPRECATED
- bundleManager
- callableJSModules
- moduleRegistry
## The Problem
The TurboModule interop layer wasn't attaching these abstractions to legacy modules.
## The Issue
In Bridgeless mode, the React instance attaches these abstractions to **all** modules, by implementing TurboModuleManagerDelegate.
But, the TurboModuleManager creates legacy modules without calling into the TurboModuleManagerDelegate. So, legacy modules never had these abstractions attached.
## The Fix
Move the attachment logic to within TurboModuleManager.
Changelog: [Internal]
Reviewed By: dmytrorykun
Differential Revision: D47074304
fbshipit-source-id: 87408106c00db8011740068ac0bd7dacd6b5ff81
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38203
The TurboModule system should just assume that RCTTurboModuleEnabled() is true.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D47074303
fbshipit-source-id: 7b360ff10966d4b20206231f4200f3f474ddff8f
Summary:
Adding paragraphStyle.maximumLineHeight to a iOS UITextField displays the text under the UITextField ([ios-screenshot-1][1], [ios-screenshot-2][2], [ios-screenshot-3][3]). The issue reproduces on Storyboard App (iOS) using UITextField and paragraphStyle.maximumLineHeight. It is not caused by react-native.
[1]: https://user-images.githubusercontent.com/24992535/238834159-566f7eef-ea2d-4fd4-a519-099b0a12046c.png "ios-screenshot-1"
[2]: https://user-images.githubusercontent.com/24992535/238834184-feb454a9-6504-4832-aec8-989f1d027861.png "ios-screenshot-2"
[3]: https://user-images.githubusercontent.com/24992535/238834283-cf572f94-a641-4790-92bf-bbe43afb1443.png "ios-screenshot-3"
The issue is caused by a private class _UITextLayoutFragmentView (a CALayer children of UITextField), which assumes the wrong position when setting the lineHeight. _UITextLayoutFragmentView frame's y coordinates are set to 30, instead of 0 ([react-native-screenshot-1][4], [react-native-screenshot-2][5])
- The _UITextLayoutFragmentView layer does not correctly position
- The issue is caused by adding paragraphStyle.maximumLineHeight to UITextField.attributedText
- The parent UITextField bounds do not correctly position child _UITextLayoutFragmentView.
The issue causes the below text Sdfsd to display under the TextInput.
[4]: https://github.com/Expensify/App/assets/24992535/06726b45-7e35-4003-9fcc-50c8d0dff0f6
[5]: https://github.com/Expensify/App/assets/24992535/d9745d29-8863-4170-bcc3-e78fa7e550d2
I was able to fix the issue and correctly align the private layout view _UITextLayoutFragmentView using the public API RCTUITextField textRectForBound, which allows modifying the UITextField frame and inset.
The solution consists in the following steps, applied only to UITextField with lineHeight prop:
1) set _UITextLayoutFragmentView to vertically align to the top. Required to correctly align _UITextLayoutFragmentView.
2) apply custom bounds with RCTUITextField textRectForBound to align _UITextLayoutFragmentView with the correct y coordinates and height
2) Adjust text baseline to be center aligned
fixes https://github.com/facebook/react-native/issues/28012
## Changelog:
[IOS] [FIXED] - Fix TextInput vertical alignment issue when using lineHeight prop on iOS (Paper - old arch)
Pull Request resolved: https://github.com/facebook/react-native/pull/37465
Test Plan: Extensive test included in the PR comments https://github.com/facebook/react-native/pull/37465#issuecomment-1551459879
Reviewed By: NickGerleman
Differential Revision: D46086661
Pulled By: sammy-SC
fbshipit-source-id: faece0940b153f3525ddcfae9417e943c957a5bf
Summary:
In Webstorm or VSCode when using Typescript the declaration of the class "File" is missing. So both IDEs show "File" as error. With this change it fixes the issue https://github.com/facebook/react-native/issues/38061 .
## Changelog:
[GENERAL] [FIXED] Fixed missing File declaration in Typescript global.d.ts
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
Pull Request resolved: https://github.com/facebook/react-native/pull/38165
Test Plan:
I ran
`yarn run test-typescript`
with no error
After that i initialized a new react-native project and installed the react-native library with my local changes of global.d.ts. Webstorm and VSCode now find the declaration of "File" and don't show "File" as error and suggest the right parameters.
Reviewed By: rshest
Differential Revision: D47209461
Pulled By: cortinico
fbshipit-source-id: 0884dfe786ea3a5070aa0a487a8e74463c8f1a0f
Summary:
Adds changelog for new patch.
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - add changelog entry for 0.71.12 and 0.70.11
Pull Request resolved: https://github.com/facebook/react-native/pull/38182
Test Plan: N/A
Reviewed By: GijsWeterings
Differential Revision: D47210080
Pulled By: cipolleschi
fbshipit-source-id: d0df8184a0a6f7848d2bf08102329b73bcb67846
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37688
This moves the `ReactNativeFlipper` classes used to configure Flipper on Android from the template to
a separate Gradle artifact that will be published under the coordinates:
```
com.facebook.react:flipper-integration:0.73.x
```
This reduces the footprint of Flipper on the app template and makes easier for user on 0.73 to migrate
to Kotlin (as they will now have to migrate only 2 files rather than 4).
Changelog:
[Android] [Changed] - Move Flipper integration to a separate Gradle module inside `ReactAndroid`
Reviewed By: huntie
Differential Revision: D46441588
fbshipit-source-id: e197f29b7386b52091b8d38ed09bbd8f74a997df
Summary:
This PR fixed the `id` prop to being correctly mapped to `nativeID` on the following components: `TouchableBounce`, `TouchableHighlight`, ` TouchableNativeFeedback`, and `TouchableOpacity`.
Closes https://github.com/facebook/react-native/issues/38117
Follow up of https://github.com/facebook/react-native/pull/34522
## Changelog:
[GENERAL] [FIXED] - Fix `id` prop not working on `TouchableBounce`, `TouchableHighlight`, ` TouchableNativeFeedback`, and `TouchableOpacity`
Pull Request resolved: https://github.com/facebook/react-native/pull/38169
Test Plan: Ensure that the `id` prop android tests pass on CircleCI
Reviewed By: jacdebug
Differential Revision: D47209319
Pulled By: cortinico
fbshipit-source-id: 50cdf0f1113e067aa46d55e4faaff6818509546e
Summary:
- if an existing iOS project specifies `EXCLUDED_ARCHS`, these settings are overwritten by the `react_native_post_install` step as part of the Cocoapods install
- closes https://github.com/facebook/react-native/issues/35544
### Existing Behaviour
- one of the functions called as part of the `react_native_post_install` step is `exclude_i386_architecture_while_using_hermes`
- see [/packages/react-native/scripts/cocoapods/utils.rb](https://github.com/facebook/react-native/blob/v0.72.1/packages/react-native/scripts/cocoapods/utils.rb#L56-L69)
```
def self.exclude_i386_architecture_while_using_hermes(installer)
projects = self.extract_projects(installer)
# Hermes does not support `i386` architecture
excluded_archs_default = self.has_pod(installer, 'hermes-engine') ? "i386" : ""
projects.each do |project|
project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = excluded_archs_default
end
project.save()
end
end
```
🐛 **However** 🐛
- this function is currently called regardless of whether or not you are **actually** using Hermes
- this means existing projects that have `EXCLUDED_ARCHS` set, the existing value will be changed either to `"i386"` or a blank string
### Changed Behaviour
- moved the function call inside an `if ReactNativePodsUtils.has_pod(installer, "React-hermes")` block
- `EXCLUDED_ARCHS` should only be modified if needed now
## 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] Only modify EXCLUDED_ARCHS when needed for Hermes
Pull Request resolved: https://github.com/facebook/react-native/pull/38132
Reviewed By: cortinico
Differential Revision: D47149618
Pulled By: cipolleschi
fbshipit-source-id: cffc2a0d4bc35fa4e933d3f4df6ee85e2f5c4486
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38159
Accessing `RuntimeEnvironment.application` is deprecated and we should instead use `RuntimeEnvironment.getApplication()`
Changelog:
[Internal] [Changed] - Do not directly access RuntimeEnvironment.application in tests
Reviewed By: rshest
Differential Revision: D47186902
fbshipit-source-id: dc28930570e2991da0ad91311f0402fd73af8214
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38101
This adds a few examples of using `MutationObserver` in React Native to RNTester.
`MutationObserver` isn't yet enabled so these shouldn't be accessible normally for the time being.
Changelog: [internal]
Reviewed By: NickGerleman
Differential Revision: D46149087
fbshipit-source-id: 8374b5915b8474a17a2f2e3277a9f409f6ab8380
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38100
This creates an experimental subset of MutationObserver. This will not be available yet and is only compatible with the new React Native architecture. This shouldn't show up in the changelog until we're ready to enable this in some form.
Changelog: [Internal]
## Context
This implements a subset of the `MutationObserver` API (as defined on the Web) for React Native.
This subset allows observing nodes added or removed from the UI tree (at any depth) without modifications in user code. This is not possible at the moment and it's required by some performance logging APIs that rely on observability for tracking.
**This is not intended for general use at the moment**. We will continue experimenting with this API and might change important details about how it works.
## Implementation details
This API is implemented as a native module that registers a commit hook in Fabric. Whenever there's a commit in React Native, we check for nodes added or removed from the shadow tree (compared with the previous committed version).
**This implementation is completely cross-platform.**
This API uses a centralized entity in JS and native to handle registration of observers and dispatch of notifications. The dispatch the notifications for all observers in the same callback so we can easily change the sequencing of events easily (for example, we can change this to use microtasks when they're available in RN).
An important aspect to highlight about this is that we call into JavaScript when executing the commit hooks. **We assume that commit hooks that trigger mutations will always happen in the JS thread**, so it's safe to do so. This was necessary because React nullifies all fields in fiber when they're unmounted, and we're reporting nodes being deleted. If we wait too long to get a reference to the public instances, they become unavailable and this API doesn't work correctly. To avoid this we eagerly get references to these public instances right when mutations are being applied, so it's safe.
## Known limitations
* Only the `childList` and `subtree` options are supported.
* There is a feature flag in React Native to do commits in background threads to avoid having to do that work in JS (including layout). This implementation is NOT compatible with that and we're currently working on removing the background executor permanently.
* Notifications from `MutationObserver` are dispatched as regular JavaScript tasks, not as microtasks, and they don't block rendering/mount/paint. Some consequences of that are:
* UI changes done in MutationObserver callbacks are not flushed atomically with the changes being observed. This is caused by the lack of microtasks and because Fabric doesn't wait for them to mount commits in the host platform.
* MutationObserver callbacks cannot reliably set up intersection observers to get a notification for the first paint, as it could have potentially happened already (similar to the previous point).
We are working on infrastructure changes (support for microtasks, blocking paint on microtasks, etc.) to overcome this limitations.
----
Reviewed By: sammy-SC
Differential Revision: D46149086
fbshipit-source-id: be7ba4acd0886d1661a6500d61d2122f34b98b5a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38099
A couple of small cleanups after the bulk of the work for `IntersectionObserver` was already merged.
Changelog: [internal]
Reviewed By: NickGerleman
Differential Revision: D47056943
fbshipit-source-id: 2a6f9062d91da458f8b980f3abcdc9a4ac86389b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38156
As we migrated several files from Java to Kotlin, our build log got really noisy with several compilation warnings.
That's happing as the Kotlin compiler is stricter than the Java one.
Here I've fixed most of them.
Changelog:
[Internal] [Changed] - Fix multiple warnings post Kotlin migration
Reviewed By: rshest
Differential Revision: D47185820
fbshipit-source-id: f49c90b4a6db9892979ea95b404cf427805c6503
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37978
Tweaks `react-native.config.js` files to remove duplication. `rn-tester` now references framework-included config from `react-native` (ahead of making config additions to this entry point).
As far as I can tell (from historic diff context), the presence of `packages/rn-tester/react-native.config.js` is a special case, due to the CLI's config discovery algorithm, and this file needs to remain a complete config.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D46859698
fbshipit-source-id: 5d31c6ffe43a364f1f2e7d456a6bc15f900be336
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38146
Now that `metro-react-native-babel-transformer` may be loaded from source without transformation, we can remove this workaround / potential footgun.
Jest uses Babel imperatively and doesn't rely on registration (require hooks), so registering within the preprocessor potentially conflicts and has caused problems before. This just tidies up some complexity we don't need.
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D47162728
fbshipit-source-id: 06215f9bb7b8e71bcca0429d0bae9f20a22f45a8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38145
Add Babel type definitions ahead of moving `metro-react-native-babel-transformer` under `react-natve`.
These are mostly duplicated from https://github.com/facebook/metro, adapted for RN's naming conventions and lint rules.
Changelog:
[Internal]
Reviewed By: christophpurrer
Differential Revision: D47154206
fbshipit-source-id: a44703f6926507732f2f1c65a17e5d4ac590c724