Граф коммитов

24813 Коммитов

Автор SHA1 Сообщение Дата
Dmitry Rykun 28a65f4387 ScrollView fails when contentInsetAdjustmentBehavior is automatic
Summary:
Fix to https://github.com/reactwg/react-native-new-architecture/discussions/30
We have already applied this solution to both [pre-Fabric](https://www.internalfb.com/code/fbsource/[1da0f2e3164d6f87e8221e0f0462ae93fdc5cbdc]/xplat/js/react-native-github/React/Views/ScrollView/RCTScrollView.m?lines=361) and [Fabric](https://www.internalfb.com/code/fbsource/[1da0f2e3164d6f87e8221e0f0462ae93fdc5cbdc]/xplat/js/react-native-github/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm?lines=36) scroll views. However Fabric can reuse components, and this has to be reapplied at every reuse.
Changelog [iOS][Fixed] - ScrollView's contentInsetAdjustmentBehavior is reset to Never at every reuse to avoid layout artifacts.

Reviewed By: cipolleschi

Differential Revision: D35965080

fbshipit-source-id: 3ac26cf304b608d09ae6c0f05588b664381551f2
2022-04-27 06:50:03 -07:00
Baoshuo Ren dfc24fa1ed chore: remove git.io (#33715)
Summary:
All links on git.io will stop redirecting after April 29, 2022. So I removed it.

- https://github.blog/changelog/2022-04-25-git-io-deprecation/

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

Reviewed By: GijsWeterings

Differential Revision: D35933602

Pulled By: cortinico

fbshipit-source-id: 656282f3e506b984f4a72e7449320a8241e569c5
2022-04-27 03:34:02 -07:00
Riccardo Cipolleschi ecf3293985 Back out "Remove AsyncStorage from rn-tester and fix InternalSettings Example"
Summary:
This diff breaks the RNTester app at runtime and it prevents us from cutting RN 0.69.

Original commit changeset: a879787d8683

Original Phabricator Diff: D35435562 (f4c4f446e4)

## Changelog
[General][Fixed] - Revert change which breaks RNTester

Reviewed By: cortinico, kacieb

Differential Revision: D35936298

fbshipit-source-id: c4ec92002fde9c1de691bcda17ebc5d0747914f6
2022-04-27 01:10:18 -07:00
Ramanpreet Nara b4ebc98e51 Log error when TMMDelegate getModuleForClass returns nil
Summary:
Ideally, the application should always be able to create the TurboModule object given an ObjC class. This debugging information will help track down these classes of issues, when they surface.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D35945399

fbshipit-source-id: 1621a4a64bc8fb0411123fb1470bbb52ccf0edcf
2022-04-26 16:30:29 -07:00
Ramanpreet Nara 7f3cc256b5 Prevent Nullptr segfault in TurboModule init path
Summary:
During the TurboModule init path, the TurboModuleManager asks the application to create the TurboModule object, given its class.

If the application is unable to create the TurboModule object, what should we do?
0. **What we do now:** Continue executing TurboModule init path.
1. Silently return nil early.
2. Silently return nil early, and RCTLogError.

If we Continue executing the TurobModule init path, we'll run into a segfault, because we'll call objc_setAssociatedObject(nil, ...).

This diff prevents that segfault, by doing a silent return of nil.

Changelog: [iOS][Fixed] - Prevent Nullptr segfault in TurboModule init path

Reviewed By: fkgozali

Differential Revision: D35942323

fbshipit-source-id: 7755800379c4bc733502314f3af3f401e9b04872
2022-04-26 16:30:29 -07:00
Xin Chen 36c4e42d82 Add null check for gesture ended notifier
Summary:
The `notifyNativeGestureEnded` API is added to notify user gesture ended, so that any optimization we had during handling the gesture can be restored.

It's possible that when the gesture finishes, the RootView is already unmounted from the native side. This might happen when user starts a gesture that caused leave of the RN screen, or close the app.

Changelog:
[Android][Internal] - Avoid NPE for gesture notifier

Reviewed By: javache

Differential Revision: D35902523

fbshipit-source-id: 9bb5819a53dd053290031eebaae1b8f0318ae534
2022-04-26 14:18:17 -07:00
Rick Hanlon 1a3eaa5dbf React Native sync for revisions 60e63b9...bd4784c
Summary:
This sync includes the following changes:
- **[bd4784c8f](https://github.com/facebook/react/commit/bd4784c8f )**: Revert #24236 (Don't recreate the same fallback on the client if hydrating suspends) ([#24434](https://github.com/facebook/react/pull/24434)) //<dan>//
- **[6d3b6d0f4](https://github.com/facebook/react/commit/6d3b6d0f4 )**: forwardRef et al shouldn't affect if props reused ([#24421](https://github.com/facebook/react/pull/24421)) //<Andrew Clark>//
- **[bd0813766](https://github.com/facebook/react/commit/bd0813766 )**: Fix: useDeferredValue should reuse previous value ([#24413](https://github.com/facebook/react/pull/24413)) //<Andrew Clark>//
- **[9ae80d6a2](https://github.com/facebook/react/commit/9ae80d6a2 )**: Suppress hydration warnings when a preceding sibling suspends ([#24404](https://github.com/facebook/react/pull/24404)) //<Josh Story>//
- **[0dc4e6663](https://github.com/facebook/react/commit/0dc4e6663 )**: Land enableClientRenderFallbackOnHydrationMismatch ([#24410](https://github.com/facebook/react/pull/24410)) //<Andrew Clark>//
- **[354772952](https://github.com/facebook/react/commit/354772952 )**: Land enableSelectiveHydration flag ([#24406](https://github.com/facebook/react/pull/24406)) //<Andrew Clark>//
- **[392808a1f](https://github.com/facebook/react/commit/392808a1f )**: Land enableClientRenderFallbackOnTextMismatch flag ([#24405](https://github.com/facebook/react/pull/24405)) //<Andrew Clark>//
- **[1e748b452](https://github.com/facebook/react/commit/1e748b452 )**: Land enableLazyElements flag ([#24407](https://github.com/facebook/react/pull/24407)) //<Andrew Clark>//
- **[4175f0593](https://github.com/facebook/react/commit/4175f0593 )**: Temporarily feature flag numeric fallback for symbols ([#24401](https://github.com/facebook/react/pull/24401)) //<Ricky>//
- **[a6d53f346](https://github.com/facebook/react/commit/a6d53f346 )**: Revert "Clean up Selective Hydration / Event Replay flag ([#24156](https://github.com/facebook/react/pull/24156))" ([#24402](https://github.com/facebook/react/pull/24402)) //<Ricky>//
- **[ab9cdd34f](https://github.com/facebook/react/commit/ab9cdd34f )**: Bugfix: In legacy mode, call suspended tree's unmount effects when it is deleted ([#24400](https://github.com/facebook/react/pull/24400)) //<Andrew Clark>//
- **[168da8d55](https://github.com/facebook/react/commit/168da8d55 )**: Fix typo that happened during rebasing //<Andrew Clark>//
- **[8bc527a4c](https://github.com/facebook/react/commit/8bc527a4c )**: Bugfix: Fix race condition between interleaved and non-interleaved updates ([#24353](https://github.com/facebook/react/pull/24353)) //<Andrew Clark>//
- **[f7cf077cc](https://github.com/facebook/react/commit/f7cf077cc )**: [Transition Tracing] Add Offscreen Queue ([#24341](https://github.com/facebook/react/pull/24341)) //<Luna Ruan>//
- **[4fc394bbe](https://github.com/facebook/react/commit/4fc394bbe )**: Fix suspense fallback throttling ([#24253](https://github.com/facebook/react/pull/24253)) //<sunderls>//
- **[80170a068](https://github.com/facebook/react/commit/80170a068 )**: Match bundle.name and match upper case entry points ([#24346](https://github.com/facebook/react/pull/24346)) //<Sebastian Markbåge>//
- **[fea6f8da6](https://github.com/facebook/react/commit/fea6f8da6 )**: [Transition Tracing] Add transition to OffscreenState and pendingSuspenseBoundaries to RootState ([#24340](https://github.com/facebook/react/pull/24340)) //<Luna Ruan>//
- **[8e2f9b086](https://github.com/facebook/react/commit/8e2f9b086 )**: move passive flag ([#24339](https://github.com/facebook/react/pull/24339)) //<Luna Ruan>//
- **[55a21ef7e](https://github.com/facebook/react/commit/55a21ef7e )**: fix pushTransition for transition tracing ([#24338](https://github.com/facebook/react/pull/24338)) //<Luna Ruan>//
- **[069d23bb7](https://github.com/facebook/react/commit/069d23bb7 )**:  [eslint-plugin-exhaustive-deps] Fix exhaustive deps check for unstable vars ([#24343](https://github.com/facebook/react/pull/24343)) //<Afzal Sayed>//
- **[4997515b9](https://github.com/facebook/react/commit/4997515b9 )**: Point useSubscription to useSyncExternalStore shim ([#24289](https://github.com/facebook/react/pull/24289)) //<dan>//
- **[01e2bff1d](https://github.com/facebook/react/commit/01e2bff1d )**: Remove unnecessary check ([#24332](https://github.com/facebook/react/pull/24332)) //<zhoulixiang>//
- **[d9a0f9e20](https://github.com/facebook/react/commit/d9a0f9e20 )**: Delete create-subscription folder ([#24288](https://github.com/facebook/react/pull/24288)) //<dan>//
- **[f993ffc51](https://github.com/facebook/react/commit/f993ffc51 )**: Fix infinite update loop that happens when an unmemoized value is passed to useDeferredValue ([#24247](https://github.com/facebook/react/pull/24247)) //<Andrew Clark>//
- **[fa5800226](https://github.com/facebook/react/commit/fa5800226 )**: [Fizz] Pipeable Stream Perf ([#24291](https://github.com/facebook/react/pull/24291)) //<Josh Story>//
- **[0568c0f8c](https://github.com/facebook/react/commit/0568c0f8c )**: Replace zero with NoLanes for consistency in FiberLane ([#24327](https://github.com/facebook/react/pull/24327)) //<Leo>//
- **[e0160d50c](https://github.com/facebook/react/commit/e0160d50c )**: add transition tracing transitions stack ([#24321](https://github.com/facebook/react/pull/24321)) //<Luna Ruan>//
- **[b0f13e5d3](https://github.com/facebook/react/commit/b0f13e5d3 )**: add pendingPassiveTransitions ([#24320](https://github.com/facebook/react/pull/24320)) //<Luna Ruan>//

Changelog:
[General][Changed] - React Native sync for revisions 60e63b9...bd4784c

jest_e2e[run_all_tests]

Reviewed By: kacieb

Differential Revision: D35899012

fbshipit-source-id: 86a885e336fca9f0efa80cd2b8ca040f2cb53853
2022-04-26 13:29:43 -07:00
Kacie Bawiec ca5e3b1dc9 Fix sendAccessibilityEvent_unstable Example in RNTester
Summary:
# First issue - incorrect ref
In this example, `AccessibilityInfo.setAccessibilityFocus_unstable` is being called on the Button ref. This fails because Button is not a HostComponent and does not accept a forwarded ref.

Since the button needs to be focused in order to click on it, I don't think the intention of this example actually makes sense. Since even if it worked, it would just reset the focus in the same place.

Instead, I alter this to set accessibility focus on the preceding Text element, which makes it more clear that setAccessibilityFocus is working.

# Second Issue - focus after closing Alert doesn't work
I am not sure why this is the case, but removing the alert causes focus to work correctly. i'm guessing the set focus command is conflicting with Alert's default resetting focus behavior.

# Minor Fix
I also quickly cleaned this up to be a function component because class components make refs more confusing (to me).

Changelog:
[Genera] Fix sendAccessibilityEvent_unstable Example in RNTester

Reviewed By: p-sun

Differential Revision: D35725018

fbshipit-source-id: f5a1dbbcf2635f038c41db9ef2a0b31389d2c745
2022-04-26 12:44:42 -07:00
Nicola Corti 8ae9c2cff6 Lazily resolve the hermesc path rather than eagerly
Summary:
This commit moves the resolution of the hermesc inside the TaskAction block of the
HermesBinaryTask. Therefore the hermesc path will be investigated only during the
execution of the task, and not when the task is created.

Changelog:
[Internal] [Changed] - Lazily resolve the hermesc path rather than eagerly

Reviewed By: motiz88

Differential Revision: D35930548

fbshipit-source-id: a517dda0fa9b10f53c25cd256ceb68d37d533d3b
2022-04-26 08:25:03 -07:00
Nicola Corti c12423cbdc Use Android SDK version of CMake rather than an external one
Summary:
This diff updates the CMake command used for configuring the Hermes build
from `cmake` from $PATH to the `cmake` bundled with the Android SDK.
If not found, fallsback to the previous behavior.

This relaxes the requirement of having to ask our users to install CMake
in their CLIs.

Changelog:
[Internal] [Changed] - Use Android SDK version of CMake rather than an external one

Reviewed By: neildhar

Differential Revision: D35931306

fbshipit-source-id: 8d6c554e5e9040e3bd4fed5f72fbdb0eb61d745a
2022-04-26 07:19:00 -07:00
Nicola Corti 59385e8e90 Expose private node management methods in UIManager (#33688)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33688

These methods used to be public in the legacy implementation, and hiding them significantly reduces amount of customization available to other clients outside Fabric core.

Changelog: [Internal] Allow external callers to call UIManager methods

Reviewed By: cipolleschi

Differential Revision: D35818114

fbshipit-source-id: 4dc4177c82b5db9ae3d136a1a83f5ec3123b971f
2022-04-26 05:11:05 -07:00
Nicola Corti 54db5f2012 Expose UIManager from Scheduler (#33545)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33545

Exposes `UIManager` instance for access from third-party modules.

Changelog: [Changed] Exposes `UIManager` instance for third-party access.

Reviewed By: javache

Differential Revision: D35314058

fbshipit-source-id: 1922c2afc37b105b153a82f45e5bac9c0b0cdfae
2022-04-26 05:11:05 -07:00
Nicola Corti 614aa86916 Expose scheduler through RCTSurfacePresenter
Summary:
Exposes event listener through iOS scheduler wrapper (`RCTScheduler`) and exposes scheduler itself through `RCTSurfacePresenter`.

Changelog: [Changed] Exposed `RCTScheduler` to allow setting event listeners.

Reviewed By: philIip

Differential Revision: D35313398

fbshipit-source-id: 794179d47f407fee5692a98b13ac08f92e85a61c
2022-04-26 05:11:05 -07:00
Nicola Corti 1730949e94 Expose scheduler through FabricUIManager
Summary:
Allows to access `react::renderer::Scheduler` given `FabricUIManager` from Java side.

Changelog: [Added] Added `FabricUIManager` binding with FBJNI

Reviewed By: javache

Differential Revision: D35313399

fbshipit-source-id: 54e7adcceae40368c2735ddfc8a083f87b08dc5e
2022-04-26 05:11:05 -07:00
Nicola Corti e51e19ecc1 Add event listeners to Scheduler
Summary:
Minimal set of changes to intercept events in external modules. Current intended use-case is for Reanimated to handle events for the Animated properties.

Changelog: [Added] Add listeners to allow intercepting events in C++ core.

Reviewed By: cipolleschi

Differential Revision: D35312534

fbshipit-source-id: ec924b57fd0c0dabf7be7b886dbef23bf3170d6c
2022-04-26 05:11:05 -07:00
Pieter De Baets ceb0a54608 Memoize VirtualizedListCellContextProvider
Summary:
When a FlatList is nested inside another FlatList, it may be re-rendered whenever the outer FlatList renders. Apply the same optimization we already had in `VirtualizedListContextProvider` to avoid changing the context object if no values have changed.

Changelog: [General][Changed] - Optimized VirtualizedList context when used with nested lists

Reviewed By: genkikondo

Differential Revision: D35905952

fbshipit-source-id: 695253c85db2043d22e208ad94ecc7daa1455055
2022-04-26 04:04:45 -07:00
Xin Chen f40976cd24 Refactor findTargetPathAndCoordinatesForTouch to improve perf of event delivery
Summary:
Refactor of TouchTargetHelper.findTargetPathAndCoordinatesForTouch to avoid unnecessary lookup of views during the dispatching of Hover Events

changelog: [internal] internal

Reviewed By: lunaleaps, mdvacca

Differential Revision: D32296003

fbshipit-source-id: 93834c37331ad5d75645a5665a1c8c3d965765fb
2022-04-25 14:11:11 -07:00
Nicola Corti 6563c99c49 Honor the REACT_NATIVE_OVERRIDE_HERMES_DIR variable when searching for `hermesc`
Summary:
When searching for the `hermesc` path, we should also honor the `REACT_NATIVE_OVERRIDE_HERMES_DIR` variable.

Changelog:
[Internal] [Changed] - Honor the REACT_NATIVE_OVERRIDE_HERMES_DIR variable when searching for `hermesc`

Reviewed By: neildhar

Differential Revision: D35903601

fbshipit-source-id: 31e1255a558eece8cd84669861328db72e9ed17b
2022-04-25 12:15:41 -07:00
Vincent Riemer 6855f7405c Ensure LogBox uses UIWindowScene API for opening its view
Summary: Changelog: [iOS][Internal] Fix: Ensure LogBox uses UIWindowScene API for multi-window Mac Catalyst Apps

Reviewed By: arhelmus

Differential Revision: D35825513

fbshipit-source-id: 3dc5db7c84d2abf7cf4a3ffb3512de723a32f72d
2022-04-25 10:39:26 -07:00
Steven Vascellaro c6dc01fac6 Fix typo in comments (#33694)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33694

Fixes a pluralization typo

Changelog:
[General][Fixed] - Fixed a pluralization typo in docstrings.

Reviewed By: javache

Differential Revision: D35856572

fbshipit-source-id: 88118be36107025b0b513bf2ec6671304d789204
2022-04-25 10:15:36 -07:00
Lulu Wu 30051b2c41 Remove usage of std::string in EarlyJsErrorHandler
Summary:
This would fix test errors caused by including <string> in non-C++ compatible files.

Changelog:
[General][Changed] - Remove usage of std::string in EarlyJsErrorHandler.

Reviewed By: RSNara

Differential Revision: D35645334

fbshipit-source-id: 7f04d2c66d53dc1eef63367de1a64ed9273898f5
2022-04-25 07:48:49 -07:00
Oleksandr Melnykov fc1f5bbb92 Ensure correct instance for transaction telemetry
Summary:
Ensures that transaction telemetry modified by transaction controller is the same as sent in the view callbacks.

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D35827347

fbshipit-source-id: 123ae01d4a7fe1a9c97ebccae3ae248f7f2cf654
2022-04-25 04:14:39 -07:00
Oleksandr Melnykov 3a721f48b1 Pass mutation list to RCTMountingTransactionObserving callbacks
Summary:
Re-land of previous reverted commit.

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D35843710

fbshipit-source-id: 3adde4fba2f2702ad5b85b3b52b2f68843c6c9f2
2022-04-25 04:14:39 -07:00
Gijs Weterings a65ae8eff6 Attach js_extra_data to JS errors on iOS
Summary:
Changelog:
[iOS][Fixed] - Expose the extraData dict attached to JavaScript errors to the native ExceptionManager on iOS, similar to Android

Attaching the `extraData` dict to JavaScript crash reports is something that was done for Android only in 2019 (D16133080 (3a825c0360)), and somehow we never really got around to adding it in iOS. This diff finally adds the capability to iOS as well. `extraData` can be used to attach various bits of data to a crash report for better debugging and categorization. As with the Android implementation, `extraData` is not attached if the `reportException` API is not used.

Reviewed By: dmitryrykun

Differential Revision: D35743658

fbshipit-source-id: de4060cb6e514db1d85907441a8962f98e9b8392
2022-04-25 03:26:24 -07:00
Carmi Grushko 4f855c8a2a @allow-large-files [MSDK] Update ktfmt component on FBS:master
Reviewed By: strulovich

Differential Revision: D35774317

fbshipit-source-id: ce59de8c38e385827a9ee62473b57a1791f18d27
2022-04-25 03:08:51 -07:00
Marshall Roch 17d2a27ff8 upgrade to flow v0.176.3
Summary: Changelog: [Internal]

Reviewed By: samwgoldman

Differential Revision: D35864616

fbshipit-source-id: f0d060adc9e0067bdeed077d36c7168ffc17525f
2022-04-22 22:24:38 -07:00
Chaoshuai Lu d70d7fd0b3 Adopt UIGraphicsImageRenderer API
Summary:
Apple suggested to this new API on iOS 10+.

> // Any new bitmap drawing code is encouraged to use UIGraphicsImageRenderer in lieu of this API.

WWDC18 Reference: https://developer.apple.com/videos/play/wwdc2018/219/
> Use UIGraphicsImageRenderer to create and draw to an image buffer
Supports Wide Color, unlike UIGraphicsBeginImageContext()
Combine with UIImageView for efficient offscreen rendering

Per https://nshipster.com/image-resizing/#performance-benchmarks, the new API runs even faster than the C version, probably due to more smart context reuses/management.

Changelog:
[iOS][Changed] - Adopt UIGraphicsImageRenderer API

Reviewed By: philIip

Differential Revision: D35699584

fbshipit-source-id: 7a1e2109d5e121fb396c1014f4ed0a892211b0cc
2022-04-22 17:02:51 -07:00
Alex Liang 7454044542 Make ReactModuleSpecProcessor print stacktrace when typeElement.getAnnotation fails
Summary:
WHen porting TurboModules or adding new TurboModules, ReactModuleSpecProcessor may fail during buck build, and when the failure is caused by typeElement.getAnnotation, no useful information gets collected, making it difficult to debug.
So here I am adding a try & catch so we can get useful debugging info.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D35767207

fbshipit-source-id: 7e1f9dfbfd31339ab37af19c51d85085e100955a
2022-04-22 16:57:51 -07:00
John Wang ffaa5d69bc Add @Nullable to WritableMap and WritableArray for Android Java spec generator
Summary:
We're adding a native module that returns a Nullable type. This makes the Java spec and the implementation to be the same.

Changelog:
[Android][Added] - Generate `Nullable` for optional objects and arrays in module codegen.

Reviewed By: yungsters

Differential Revision: D35651333

fbshipit-source-id: d73c87340e33cf79831915ce6892e457ef369175
2022-04-22 16:55:29 -07:00
Luna Wei 6958bbb28c Fix up lint errors under react-native-github (#33622)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33622

Changelog: [Internal] Clean up eslint errors

Reviewed By: yungsters

Differential Revision: D35599445

fbshipit-source-id: bbb9061a3cf9df32daacad9a9b44eba94d3ce48c
2022-04-22 16:25:25 -07:00
Nicola Corti 56fd85e371 Customize the Hermes version using the RN one
Summary:
This diff allows to customize the Hermes version exposed by the VM with
a version provided by React Native. This will make clearer that a specific
version of Hermes was built at a specific point of the RN release process.

Changelog:
[Internal] [Changed] - Customize the Hermes version using the RN one

Reviewed By: neildhar

Differential Revision: D35820268

fbshipit-source-id: 3e76db921c12a599743fb9312f52edd06d223bad
2022-04-22 07:52:27 -07:00
MaeIg db284ae037 Don't capitalize words starting by a number (fabric renderer) (#33629)
Summary:
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

Few month ago, I created a [pull request](https://github.com/facebook/react-native/pull/32774) to unify the behavior of capitalize style between Android and IOS.

But, I found out that it doesn't work when fabric is enabled. We have the old behavior :
| Android | IOS |
| ------------- | ------------- |
| <img width="458" alt="capitalize_android_fabric" src="https://user-images.githubusercontent.com/40902940/163182082-4061003c-230b-46f7-9e93-c34b66dbf3d2.png"> | <img width="476" alt="capitalize_ios_fabric" src="https://user-images.githubusercontent.com/40902940/163182124-b6dee450-46e3-41a3-b5bb-553d7c2662e6.png"> |
(source: rn-tester, last commit: dac56ce)

As fabric is now live since v0.68, we should fix this behavior for fabric aswell.

I don't know why there is so much duplicated code between `ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm` and `Libraries/Text/RCTTextAttributes.m` because I don't know the architecture of the project very well. But if you see missing tests or some refacto to do I'm open to suggestions!

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Don't capitalize the first letter of a word that is starting by a number (Fabric renderer)

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

Test Plan:
I manually tested these changes on rn-tester (react-native `main` branch):
| Fabric ? | Android | IOS |
| ------------- | ------------- | ------------- |
| YES | <img width="458" alt="capitalize_android_fabric" src="https://user-images.githubusercontent.com/40902940/163182082-4061003c-230b-46f7-9e93-c34b66dbf3d2.png"> | <img width="476" alt="capitalize_ios_fabric_after" src="https://user-images.githubusercontent.com/40902940/163184277-6c58c117-7144-4f6b-98ea-0c1db654f27b.png"> |
| NO | <img width="458" alt="android_nf_after" src="https://user-images.githubusercontent.com/40902940/163190263-9d801f6a-09c2-4ec6-a841-3dca115a5ef7.png"> | <img width="476" alt="ios_nf_after" src="https://user-images.githubusercontent.com/40902940/163190333-7e9eac6a-3f28-4826-8ef9-bcf45bf870a9.png"> |

Reviewed By: cortinico

Differential Revision: D35611086

Pulled By: GijsWeterings

fbshipit-source-id: 0c43807dcddb30e65921eb1525c0fe440162ec32
2022-04-22 06:15:21 -07:00
Héctor Ramos bb01b75637 Make Hermes from source the default
Summary:
If Hermes is enabled, it will be built from source instead of using the CocoaPods hermes-engine pod.

Changelog:
[iOS] [Changed] Build Hermes from source when Hermes is used

Reviewed By: cortinico

Differential Revision: D35693945

fbshipit-source-id: eadc638106180b183fd6d1e2a272dc3df66fa8b6
2022-04-21 17:27:56 -07:00
Oleksandr Melnykov 2f5a1e6124 Back out "Pass mutation list to RCTMountingTransactionObserving callbacks"
Summary:
https://fb.workplace.com/groups/fbapp.commerce.engsupport/permalink/2074812256012212/

Back out "[react-native][PR] Pass mutation list to RCTMountingTransactionObserving callbacks"

Original commit changeset: f40afc512f2c

Original Phabricator Diff: D35214478 (91fc2c0091)

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D35825832

fbshipit-source-id: b53b616dca39c84b3a8e8e4cbaa4a45834e53fe3
2022-04-21 16:27:57 -07:00
Héctor Ramos 476330a86e Circle CI: Re-enable iOS unit tests (#33547)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33547

Now that Hermes is being built from source, Circle CI iOS unit tests can be re-enabled.

Changelog: [Internal]

Reviewed By: cortinico, neildhar

Differential Revision: D35328103

fbshipit-source-id: ea99d8f1fa02997e9c4f55048012b4b55c0bb2b3
2022-04-21 13:49:40 -07:00
Richard Howell 8c4e81a0c8 add casts for implicit int to float
Summary: Apply //fbobjc/Tools/cAST:implicit_conversion to existing warnings

Reviewed By: d16r

Differential Revision: D35817706

fbshipit-source-id: 3c40c1622e556d1556c138bab5b4c120c443f64e
2022-04-21 12:18:53 -07:00
Nicola Corti aeac6ab677 Gradle: extend the algoritm to find hermesc paths.
Summary:
This diff extends the Gradle algo used to search for `hermesc`.
Currently we look into `node_modules/hermes-engine/%OS-BIN%/hermesc`

With this change the algo will look into:
- A user provided path to hermesc
- Built from source version of hermesc (for users of New Architecture)
- Bundled version of hermesc inside react-native
- hermesc from the hermes-engine NPM package

I've added tests for the new algo. I also realized our tests were broken
(since they stopped running on CI), I fixed them as well.

Changelog:
[Android] [Changed] - Gradle: extend the algoritm to find hermesc paths

Reviewed By: ShikaSD

Differential Revision: D35649911

fbshipit-source-id: d4bcbe06a6bfa8d98b91c1612fc28b300de91661
2022-04-21 07:19:28 -07:00
Riccardo Cipolleschi 8ac8439e0d Prepare AppDelegate to enable Concurrent Root on iOS (#33671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33671

With React 18, we now need to allow users on Fabric to opt-in for Concurrent Root.

This commit adds a new method that can be customized in the AppDelegate to turn the feature on and off.
The flag is passed as an initialProps to the rootView.

## Changelog:
[iOS][Added] - Prepare a method in the AppDelegate to control the concurrentRoot.

Reviewed By: cortinico, dmitryrykun

Differential Revision: D35757833

fbshipit-source-id: 192cf74c796554cba39366aa90c53c191f960c20
2022-04-21 06:59:17 -07:00
Riccardo Cipolleschi 323db75c36 Pass node executable to codegen (#33672)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33672

This pr adds a parameter to the `create-artifacts.js` script to accept the path to a node executable, falling back to `node` in case the parameter has not been passed.
Then, it passes the NODE_BINARY to the script in the `script_phases.sh` script.

This PR decouples the `node` environment from the system one and fixes a build issue in the new architecture when the environment has no `node`

## Changelog

[iOS][Changed] - Update CodeGen scripts to accept custom node executable

Reviewed By: cortinico, dmitryrykun

Differential Revision: D35748497

fbshipit-source-id: 41b102de6427d6ef0ba1f8725f4b939d3b8c63db
2022-04-21 06:59:17 -07:00
Riccardo Cipolleschi 705c6f57d6 Export REACT_NATIVE_PATH and fix find-node-for-xcode.sh fallback behavior (#33674)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33674

## Issue
In D35317070 (0480f56c5b) we introduced a way to configuring the Xcode environment via he `.xcode.env`, falling back to the old `find-node-for-xcode.sh` behavior in case of a misconfiguration.

Unfortunately, there were an issue with the new architecture for which the pods were not able to locate the `find-node-for-xcode.sh`, crashing while building the new architecture.

## Solution
This Diff solves the issue in two steps:
1. it exposes to the project the REACT_NATIVE_PATH like Android does here: D35451821 (f8d7e0a968)
2. it leverages this new variables to reach the script

## Changelog
[iOS][Changed] - Fixed the fallback behavior when the `.xcode.env` file is missing, actually using the old `find-node-for-xcode.sh` script

Reviewed By: dmitryrykun

Differential Revision: D35779165

fbshipit-source-id: 393ef9a0b98d32d9cf226f7d109fdefd772e5120
2022-04-21 06:59:17 -07:00
Krzysztof Magiera 91fc2c0091 Pass mutation list to RCTMountingTransactionObserving callbacks (#33510)
Summary:
This PR updates `RCTMountingTransactionObserving` protocol to accept full `MountingTransaction` object as an argument to its methods as opposed to just `MountingTransactionMetdata` which contained only some subset of information.

This change makes it possible for components implementing the protocol to analyze the list of mutations and hence only take action when certain mutations are about to happen.

One of the use cases for `RCTMountingTransactionObserving` protocol is to allow for Modal to take view snapshot before it is closed, such that an animated close transition can be performed over the snapshotted content. Note that when modal is removed from the view hierarchy its children are gone too and therefore the snapshot mechanism makes it possible for children to still be visible while the animated closing transition is ongoing. A similar use-case to that can be seen in react-native-screens library, where we use the same snapshot mechanism for views that are removed from navigation stack.

Before this change, we'd use `mountingTransactionDidMountWithMetadata` to take a snapshot. However, making a snapshot of relatively complex view hierarchy can be expensive, and we'd like to make sure that we only perform a snapshot when the given modal is about to be removed. Because the mentioned method does not provide an information about what changes are going to be performed in a given transaction, we'd make the snapshot for every single view transaction that happens while the modal is mounted.

In this PR we're updating `RCTMountingTransactionObserving` protocol's methods, in particular, we rename methods to no longer contain "Metadata" in them and to accept `MountingTransaction` as the only argument instead of `MountingTransactionMetadata` object. With this change we are also deleting `MountingTransactionMetadata` altogether as it has no uses outside the protocol. Finally, we update the two uses of the protocol in `RCTScrollViewComponentView` and `RCTModalHostViewComponentView`.

## Changelog

[iOS][Fabric] - Update RCTMountingTransactionObserving protocol to consume MountingTransaction objects

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

Test Plan:
As there are not that many uses of `RCTMountingTransactionObserving` protocol during testing I focused on checking if the updated method is called and if the provided objects contains the proper data. Unfortunately, despite code for the modal protocol being present in OSS version it does seem like some parts of modal implementation are still missing and the component only renders an unimplemented view (checked this with rn-tester). I only managed to verify the use in `RCTScrollViewComponentView` with the following steps:
1. Build for iOS
2. Put a breakpoint in mountingTransactionDidMount method in `RCTScrollViewComponentView.mm`
3. Verify that the program stops on the breakpoint when a scrollview is rendered (use any screen on rn-tester app)
4. Inspect the provided object in the debugger (ensure the list of transactions is not empty)

Outside of that we verified the transactions can be processed in `mountingTransactionDidMount` after the changes from this PR are applied in FabricExample app in [react-native-screens](https://github.com/software-mansion/react-native-screens/tree/main/FabricExample) repo.

Reviewed By: cipolleschi

Differential Revision: D35214478

Pulled By: ShikaSD

fbshipit-source-id: f40afc512f2c8cfa6262d2fb82fb1ccb05aa734c
2022-04-21 05:10:21 -07:00
Héctor Ramos 29c5461114 Circle CI: enable BUILD_HERMES_SOURCE for build_ios / test_ios_unit jobs
Summary:
Build Hermes from source when testing Hermes on Circle CI.

Changelog: [Internal]

Reviewed By: cortinico, dmitryrykun

Differential Revision: D35679571

fbshipit-source-id: 7829242db28871731821d36f752d0479fd83bb49
2022-04-20 16:51:54 -07:00
Richard Howell f22d4348dc add casts for implicit int to float
Summary: Apply //fbobjc/Tools/cAST:implicit_conversion to existing warnings

Reviewed By: matrush

Differential Revision: D35787050

fbshipit-source-id: 45f06227e44203cbedf1d10978e1992399a0d06b
2022-04-20 16:29:02 -07:00
Héctor Ramos c6daadcab4 Bump CocoaPods to 1.11.3 and Ruby to 2.7.5 in tests/cache (#33654)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33654

In D35116757 (2c87b7466e) we bumped the Circle CI macOS executor to use the Xcode 13.3.0 machine image, which has CocoaPods 1.11.3 installed. The RNTester Gemfile and CocoaPods cache is updated to reflect this change.

In D35116757 (2c87b7466e) the Ruby version was bumped to 2.7.5, so we update the Sandcastle tests to reflect this change as well.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D35679327

fbshipit-source-id: e6b5f9af13e95d335e0f89ebd7e1778a56bba601
2022-04-20 15:13:49 -07:00
Ersan Kavafoglu 1a1a304ed2 Add hotkeysEnabled property to RCTDevMenu for iOS
Summary:
`hotkeysEnabled` property is added to `RCTDevMenu` which allows enabling/disabling hotkeys that triggers developer menu popup

Changelog:
[iOS][Added] - `hotkeysEnabled` property is added to `RCTDevMenu` which allows enabling/disabling hotkeys that triggers developer menu popup

Reviewed By: arhelmus

Differential Revision: D35777883

fbshipit-source-id: a7435358701bedb54e33198724180eb1c27248b8
2022-04-20 13:20:06 -07:00
Luna Wei 3c2fb72541 Bump version of @react-native-community/eslint-plugin to 1.2.0
Summary:
Changelog: [Internal] Bump react-native-community/eslint-plugin

It looks like we `*` version on the package.json so no updates needed, published 1.2.0: https://www.npmjs.com/package/react-native-community/eslint-plugin

Reviewed By: cortinico, neildhar

Differential Revision: D35590075

fbshipit-source-id: 11402cedea3067018c03e7b59202a48dc3a6b084
2022-04-20 13:19:43 -07:00
Nicola Corti ae3c426c58 Re-enable bundling of hermesc inside the react-native NPM package (#33677)
Summary:
This PR re-enables bundling of the precompiled `hermesc` binary inside the react-native NPM package. To handle this I've stripped over all the unnecessary files and kept only the relevant binary. It now follows the same structure as the `hermes-engine` NPM package.

## Changelog

[Internal] - Re-enable bundling of hermesc inside the react-native NPM package

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

Test Plan:
Will wait for a successful CI job to produce a commitlies of RN.

https://app.circleci.com/pipelines/github/facebook/react-native/13020/workflows/9b59c6e0-4e90-4008-be73-aaa3155cefc9/jobs/248841

Here the output of the RN commitlies with the file correctly placed:

```
tar -tvf ~/Downloads/react-native-1000.0.0-1520d36ba.tgz | grep hermesc
-rwxr-xr-x  0 0      0     3516952 Oct 26  1985 package/sdks/hermesc/linux64-bin/hermesc
-rwxr-xr-x  0 0      0     2618232 Oct 26  1985 package/sdks/hermesc/osx-bin/hermesc
-rwxr-xr-x  0 0      0     1613312 Oct 26  1985 package/sdks/hermesc/win64-bin/hermesc.exe
```

Reviewed By: neildhar

Differential Revision: D35784619

Pulled By: cortinico

fbshipit-source-id: 334ed03c40f6838ae8365a1f1c6e86e38a8dbc59
2022-04-20 13:03:29 -07:00
Paige Sun 0916df9951 Add MC to test disabling React Native invalidation under memory pressure
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D35732504

fbshipit-source-id: d81d6ddefc98d1e73be697c3eef8a2c90104658c
2022-04-20 10:59:57 -07:00
Antoine Doubovetzky c5c17985da Fix VirtualizedList with initialScrollIndex not rendering all elements when data is updated (#33558)
Summary:
Fixes https://github.com/facebook/react-native/issues/33529 (note that I reproduced the bug on iOS too).

The bug comes from the fact that we were using `this._scrollMetrics.offset` to determine if the initial scroll was done. But sometimes it equals 0 even after the initial scroll is done, for example when the content does not fill the list. So I replaced it with `this._hasDoneInitialScroll`.
I believe that `this._hasDoneInitialScroll` was not used in the first place because it was introduced later (3 years ago vs 5 years ago for the original code).

The replacement correctly fixes the broken test case and the example given in the issue.

Then I had to update two test cases (rename the first and remove the second), that shows explicitly the broken behavior:
we have to simulate the initial scroll for the content to be adjusted, so when the content does not fill the view and the scroll cannot be executed, the content is not adjusted.

## Changelog

[General] [Fix] - Fix VirtualizedList with initialScrollIndex not rendering all elements when data is updated

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

Test Plan:
- I added a broken test case based on the issue
- I tested with the RNTesterApp using the code example given in the issue

Reviewed By: ryancat

Differential Revision: D35503114

Pulled By: yungsters

fbshipit-source-id: 67bb75d7cf1ebac0d59127d0d45afbaa3167dcf3
2022-04-20 10:26:50 -07:00
Riccardo Cipolleschi 2c52131f5e Add link to documentation in warning (#33673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33673

This PR solves a TODO in a script that required a link to the documentation on the website.

## Changelog

[iOS][Changed] - Adding a link in a message for the users.

Reviewed By: cortinico

Differential Revision: D35742810

fbshipit-source-id: b7416a5bead5fa525ca69f05391b307195f5c987
2022-04-20 09:07:48 -07:00