Summary:
Hey,
`adjustCellsAroundViewport` function was checking if `props.initialScrollIndex` is truthy and -1 was returning true. This caused bugs with rendering for tvOS: https://github.com/react-native-tvos/react-native-tvos/pull/485 There are warnings in the code about `initalScrollIndex` being smaller than 0 but this if statement would still allow that.
## Changelog:
[General] [Fixed] - Make sure initialScrollToIndex is bigger than 0 when adjusting cells
Pull Request resolved: https://github.com/facebook/react-native/pull/36844
Test Plan: Pass -1 as initialScrollToIndex. Check that this code is executed.
Reviewed By: cipolleschi
Differential Revision: D44856266
Pulled By: NickGerleman
fbshipit-source-id: 781a1c0efeae93f00766eede4a42559dcd066d7d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37195
Updates the Dev Menu header on Android.
- Small alignment related to D44872456.
- Add subheading label showing current JS executor description (matching iOS) (note: on Android this is unformatted (but informative), e.g. `JSIExecutor+HermesRuntime`).
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D45142924
fbshipit-source-id: 5c95fc85e6d3b6879287440f76165b02957283e5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37148
This should fix https://github.com/facebook/react-native/issue/36945, which is also causing annoyance when doing the releases
## Changelog:
[iOS][Changed] - Use contents of sdks/.hermesversion to let cocoapods recognize Hermes updates.
Reviewed By: cipolleschi
Differential Revision: D45394241
fbshipit-source-id: 972fbee8f954b90f7087bb232f922761c1639e06
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37152
Those files are unncessary and can be removed from RNTester.
* Proguard file is empty
* Signing config is unnecessary and we can use the debug one also for release.
Changelog:
[Internal] [Changed] - Remove unnecessary files in RN-Tester
Reviewed By: hoxyq
Differential Revision: D45399388
fbshipit-source-id: fd1c6cccaef668e688a699e31045bdc8103ea98e
Summary:
I accidentally turned off New Architecture on RN-Tester while shipping the Fabric Interop. This reverts it.
Changelog:
[Internal] [Changed] - Re-enable newArch on RN-Tester
Reviewed By: cipolleschi
Differential Revision: D45398914
fbshipit-source-id: 2c36f3d0440f147189de644821e1704c00353bac
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37139
This dependency is unnecessary. React Native already exposes a `api` dependency on
`androidx.swiperefreshlayout:swiperefreshlayout` so every consumer will also get it.
This is just another line in the template we can effectively remove.
Changelog:
[Android] [Changed] - Do not explicitely depend on androidx.swiperefreshlayout:swiperefreshlayout
Reviewed By: cipolleschi
Differential Revision: D45390819
fbshipit-source-id: cce34c6a09100d36ee5eb003bb30323f64f0bb9c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37059
This diff introduces InteropEventEmitter, a re-implementation of RCTEventEmitter that works with Fabric and allows to support events on the Fabric Interop for Android.
Thanks to this, users can keep on calling `getJSModule(RCTEventEmitter.class).receiveEvent(...)` in their legacy ViewManagers and they will be using the EventDispatcher
under the hood to dispatch events.
The logic is enabled only if the `unstable_useFabricInterop` flag is turned on. I've turned this on for the template setup and for RN Tester.
On top of this, this diff takes care also of event name "normalization".
On Fabric, all the events needs to be registered with a "top" prefix. With this diff, we'll be adding the "top" prefix at registration time, if the user hasn't added them.
This allows to use legacy ViewManagers on Fabric without having to ask users to change their event name.
Changelog:
[Android] [Added] - Add support for Events on the Fabric Interop Layer
Reviewed By: mdvacca
Differential Revision: D45144246
fbshipit-source-id: 63d4060153907c05977c976379b90574d1f69866
Summary:
Upgrades React Native to `deprecated-react-native-prop-types@4.1.0`, which includes many of the new prop types in React Native v0.72.
See: https://github.com/facebook/react-native-deprecated-modules/blob/main/deprecated-react-native-prop-types/CHANGELOG.md
Changelog:
[General][Changed] - Upgrade to deprecated-react-native-prop-types@4.1.0
Reviewed By: rickhanlonii
Differential Revision: D45155955
fbshipit-source-id: 36e715c2338b667755bd1e522b7d5a2611103779
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36981
We are (following a quick internal RFC) looking to standardise the term "[in-app] [Developer|Debug] menu" to "Dev Menu" in the React Native Debugging docs (and all docs references). (Indeed, the prevalent existing use in docs was already "Developer menu".) This PR aligns naming in the `RCTDevMenu` component on iOS.
See also https://github.com/facebook/react-native-website/pull/3692.
Changelog:
[iOS][Changed] - Rename "Debug Menu" title to "Dev Menu"
Reviewed By: christophpurrer
Differential Revision: D44872456
fbshipit-source-id: c222bb2c551a4f434a1dc0efbb8d4f75c785aa11
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36957
Fixes https://github.com/facebook/react-native/issues/36830
This bumps the version of tsconfig/react-native to inform TypeScript of more libraries provided by Hermes/React Native. See https://github.com/tsconfig/bases/commit/eee5f19ce8c6a9a8d8baed5ce42588b95262b1a8.
I did the search off of current Hermes/RN main branch, but I think the new config should be valid as far back as 0.71. It doesn't make sense to change the new app template for an old version though, so instead I think we should include this new version in 0.72.
Changelog:
[General][Changed] - Bump tsconfig/react-native to 3.0.0
Reviewed By: cortinico
Differential Revision: D45085932
fbshipit-source-id: 448f1103ef13f76fa95884f790a3cccd9ff75b2f
# Conflicts:
# packages/react-native/template/package.json
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36632
Discovered when bumping the RN documentation to typecheck against 0.72, https://github.com/facebook/react-native/pull/36109 removed the `EmitterSubscription` type which should be kept public.
Changelog:
[General][Fixed] - Export EmitterSubscription TypeScript Type
Reviewed By: cortinico
Differential Revision: D44375081
fbshipit-source-id: c8dbd5694d3a728a0a2091210894d27c9d84a012
Summary:
Implement a few missing bits for `maintainVisibleContentPosition` to work with fabric. The main thing needed is to add 2 fabric renderer listener methods to allow to hook into specific parts of the rendering process. We need some code to execute before view updates are executed and after view updates are executed. The current methods that are exposed do not work for this case. `willDispatchViewUpdates` is called from JS thread, and there doesn't seem to be a way to add UI blocks that will be executed at the right time like we do in paper. `didDispatchMountItems` is called for every frame which we don't want and will cause lots of overhead.
After that we simply need to call the right methods in the new renderer listener methods.
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[ANDROID] [ADDED] - Add fabric support for maintainVisibleContentPosition on Android
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/35994
Test Plan: Tested in RN tester maintainVisibleContentPosition example on Android with fabric enabled.
Reviewed By: cipolleschi
Differential Revision: D44131763
Pulled By: cortinico
fbshipit-source-id: 32c0b5867d460537b18a70d472fd58052da6cf80
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36796
As the title says, this fixes a instacrash on template when `createRootView` is invoked with
a bundle being null. The crash was happening as the parameter, despite being not used, is
specified as `Bundle` and is not nullable. When the Java caller passes `null`, the app crashes.
Changelog:
[Android] [Fixed] - Fix a crash new app template when `createRootView` is invoked with null bundle
Reviewed By: cipolleschi
Differential Revision: D44668305
fbshipit-source-id: 1150ddac26f19765e7340878c8850d8462c6f3fd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36771
Changelog: [internal]
Previously, when `NSTextStorage` was cached, we were not accounting for case where text which was aligned to centre or left, was used to size its container.
The result was that it was painted outside of its container, therefore invisible. To fix this, we adjust the offset to make sure text is painted correctly.
This bug only happens if:
- Text is not aligned to left in right to left writing system.
- The canvas where text is drawn is not stretched to full width of its parent.
- The offset needs to be large enough for this to matter, otherwise the text is just slightly off.
- Because of the caching mechanism, it had to be a piece of text that was rendered before. Otherwise it would work.
This complexity is worth the trouble to avoid invalidation of layout inside NSTextContainer, which is expensive.
Reviewed By: cipolleschi
Differential Revision: D44624085
fbshipit-source-id: 1bb8ef88933a49b478a2606dba6bf16b4e728b2b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36773
Changelog: [internal]
Do not construct `NSAttributedString` if `NSTextStorage` exists. Creating `NSAttributedString` is expensive and it isn't needed to measure text if `NSTextStorage` `exists`
Reviewed By: cipolleschi
Differential Revision: D44620292
fbshipit-source-id: 0827c514e40fcbd9626d2b7d7b6d28a3332d9aa1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36759
On Thursday the 30th, Apple Released Xcode 14.3.0.
This Version of Xcode enforce some version checks for which React-Codegen, which supported iOS 11 as minimum supported version, could not be build anymore.
This change ensue that React-Codegen is always aligned to the min version supported by React Native.
Plus, it moves CircleCI's Xcode to 14.3.0, to keep this problem in Check.
While working on this, I figured that, with the monorepo, Ruby tests stopped working because they were in the wrong folder: I moved them in the right one.
## Changelog:
[iOS][Fixed] - Make React Native build with Xcode 14.3.0 and fix tests
Reviewed By: blakef
Differential Revision: D44605617
fbshipit-source-id: 3ec1f5b36858ef07d9f713d74eb411a1edcccd45
Summary:
Changelog: [Internal]
Okay, so before the monorepo migration we had to use two scripts separately:
1. Bumping every package with `npm run bump-all-updated-packages`
2. Aligning other packages versions with `npm run align-package-versions`
The reason for it is that *before the monorepo* in a release branch cutoff process we had a step, which was removing `workspaces` keyword from `react-native` package. Without this keyword all new versions of packages will be resolved from npm (where they will be not available yet, because we have to publish them prior to it)
This is not the case for our current setup, and we can actually bump packages versions and they will be resolved as a workspaces successfully
Differential Revision: D44261057
fbshipit-source-id: 6095209c8183f6d84e2697fda2e9a21f8a57f73e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36724
Similarly to iOS, this adds some examples of direct manipulation on Android using
all the various methods.
Changelog:
[Internal] [Changed] - Add examples of Direct Manipulation in Fabric Intrerop
Reviewed By: cipolleschi
Differential Revision: D44541437
fbshipit-source-id: b6e10ac0a815f41ff3c980236b7d8c6937e92065
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36725
This diff adds an example of using `dispatchViewManagerCommand` for the Fabric Intreop on Android.
Changelog:
[Android] [Added] - Add example for dispatchViewManagerCommand on Fabric Interop
Reviewed By: cipolleschi
Differential Revision: D44540951
fbshipit-source-id: 85bc65ad0eb3a951fbb37d61ca26532ec3cc53b7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36692
Similar to the iOS counterpart,
this changes adds an example to RNTester to verify that the Interop Layer can process bubbling events in Fabric as it used to do in Paper.
Changelog:
[Internal] [Changed] - Add Fabric Interop event example
Reviewed By: cipolleschi
Differential Revision: D44467555
fbshipit-source-id: 1f1af27583c402641c549bc2926a64469dcd7b3f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36693
Similar to #36417, this changes adds an example to RNTester to verify that the Interop Layer can process constants in Fabric as it used to do in Paper for Android.
Changelog:
[Android] [Added] - Add Fabric Interop constants example
Reviewed By: cipolleschi
Differential Revision: D44466391
fbshipit-source-id: 74e654319b93e60b415297dcdddc98eb100913df
Summary:
X-link: https://github.com/facebook/metro/pull/955
Pull Request resolved: https://github.com/facebook/react-native/pull/36584
Changelog:
[General][Changed] - Default condition set for experimental Package Exports is now `['require', 'react-native']`
The [Exports RFC](https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0534-metro-package-exports-support.md) had assumed that supporting the `"import"` condition was a syntax-only difference, given we are not in a Node.js environment — and so was worthwhile to support for maximal ecosystem compatibility.
{F915841105}
This assumption is similar to [`--moduleResolution bundler` in TypeScript 5.0](https://github.com/microsoft/TypeScript/pull/51669):
> bundlers and runtimes that include a range of Node-like resolution features and ESM syntax, but do not enforce the strict resolution rules that accompany ES modules in Node or in the browser
> -- https://github.com/microsoft/TypeScript/pull/51669#issue-1467004047
However, robhogan has rightly pointed out that **we should not do this!**
- ESM (once transpiled) is **not** simply a stricter subset of in-scope features supported by CJS. For example, it supports top-level async, which would be breaking at runtime.
- We recently made the same change for our Jest environment:
- https://github.com/facebook/react-native/commit/681d7f8113d2b5e9d6966255ee6c72b50a7d488a
As such, we are erring on the side of correctness and supporting only `['require', 'react-native']` in our defaults. At runtime, all code run by React Native is anticipated to be CommonJS. `"exports"` will instead allow React Native to correctly select the CommonJS versions of modules from all npm packages.
Metro changelog: [Experimental] Package Exports `unstable_conditionNames` now defaults to `['require']`
Reviewed By: robhogan
Differential Revision: D44303559
fbshipit-source-id: 0077e547e7775e53d1e4e9c3a9d01347f4fb7d4a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36686
After the recent changes of Metro and Metro-Config, we need to update the path used to load the bundle in RNTester
## Changelog:
[General][Fixed] - Use the right path to load RNTester bundle
Reviewed By: cortinico
Differential Revision: D44465418
fbshipit-source-id: 96170194579792f9a5d8a141328d43e45a4db973
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36717
After D43711737 landed, it turns out that Fabric is always disabled for both
RN-Tester and new app from template (so for 0.72 also RC0).
The reason is that a new method `createRootView(Bundle)` was introduced inside
`ReactActivityDelegate`. Both RN Tester and the template were using the
old `createRootView()` method which is not called anymore at this stage
(should potentially be deprecated?).
This diff fixes it by overriding both method inside `DefaultReactActivityDelegate`
so that both methods are setting the Fabric renderer.
Changelog:
[Android] [Fixed] - Re-enable Fabric in the default app template/RN-Tester
Reviewed By: cipolleschi
Differential Revision: D44536222
fbshipit-source-id: d22a0c522f011a8fe4d27b5d8f2fcf5dd13c3058
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36610
This change add to RNTester examples of a legacy Native Component, loaded in the New Architecture through the Interop Layer, that uses the APIs described in the [Direct Manipulation](https://reactnative.dev/docs/direct-manipulation) sectioon of the website.
[iOS][Added] - Added examples of direct manipulation
Reviewed By: sammy-SC
Differential Revision: D43978674
fbshipit-source-id: 1cbc56f28034f84f309166e3e392ad97a8164e64
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36578
This change brings to the Fabric Interop Layer the possibility to directly call native methods on the View Manager, something that was not possible before and that we can use to simplify the migration to the New Architecture.
[iOS][Added] - Native Components can now call native methods in Fabric when they are loaded through the Interop Layer
Reviewed By: sammy-SC
Differential Revision: D43945278
fbshipit-source-id: fe67ac85a5d0db3747105f56700d1dbba7ada5f1