Commit Graph

26790 Commits

Author SHA1 Message Date
Pieter De Baets a1f6b4d0ef Synchronize access to ViewManagerRegistry
Summary:
Found that we may do multiple allocations of the same ViewManager instance since ViewManagers are both accessed from the UI thread (mounting views) and from the Fabric background thread (for measuring Text), which could lead to multiple instances of the same ViewManager to be created.

As far as I can tell, this issue was harmless since our ViewManager constructors don't have side-effects, but not ideal.

Changelog: [Internall]

Reviewed By: rshest

Differential Revision: D43661306

fbshipit-source-id: 37ef82d41d43c334fdc6cfbeffb225bba87c668e
2023-03-01 04:37:05 -08:00
Pieter De Baets 729dcf6b29 Fix more warnings on bridge invalidation
Summary:
Looked at the top soft exceptions firing from this codepath. Most of these should use `getReactApplicationContext` instead of `getReactApplicationContextIfActiveOrWarn` to do their cleanup on invalidation.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D43661307

fbshipit-source-id: 27094a6e8dfcf4748eb916531c4998f1c9ee8713
2023-03-01 04:37:05 -08:00
Pieter De Baets 848ac0c3be Remove eager view manager preinit support
Summary:
Pre-initializing ViewManagers is not as valuable now that we've rolled out StaticViewConfigs on the new architecture. This was primarily used to pre-allocate constants and the `preInitializeViewManagers` was already deprecated.

Changelog: [Android][Removed] UIManager.preInitializeViewManagers

Reviewed By: rshest

Differential Revision: D43661304

fbshipit-source-id: 391c5207ec876a70ddd4bda30a58267090da3ff1
2023-03-01 04:37:05 -08:00
Ruslan Shestopalyuk bc56f66b8d Implement Performance.getEntries* W3C extension for Performance Timeline API (#36314)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36314

## Changelog:

[Internal] - Added support for W3C Performance API extension (Performance,getEntries*)

See [here for the details](https://www.w3.org/TR/performance-timeline/#extensions-to-the-performance-interface).

This only supports `mark` and `measure` performance entry types (not `events`, as those are not supported by browsers either, they recommend using the `PerformanceObserver` API instead).

From the implementation perspective, we already maintained persistent buffer for `mark` entry types, which was required in order to look up measures.

The buffer is circular, limited to 1K entries by default.

I basically mimic the same behavior for `measure` entry types as well, since it's the simplest way of doing it at this point,

If we happen to want adding some other entry types that would be available via `Performance.getEntries*` API in the future, we may want to iterate on the internal data structures representation inside `PerformanceEntryReporter`, but for now I believe this approach should work just fine, and whatever changes we may want to do will be purely internal implementation detail.

Reviewed By: rubennorte

Differential Revision: D43625488

fbshipit-source-id: dd315b3f8488e910749a8e2a4158246e94d76f99
2023-03-01 04:14:51 -08:00
Ruslan Shestopalyuk 3997fc1c66 Lazy init for event name mapping registry
Summary:
## Changelog:

[Internal] -

Noticed this when setting up C++ unit tests for WebPerformance - the change in this diff both makes sure there is no "global constructor" warning generated when `-Wglobal-constructors` is enabled, and also makes this bit potentially a little bit more efficient, as we don't pay for the registry construction if we don't use the WebPerformance API.

Reviewed By: christophpurrer

Differential Revision: D43663521

fbshipit-source-id: 59952f2415f49bb455a3443b3bfd8971108ac72b
2023-03-01 00:36:07 -08:00
fabriziobertoglio1987 a0adf57e50 Add TYPE_VIEW_HOVER_ENTER to AccessibilityNodeInfo sendAccessibilityEvent (#34969)
Summary:
- Adds `AccessibilityEvent.TYPE_VIEW_HOVER_ENTER` to AccessibilityNodeInfo sendAccessibilityEvent
- Adds an example implementation.

fixes https://github.com/facebook/react-native/issues/30860 fixes https://github.com/facebook/react-native/issues/30097
Related Documentation https://github.com/facebook/react-native-website/pull/3438

## Changelog

[Android] [Added] - Add TYPE_VIEW_HOVER_ENTER to AccessibilityNodeInfo sendAccessibilityEvent

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

Test Plan:
Android: https://github.com/facebook/react-native/pull/34969#issuecomment-1320225358 https://github.com/facebook/react-native/pull/34969#issuecomment-1329779921
iOS: https://github.com/facebook/react-native/pull/34969#issuecomment-1329780545 https://github.com/facebook/react-native/pull/34969#issuecomment-1330984202

Reviewed By: christophpurrer

Differential Revision: D42613990

Pulled By: lunaleaps

fbshipit-source-id: 8c8950610799dcc74067d2b47b44d4ff030f66e5
2023-02-28 20:57:35 -08:00
David Vacca 22ba1e45c5 Remove code only used by Android API level < 21
Summary:
Min Android API level is 21, this diff is removing code for Android API level < 21

changelog: [RN][Android] removing code for Android API level < 21

Reviewed By: cortinico, RSNara

Differential Revision: D43544497

fbshipit-source-id: 1ece1143a37a038826361b55ff08a8160f03108d
2023-02-28 16:11:05 -08:00
fabriziobertoglio1987 cbe934bcff 1/2 TextInput accessibilityErrorMessage (Talkback, Android) (#33468)
Summary:
**Android**: The functionality consists of calling the [AccessibilityNodeInfo#setError][10] and [#setContentInvalid][13] method to display the error message in the TextInput.

**Fixes [https://github.com/facebook/react-native/issues/30848][51] - Adding an accessibilityErrorMessage prop to the TextInput Component**:
**Android**: The prop accessibilityErrorMessage triggers the AccessibilityNodeInfo method [setError][10] which automatically sets the correct properties on the AccessibilityNodeInfo that will inform screen readers of this state. The method calls setContentInvalid(true) and setError(youErrorString) on the AccessibilityNodeInfo.

**Fixes [https://github.com/facebook/react-native/issues/30859][52] -  Detecting changes in the Error state (text inputs)**
**Fabric - Android** - Adding accessibilityErrorMessage to field AndroidTextInputState.
ReactTextInputManager and ReactEditText receive state updates both from [Javascript][32] and [cpp (fabric)][34].
- accessibilityErrorMessage is added to the fabric AndroidTextInputState field
- The updates are received in the ReactAndroid API with method updateState from ReactTextInputManager
- After updating the TextInput text with onChangeText, the update of the accessibilityErrorMessage is triggered with method maybeSetAccessibilityError which triggers [setError][10].

More info:
- An explanation of [state updates between fabric and ReactAndroid for the TextInput component][34]
- [ReactNative renderer state updates][35]

**Paper - Android** - Adding accessibilityErrorMessage to ReactTextInputShadowNode to trigger updates in Paper renderer when accessibilityErrorMessage is changed within the onChange callback.

Related Links (Android):
- [In this diff I'm shipping and deleting mapBufferSerialization for Text measurement][101]
- [This diff implement and integrates Mapbuffer into Fabric text measure system][39]
- [Refactor ViewPropsMapBuffer -> general MapBuffer props mechanism][100]
- [TextInput: support modifying TextInputs with multiple Fragments (Cxx side)][24]
- [TextInput: keep C++ state in-sync with updated AttributedStrings in Java][23]
- [AccessibilityNodeInfo#setError][11]
- [Explanation on how TextInput calls SET_TEXT_AND_SELECTION in Java API][32]
- [Fabric: convertRawProp was extended to accept an optional default value][27]
- [understanding onChangeText callback][31]
- [Editable method replace()][12]
- [Change of error state from onChangeText show/hides a TextInput error][30]
- [AndroidTextInput: support using commands instead of setNativeProps (native change)][25]
- [TextInput: support editing completely empty TextInputs][26]
- [[Android] Fix letters duplication when using autoCapitalize https://github.com/facebook/react-native/issues/29070][40]
- [Support optional types for C++ TurboModules][28]
- [discussion on using announceForAccessibility in ReactEditText][36]
- [ fix annoucement delayed to next character][61]
- [Announce accessibility state changes happening in the background][29]
- [Refactor MountingManager into MountingManager + SurfaceMountingManager][37]

iOS Functionalities are included in separate PR https://github.com/facebook/react-native/pull/35908
Documentation PR https://github.com/facebook/react-native-website/pull/3010

Next PR [2/2 TextInput accessibilityErrorMessage (VoiceOver, iOS) https://github.com/facebook/react-native/issues/35908](https://github.com/facebook/react-native/pull/35908)
Related https://github.com/facebook/react-native-deprecated-modules/pull/18

## Changelog

[Android] [Added] - Adding TextInput prop accessibilityErrorMessage to announce with TalkBack screenreaders

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

Test Plan:
**Android - 20 Jan 2023**
https://github.com/facebook/react-native/pull/33468#issuecomment-1398228674

**iOS - 20 Jan 2023**
https://github.com/facebook/react-native/pull/33468#issuecomment-1398249006

<details><summary>CLICK TO OPEN OLD VIDEO TEST CASES</summary>
<p>

**PR Branch - Android and iOS 24th June**
[88]: Android - accessibilityValue announces correctly with/out errorMessage set with onChangeText or with outside event (Fabric) ([link][88])

**PR Branch - Android**
[1]. Test Cases of the functionality (Fabric) ([link][1])
[2]. Test Cases of the functionality (Paper) ([link][2])

**Main Branch**
[6]. Android - Runtime Error in main branch when passing value of 1 to TextInput  placeholder prop ([link][6])

**Issues Solved**
[7]. TalkBack error does not clear error on the next typed character when using onChangeText ([link][7])
**Other Tests**
[8]. Setting the TextInput errorMessage state with setTextAndSelection Java API from JavaScript ([link][8])
[9]. Setting the TextInput errorMessage state from fabric TextInput internal state to Java ReactTextUpdate API ([link][9])

</p>
</details>

[1]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1072101477 "Test Cases of the functionality (Android - Fabric)"
[2]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1105964322 "Test Cases of the functionality (Android - Paper)"
[3]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1116329282 "Test Cases of the functionality (iOS - Fabric)"
[6]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1087020844 "Runtime Error in main branch when passing value of 1 to TextInput  placeholder prop"
[7]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1096086753 "TalkBack error announcement done on next typed character with onChangeText"
[8]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1082594363 "setting the TextInput errorMessage state with setTextAndSelection Java API from JavaScript"
[9]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1082598745 "Setting the TextInput errorMessage state from fabric TextInput internal state to Java ReactTextUpdate API"

[10]: https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo#setError(java.lang.CharSequence) "AOSP setError"
[11]: https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo#setError(java.lang.CharSequence) "AccessibilityNodeInfo#setError"
[12]: https://github.com/aosp-mirror/platform_frameworks_base/blob/1ac46f932ef88a8f96d652580d8105e361ffc842/core/java/android/text/Editable.java#L28-L52 "Editable method replace"
[13]: https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo#setContentInvalid(boolean) "setContentInvalid"

[20]: https://github.com/facebook/react-native/commit/60b6c9be8e811241039a6db5dc906a0e88e6ba82 "draft implementation of android_errorMessage "
[21]: https://github.com/facebook/react-native/commit/012d92d0b7e5de2436f186cdbff32ba128e537d5 "add errorMessage to ReactTextUpdate and maybeSetAccessibilityError"
[22]: https://github.com/fabriziobertoglio1987/react-native/commit/cad239bded5748753cee2266c27809e24c6199fb "rename android_errorMessage to errorMessageAndroid"
[23]: https://github.com/fabriziobertoglio1987/react-native/commit/0bae47434ef79eb606c453c5be8105b8df00783a "TextInput: keep C++ state in-sync with updated AttributedStrings in Java"
[24]: https://github.com/fabriziobertoglio1987/react-native/commit/0556e86d09404105dc7ff695686b8b7c01911c5c "TextInput: support modifying TextInputs with multiple Fragments (Cxx side)"
[25]: https://github.com/fabriziobertoglio1987/react-native/commit/7ab5eb4cafdea695c4c53ce2a737f6302afd6380 "AndroidTextInput: support using commands instead of setNativeProps (native change)"
[26]: https://github.com/fabriziobertoglio1987/react-native/commit/b9491b7c5104066b2714045cd7710f995458c9e9 "TextInput: support editing completely empty TextInputs"
[27]: https://github.com/fabriziobertoglio1987/react-native/commit/7f1ed6848f89bdccc7f7a5cc76019eec67e76b2f "Fabric: convertRawProp was extended to accept an optional default value"
[28]: https://github.com/facebook/react-native/commit/6e0fa5f15eef71abcfb47750eb3669065ba2ab7d "Support optional types for C++ TurboModules"
[29]: https://github.com/fabriziobertoglio1987/react-native/commit/baa66f63d8af2b772dea8ff8eda50eba264c3faf "Announce accessibility state changes happening in the background"

[30]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1071989570 "Change of error state from onChangeText show/hides a TextInput error"
[31]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1074827746 "understanding onChangeText callback"
[32]: https://github.com/facebook/react-native/issues/29063#issuecomment-658189938 "Explanation on how TextInput calls SET_TEXT_AND_SELECTION in Java API"
[33]: https://github.com/facebook/react-native/pull/33468#discussion_r835036889 "Explanation of TextInput state management with fabric C++ and JAVA API"
[34]: https://github.com/facebook/react-native/pull/33468#discussion_r835036889 "state updates between fabric and ReactAndroid for the TextInput component"
[35]: https://reactnative.dev/architecture/render-pipeline#react-native-renderer-state-updates "ReactNative renderer state updates"
[35]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1080144483 "Analysis on how AndroidTextInputState.cpp sends updates to ReactTextInputManager"
[36]: https://github.com/facebook/react-native/pull/33468#discussion_r848162849 "discussion on using announceForAccessibility in ReactEditText"
[37]: https://github.com/fabriziobertoglio1987/react-native/commit/29eb632f1cb2ef5459253783eac43e5d7e999742 "Refactor MountingManager into MountingManager + SurfaceMountingManager"
[38]: https://github.com/fabriziobertoglio1987/react-native/commit/733f2285067de401b925195266f4cec84c3f7fef "Diff C++ props for Android consumption"
[39]: https://github.com/fabriziobertoglio1987/react-native/commit/91b3f5d48aa1322046b8c5335f8e2e1a5e702b67 "This diff implement and integrates Mapbuffer into Fabric text measure system"

[40]: https://github.com/facebook/react-native/pull/29070 "[Android] Fix letters duplication when using autoCapitalize https://github.com/facebook/react-native/issues/29070"

[50]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12  "Notes from work on iOS/Android: Text input error for screenreaders https://github.com/facebook/react-native/issues/12"
[51]: https://github.com/facebook/react-native/issues/30848 "iOS/Android: Text input error for screenreaders https://github.com/facebook/react-native/issues/30848"
[52]: https://github.com/facebook/react-native/issues/30859 "Android: Error state change (text inputs) https://github.com/facebook/react-native/issues/30859"

[61]: https://github.com/facebook/react-native/pull/33468/commits/eb33c933c8bcb9a8421a6acdb7a51f261121be45 "fix annoucement delayed to next character"

[70]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1116966512 "iOS - Paper renderer does not update the accessibilityValue"
[71]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1124631221 "Test Cases of the functionality (Fabric) after removing changes to .cpp libs"
[72]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1124892802 "Test Cases of the functionality (Paper) after removing changes to .cpp libs"
[73]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1132830758 "iOS - announcing error onChangeText and screenreader focus"
[74]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1150657065 "iOS - The screenreader announces the TextInput value after the errorMessage is cleared"
[75]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/12#issuecomment-1152285978 "iOS - Exception thrown while executing UI block: - [RCTTextView setOnAccessibiltyAction:]: unrecognized selector sent to instance (Paper) (main branch)"
[76]: https://github.com/facebook/react-native/issues/30859#issuecomment-1158790381 "iOS - announce lastChar (not entire text) onChangeText and avoid multiple announcements (Fabric)"
[77]: https://github.com/facebook/react-native/issues/30859#issuecomment-1158794863 "iOS - announces or does not announce the accessibilityError through Button onPress (not onChangeText) (Fabric)"
[78]: https://github.com/facebook/react-native/issues/30859#issuecomment-1158797801 "iOS - the error is announced with accessibilityInvalid true and does not clear after typing text (onChangeText) (Fabric)"
[79]: https://github.com/facebook/react-native/issues/30848#issuecomment-1162799299 "iOS - Exception thrown while executing UI block: - RCTUITextView setAccessibilityErrorMessage:]: unrecognized selector sent to instance (iOS - Paper on main branch)"

[80]: https://github.com/fabriziobertoglio1987/react-native/commit/e13b9c6e49480e8262df06b7c1e99caab74e801f "RCTTextField was spliited into two classes"
[81]: https://github.com/fabriziobertoglio1987/react-native/commit/ee9697e5155aa972564d5aac90ceeb9db100750d "Introducing RCTBackedTextInputDelegate"
[82]: https://github.com/fabriziobertoglio1987/react-native/commit/2dd2529b3ab3ace39136a6e24c09f80ae421a17e "Add option to hide context menu for TextInput"
[83]: https://github.com/fabriziobertoglio1987/react-native/blob/343eea1e3150cf54d6f7727cd01d13eb7247c7f7/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm#L48-L72 "RCTParagraphComponentAccessibilityProvider accessibilityElements"
[84]: https://github.com/fabriziobertoglio1987/react-native/blob/c8790a114f6f21774c43f0e9b9210e7b35d1c243/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm#L613 "RCTTextInputComponentView method _setAttributedString"
[85]: https://github.com/fabriziobertoglio1987/react-native/blob/c8790a114f6f21774c43f0e9b9210e7b35d1c243/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm#L146 "RCTTextInputComponentView method updateProps"
[86]: https://github.com/fabriziobertoglio1987/react-native/blob/c8790a114f6f21774c43f0e9b9210e7b35d1c243/Libraries/Text/TextInput/RCTBaseTextInputView.m#L150 "RCTBaseTextInputView setAttributedText"
[87]: https://github.com/facebook/react-native/issues/30859#issuecomment-1165395361 "iOS - accessibilityValue announces correctly with/out errorMessage set with onChangeText or with outside event"
[88]: https://github.com/facebook/react-native/issues/30859#issuecomment-1165398153 "Android - accessibilityValue announces correctly with/out errorMessage set with onChangeText or with outside event"
[89]: https://github.com/facebook/react-native/issues/30859#issuecomment-1165413245 "iOS - accessibilityValue announces correctly with/out errorMessage set with onChangeText or with outside event (Fabric)"

[100]: https://github.com/fabriziobertoglio1987/react-native/commit/110b191b14e3cb692bb6a33f0f129b4f0215f9a6 "Refactor ViewPropsMapBuffer -> general MapBuffer props mechanism"
[101]: https://github.com/fabriziobertoglio1987/react-native/commit/22b6e1c8ec0e69700e9142cf5c9c1ab1e6a84b78 "In this diff I'm shipping and deleting mapBufferSerialization for Text measurement"

Reviewed By: blavalla

Differential Revision: D38410635

Pulled By: lunaleaps

fbshipit-source-id: cd80e9a1be8f5ca017c979d7907974cf72ca4777
2023-02-28 16:05:57 -08:00
Jerry ed39d639ea Fix/animated lists types (#36292)
Summary:
I was working on `Animated.FlatList` and found some types missing as below

![Screen Shot 2023-02-25 at 4 32 43 PM](https://user-images.githubusercontent.com/64301935/221345457-74252131-5207-4e17-ad96-92221a915305.png)

also `Animated.SectionList`

![Screen Shot 2023-02-25 at 4 31 34 PM](https://user-images.githubusercontent.com/64301935/221345679-07ba862b-708e-400e-ac14-7d2156fcc1e8.png)

So I refactored type definition for `Animated.FlatList` and `Animated.SectionList` using `abstract class`.

## Changelog

[GENERAL] [FIXED] - add missing FlatList types for Animated FlatList
[GENERAL] [FIXED] - add missing SectionList types for Animated SectionList

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

Test Plan: Ran `yarn test-typescript` and `yarn test-typescript-offline` with no errors.

Reviewed By: lunaleaps

Differential Revision: D43673884

Pulled By: NickGerleman

fbshipit-source-id: 7ccab5997fa2f22226fb0e106672cee98e568ba4
2023-02-28 15:17:21 -08:00
Saad Najmi d4b228b956 Support Slide Over and Split View on iPad (#36255)
Summary:
Context: We have been looking at more multi-window on iPad bugs and issues for React Native. One is that the default test app currently doesn't support SlideOver / Split View / MultiWindow. This change should support the first two of those configurations.

This mirrors a change we had done in React Native Test App: https://github.com/microsoft/react-native-test-app/pull/1032/
In order to support Slide Over and Split View on iPad, the app must support all 4 orientations.

Note, this does not support multi-window, which would require RNTester to be refactored to use a `SceneDelegate`. React Native Test app already does this: https://github.com/microsoft/react-native-test-app/blob/trunk/ios/ReactTestApp/SceneDelegate.swift

## Changelog

[INTERNAL] [CHANGED] - Support Slide Over and Split View on iPad for RNTester

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

Test Plan:
Ran RNTester and tested both configurations.

https://user-images.githubusercontent.com/6722175/220747910-9bf43d10-055e-4d46-a98c-5e3b24641700.mov

Reviewed By: NickGerleman

Differential Revision: D43655607

Pulled By: javache

fbshipit-source-id: 4829a11accaddacc6ffa4cc77fb2f54a26f08382
2023-02-28 13:46:02 -08:00
Steve Alves-Blyt 32d03c250c Add missing type objectFit prop in image style type definition (#36249)
Summary:
Following the [`initial commit`](https://github.com/facebook/react-native/commit/b2452ab216e28e004dc625dd8e1ad32351a79be9), the `objectFit` property have been implemented. However, it is not declared in the Typescript type files, making it unknown to the typescript compiler. Thus, when using this property in Typescript, we have the following issue:

![Capture d’écran 2023-02-22 à 14 52 04](https://user-images.githubusercontent.com/29439916/220639885-947dddb1-5e6f-4f60-b423-882ade29ac5a.png)

Then, the purpose of this PR is to fix that by adding the missing property to the `ImageStyle` interface defined in the`StyleSheetTypes.d.ts` file.

## Changelog

[GENERAL][FIXED] Add objectFit to the ImageStyle interface located in the StyleSheetTypes.d.ts file

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

Test Plan:
To test it, create/use a typescript file and call the `Image` component with a `style` property. Then, check if the autocompletion provides you the right properties with the right type. For example:

![Capture d’écran 2023-02-22 à 14 34 58](https://user-images.githubusercontent.com/29439916/220636819-4c0d80dc-bc3a-468d-bcfc-782e038918ca.png)
![Capture d’écran 2023-02-22 à 14 35 46](https://user-images.githubusercontent.com/29439916/220636863-76a84122-0cdb-4d5d-8edf-309ed7c876f7.png)

Reviewed By: NickGerleman, rshest

Differential Revision: D43665291

Pulled By: motiz88

fbshipit-source-id: bf136b8aeb9dd25ff0e696b747ef5805acf8028c
2023-02-28 12:03:08 -08:00
Luna Wei d504fb4145 Revert ESM imports
Summary:
Changelog: [Internal] - Remove all imports back to CJS for changelog in 0.72

We are reverting these imports as it may regress perf as we don't have a recommended inlining solution for ES modules at the current time.

Reviewed By: NickGerleman

Differential Revision: D43630911

fbshipit-source-id: ff3bb80009f327c4d51dad21f2cd287ce46d5964
2023-02-28 10:23:36 -08:00
Nicola Corti 4b8b9cc838 AGP to 7.4.2
Summary:
This is just a minor bump before 0.72 and it brings AGP up to date
with the latest stable.

allow-large-files

Changelog:
[Internal] [Changed] - AGP to 7.4.2

Reviewed By: cipolleschi

Differential Revision: D43659180

fbshipit-source-id: d57ea8fb6ae902412b542e0125d3b15168d0e123
2023-02-28 08:39:21 -08:00
Nicola Corti d56bd115fa Do not attempt to comment on PRs when on forks (#36316)
Summary:
I'm gating this workflow to run only upstream as I'm receiving notifications that it fails on my fork. We don't want to run this workflow on forks at all hence we can add a `if:` there.

## Changelog

[INTERNAL] - Do not attempt to comment on PRs when on forks

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

Test Plan: If Github Actions UI is green, we're good to go

Reviewed By: cipolleschi

Differential Revision: D43657315

Pulled By: cortinico

fbshipit-source-id: 8fb260d142a43375bd9a3b10eac235550a6aecb0
2023-02-28 07:36:06 -08:00
Riccardo Cipolleschi 0f56cee8e1 Update Gemfile to require Cocoapods 1.12.0 (#36321)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36321

This change bumps Cocoapods to 1.12.0. This last release fixes a bug for which cocoapods was not working with Ruby 3.2.0

## Changelog
[iOS][Changed] - Bumbed version of Cocoapods to support Ruby 3.2.0

Reviewed By: blakef

Differential Revision: D43655787

fbshipit-source-id: 6954ac8271daa7894e57f6d6104ed4d549490695
2023-02-28 07:14:02 -08:00
Ruslan Shestopalyuk 95e20ed9a6 Refactor Android/iOS/C++ TurboModule examples in RNTester/Catalyst
Summary:
## Changelog:

[Internal] - Refactor Android/iOS/C++ TurboModule examples

~~This makes sure that both native and pure C++ (NativeCxx) TurboModule examples could be run from the Catalyst app.~~

EDIT: See the discussion - this removes the `Playground (NativeModules)` app from Catalyst, as it's already available from the `RNTester Browser` and doesn't provide the C++ counterpart.

Also, there are some tweaks and code factoring in styles, to make it all fit on the screen nicely.

Reviewed By: javache

Differential Revision: D43605250

fbshipit-source-id: 44ee694660f3ad524b8362149ebe617ee495225e
2023-02-28 06:31:49 -08:00
Birkir Gudjonsson c18566ffdb Appearance.setColorScheme support (revisited) (#36122)
Summary:
Both Android and iOS allow you to set application specific user interface style, which is useful for applications that support both light and dark mode.

With the newly added `Appearance.setColorScheme`, you can natively manage the application's user interface style rather than keeping that preference in JavaScript. The benefit is that native dialogs like alert, keyboard, action sheets and more will also be affected by this change.

Implemented using Android X [AppCompatDelegate.setDefaultNightMode](https://developer.android.com/reference/androidx/appcompat/app/AppCompatDelegate#setDefaultNightMode(int)) and iOS 13+ [overrideUserInterfaceStyle](https://developer.apple.com/documentation/uikit/uiview/3238086-overrideuserinterfacestyle?language=objc)

```tsx
// Lets assume a given device is set to **dark** mode.

Appearance.getColorScheme(); // `dark`

// Set the app's user interface to `light`
Appearance.setColorScheme('light');

Appearance.getColorScheme(); // `light`

// Set the app's user interface to `unspecified`
Appearance.setColorScheme(null);

Appearance.getColorScheme() // `dark`
 ```

## Changelog

[GENERAL] [ADDED] - Added `setColorScheme` to `Appearance` module

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

Test Plan:
Added a RNTester for the feature in the Appearance section.

Three buttons for toggling all set of modes.

Reviewed By: lunaleaps

Differential Revision: D43331405

Pulled By: NickGerleman

fbshipit-source-id: 3b15f1ed0626d1ad7a8266ec026e903cd3ec46aa
2023-02-28 05:28:38 -08:00
Ruslan Shestopalyuk 14ab76ac30 Hoist responsibility for clearMarks/Measures to NativePerformanceObserver (#36312)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36312

## Changelog:

[Internal] -

`clearMarks` and `clearMeasures` methods are incidental to the `NativePerformance` TurboModule functionality, as in reality this responsibility belongs more on the `NativePerformanceObserver` and `PerformanceEntryReporter` side.

This is something that [the standard indirectly suggests](https://www.w3.org/TR/user-timing/#clearmarks-method) as well (referencing [performance entry buffer](https://www.w3.org/TR/performance-timeline/#dfn-performance-entry-buffer)).

The new implementation should be also a little bit more efficient, as it avoids calling the predicate for each entry.

Finally (and frankly, the main reason for this change, from my perspective), it will simplify mocking/testing the JS part of the PerfAPI code.

Reviewed By: rubennorte

Differential Revision: D43621174

fbshipit-source-id: c4217a0da1d8ecbce797240627f7b4f057d85b97
2023-02-28 04:10:32 -08:00
Lorenzo Sciandra 5112bc5dbc chore(dependencies): bump CLI to 11 alpha2 and metro to 0.75.1 (#36271)
Summary:
Ahead of cut of RN 0.72, I'm upgrading CLI and Metro according to https://github.com/react-native-community/cli/releases/tag/v11.0.0-alpha.2

~While working on it, I noticed that run-ios has some changes that make the e2e test script not work super well, so I'll be checking in with the CLI team to figure out what's wrong. Let's not merge it until that's address it. (also, there's already a bump for Metro that we need https://github.com/react-native-community/cli/commit/8d18baef554423904c036cbeaa5a1ea92603ff5d so I'll probably change the version to latest CLI and Metro once more)~ (all addressed)

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

[GENERAL] [CHANGED] - bump CLI to 11 alphav2 and metro to 0.75.1

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

Test Plan: Test CI, and locally I've used the e2e test script to ensure everything still works.

Reviewed By: NickGerleman

Differential Revision: D43625952

Pulled By: cipolleschi

fbshipit-source-id: dad940b65c56a586ae82acc2e7c16a918b872ee5
2023-02-28 03:18:06 -08:00
Tomek Zawadzki 8d0b5af1fc Run commit hooks before layout calculation (#36216)
Summary:
I've noticed that `UIManagerCommitHooks` are applied after calling `layoutIfNeeded`, meaning that if a commit hook makes some changes to the tree, it needs to calculate the layout again, effectively making the first calculation redundant.

This PR swaps the order of these two operations and moves `shadowTreeWillCommit` call before `layoutIfNeeded`. Thanks to this change, commit hooks don't need to manually trigger layout calculations as well as can potentially operate on unsealed nodes which can make it more efficient in some cases.

Finally, this PR eliminates a crash on `emitLayoutEvents(affectedLayoutableNodes);` when commit hook actually modifies the tree and thus de-allocates old shadow nodes.

cc sammy-SC

## Changelog

[GENERAL] [CHANGED] - Run commit hooks before layout calculation

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

Test Plan: The only `UIManagerCommitHook` I could find in the OSS repo is [`TimelineController`](https://github.com/facebook/react-native/blob/8bd3edec88148d0ab1f225d2119435681fbbba33/ReactCommon/react/renderer/timeline/TimelineController.h#L26).

Reviewed By: cipolleschi

Differential Revision: D43569407

Pulled By: sammy-SC

fbshipit-source-id: 9ab1de0954cac2eb00346be7af8c9b3572bd2c88
2023-02-28 01:28:26 -08:00
Marc Rousavy 987dd6a358 fix: Support 120 FPS in RCTFPSGraph (#35543)
Summary:
Currently the `RCTFPSGraph` component is hardcoded/capped at a Frame Rate of 60.

Since there are phones that support more than 60 FPS (newer iPhones can do 120 FPS), and there might be other use-cases for the RCTFPSGraph (I use it in VisionCamera to show Camera FPS), this PR changes the scale to also support higher FPS by adjusting it on the fly (when a new maximum arrives)

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

[iOS] [Fixed] - Support 120 FPS or more in `RCTFPSGraph`

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

Test Plan:
Before:

![IMG_1075](https://user-images.githubusercontent.com/15199031/205340761-12954d36-82dd-4102-868a-b7234fdfc21c.jpg)

After:

![IMG_1074](https://user-images.githubusercontent.com/15199031/205340790-092bfa57-c291-418b-9ce3-2a8d2389436a.jpg)

Reviewed By: rshest

Differential Revision: D43573750

Pulled By: sammy-SC

fbshipit-source-id: 7d64fcee35c0c29dfb618f1f02945584d1cab1e0
2023-02-28 01:27:38 -08:00
Nicola Corti 81dd3afe0b Bump Gradle to 8.x (#36269)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36269

This bumps our project to build on Gradle 8.x
All the necessary issues have already been resolved so everything should be green.
Gradle version has been bumped also inside the template and RNGP.

Changelog:
[Android] [Changed] - Bump Gradle to 8.x

allow-large-files

Reviewed By: cipolleschi

Differential Revision: D43534184

fbshipit-source-id: ca1fd6799ff6d776743de2b2d809fc54bc533440
2023-02-27 13:47:09 -08:00
Riccardo Cipolleschi 7620509b89 Restore Geometry.h with a deprecation message
Summary:
In [this commit](https://github.com/facebook/react-native/commit/e6cba997443ad72961cee1eee39346f80b48184e), we renamed `Geometry.h` to `Vector.h`.
This is the last change of a series of updates that progressively altered the shape of `Geometry.h` from its [original version](https://github.com/facebook/react-native/blob/0.71-stable/ReactCommon/react/renderer/graphics/Geometry.h).

This is a breaking change as several libraries in the OSS are depending on Geometry.h and we removed it without deprecating it.
This change aims to put the file back, with a deprecation message, so that we can safely remove it in the next version.

## Changelog
[General][Fixed] - Restore Geometry.h to avoid breaking change

Reviewed By: cortinico

Differential Revision: D43621983

fbshipit-source-id: 96b976901f7ec337f2ec64c592e4b4d19d89ab11
2023-02-27 11:24:15 -08:00
Nicola Corti b360109e05 RNGP - Add apiVersion/languageVersion to 1.5 (#36311)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36311

Currently, we get the apiVersion/languageVersion for Kotlin that Gradle carries over.
So what happens is that on older version of Gradle, we try to compile RNGP with older versions of Kotlin.

There we have some functions missing (like `.uppercase()`) and the user will fail to build because of this.

Here I'm setting `apiVersion` and `languageVersion` to Kotlin 1.5. Even if we compile with Kotlin 1.7,
the compiler will make sure our code is compatible to be executed in a Kotlin 1.5 environment.

Fixes #36246

Changelog:
[Internal] [Changed] - RNGP - Add apiVersion/languageVersion to 1.5

Reviewed By: cipolleschi

Differential Revision: D43621083

fbshipit-source-id: d74700ff7ef7ac9691965626c2bd0128459fec9b
2023-02-27 11:01:08 -08:00
Nick Gerleman c2a089fddf Better ShadowNode memory safety (#36258)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36258

This fixes a few instances where YogaLayoutableShadowNode (or general shadownode casting) could offer better memory safety.

1. The reference form of traitCast() now terminates on invalid cast, instead of debug assert, since it is better to crash in production than to corrupt memory (which will crash somewhere later, in a much more confusing way).
2. We use traitCast() in more places where we previously would static_cast. This means needing to formally add a mutable version.
3. We bounds-check yoga children access in a single place by using `std::vector` `at()` instead of `[]`.
4. Removed `Trait::UnreservedTrait1` API, since multiple libraries using it can collide and we lose the memory safety benefits of `traitCast`.

This change is in response to a bug where `YogaLayoutableShadowNode` may perform an invalid `static_cast` of `RawTextShadowNode` if a text or number is rendered directly inside of a `<View>` (instead of a `<Text>` element).

This does not yet fix the underlying logic of YogaLayoutableShadowNode to act gracefully when a RawTextShadowNode makes its way into children. We just terminate, instead of corrupting memory.

Changelog:
[General][Breaking] -  Better Fabric ShadowNode Memory Safety (Removes `Trait::UnreservedTrait` API)

Reviewed By: javache

Differential Revision: D43271779

fbshipit-source-id: 727c1230f72664bf4d261871c66ca61ddf0d5ffa
2023-02-27 10:07:51 -08:00
Nicola Corti de4ed0ddfc Reduce breaking changes with DefaultReactActivityDelegate (#36310)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36310

As part of the preparation for 0.72, this reduces the amount of breaking changes we expose in the template for the user.
Specifically it re-introduces the 4 param ctor for `DefaultReactActivityDelegate` and marking it with Deprecated,
so the build log and the IDE will instruct the user to move away from it (if they forgot to follow the upgrade helper).

Changelog:
[Internal] [Changed] - Reduce breaking changes with DefaultReactActivityDelegate

Reviewed By: cipolleschi

Differential Revision: D43619184

fbshipit-source-id: a98f7c67201a2860e7c2221e646f45f1ebec4678
2023-02-27 09:26:58 -08:00
acton393 446a412459 Add print yoga node AllEdge value when debug mode (#948)
Summary:
add print yoga node AllEdge value when debug mode, the old logic just print four edgeValue including top left bottom and right

but when we set the same value to these edge, we use YGAllEdge, this will be more convenient debug code

so I open this pull request to add it

X-link: https://github.com/facebook/yoga/pull/948

Reviewed By: cortinico

Differential Revision: D43525328

Pulled By: NickGerleman

fbshipit-source-id: 59dde363e6ee8433d10ecf27e440ea7d54000bc1
2023-02-27 08:20:29 -08:00
Nick Gerleman 59157b87fd Back out "feat: Add iOS Paper implementation of inset logical properties"
Summary:
This backs out https://github.com/facebook/react-native/pull/36241 for causing screenshot failures in an app still using Paper.

Changelog:
[iOS][Removed] - Back out "[react-native][PR] feat: Add iOS Paper implementation of inset logical properties"

Reviewed By: motiz88, rshest

Differential Revision: D43621612

fbshipit-source-id: 0fc01d6c6ae5c5bfb2813bd60b25e9315e42e3c3
2023-02-27 07:43:50 -08:00
Ruslan Shestopalyuk 4fd15c4ae7 Fix various JS linter warnings (#36307)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36307

[Changelog][Internal]

Noticed some JS linter warnings during CircleCI tests being run, this disturbed my OCD, so here's a fix for them.

Reviewed By: cipolleschi

Differential Revision: D43619403

fbshipit-source-id: 779a1d2e197298275d06a2597cfef7554017016f
2023-02-27 07:38:43 -08:00
Ruslan Shestopalyuk b108cbbff8 Use emitDeviceEvent in core ReactAndroid code (#36280)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36280

[Changelog][Internal]

As a follow-up to adding `ReactContext.emitDeviceEvent` (D43534174 (https://github.com/facebook/react-native/commit/a8f0a4dc626508ba3f1e629df5f9a24e43b6e150)) this makes it used in the OSS part of RN.

Reviewed By: NickGerleman

Differential Revision: D43494167

fbshipit-source-id: c3d56bde53fb1ce1297a48597b97470ff10f4dc0
2023-02-27 07:34:15 -08:00
Riccardo Cipolleschi ad686b0ce1 Reduce breaking changes in use_frameworks! (#36305)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36305

This change automate settings some search paths for 3rd parties libraries that are not using our `install_modules_dependencies` helper.

This will make the `use_frameworks!` changes less breaking.

## Changelog:
[iOS][Changed] - Automatically update Search Path on pods

Reviewed By: dmytrorykun

Differential Revision: D43596808

fbshipit-source-id: 9c5d7ff60a1e4cf73afbfd70b2499f03825cd764
2023-02-27 06:47:46 -08:00
Riccardo Cipolleschi 05438c3387 Update Offline mirror and legocastle script
Summary:
This change updates the Offline mirrors so that the `react-native-oss-ios` jobs pass.

It also updates the legocastle script so that it won't check for a specific version of Ruby as right now we decided to support multiple versions.

allow-large-files

## Changelog
[internal] - update iOS mirrors and legocastle

Reviewed By: cortinico, rshest

Differential Revision: D43619512

fbshipit-source-id: dcd95318de72e0dca159da98ead0ef0f375197c1
2023-02-27 04:35:10 -08:00
Ruslan Shestopalyuk a8f0a4dc62 Ability to directly emit device events on Android/Java side (#36279)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36279

[Changelog][Internal]

To have a symmetry with the [corresponding C++ API for TurboModules](https://www.internalfb.com/code/fbsource/[929870c905c8fe68cb330ce96bda7eb703bb6ae6]/xplat/js/react-native-github/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.h?lines=90), this adds a helper method `ReactContext.emitDeviceEvent`, which allows to send device events to JS (`RCTDeviceEventEmitter.emit`).

This also allows for less boilerplate code and better discoverability.

See the next diff in stack for the application.

## Changelog

[Android][Added] ReactContext now has a method emitDeviceEvent, which can be used to send device events to RCTDeviceEventEmitter on the JavaScript side

Reviewed By: NickGerleman

Differential Revision: D43534174

fbshipit-source-id: 229f45575bf0c505af4a3baa8f7337821c70cc1c
2023-02-27 03:34:50 -08:00
gabrieldonadel 5ff8895c27 chore: Create Codegen throwIfPartialWithMoreParameter function (#36300)
Summary:
This PR creates a Codegen `throwIfPartialWithMoreParameter` function and extracts the error-emitting code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L165-L169) and [Typescript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L246-L250) index files as requested on https://github.com/facebook/react-native/issues/34872. This also adds unit tests to the new function.

## Changelog

[Internal] [Changed]  - Create codegen `throwIfPartialWithMoreParameter` function and extract the `error-emitting` code from Flow and Typescript index files.

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

Test Plan:
Run `yarn jest react-native-codegen` and ensure CI is green
![image](https://user-images.githubusercontent.com/11707729/221445922-b2c21ad2-012e-4266-9456-6c781b0de7f0.png)

Reviewed By: cipolleschi

Differential Revision: D43616254

Pulled By: rshest

fbshipit-source-id: 4742aec56598be6bac895809b96d0879c37fcfe1
2023-02-27 03:24:55 -08:00
Jeffrey Beauchamp 6e28e2dc99 Back out "Use NSCAssert() in react_native_assert instead of C assert()"
Summary:
Original commit changeset: 43c4e4f1ae6b

Original Phabricator Diff: D43275024 (https://github.com/facebook/react-native/commit/c5bc3f1373d223d4068f762c597bdc45261fb6c5)

D43587488 reverted D43275024 (https://github.com/facebook/react-native/commit/c5bc3f1373d223d4068f762c597bdc45261fb6c5), but it was only committed to the fbobjc/releases/release-fbios-2023.03.01 branch (v404).

We still aren't seeing successful fbios-pika-iphoneos-release builds for v405 (https://fburl.com/mobile/7zac3b5w). This is preventing QA and employee dogfooding of v405 (S325502).

(Note: this ignores all push blocking failures!)

Reviewed By: abashyam

Differential Revision: D43609260

fbshipit-source-id: d411294ad8cdb22ff9e812bf0689d9b7bdff8d2e
2023-02-26 10:24:40 -08:00
Riccardo Cipolleschi e57b6d11fa Remove .ruby-version and update Gemfile to support multiple versions of Ruby (#36281)
Summary:
This Change remove the need to have a specific version of Ruby installed. We are now supporting a wider range of Ruby versions, starting from Ruby 2.6.10 (the ruby installed on MacOS by default).
We are still using a Gemfile to control the version of cocoapods that needs to be installed.

## Changelog

[IOS] [CHANGED] - Remove `.ruby-version` and update Gemfile to support a wider range of Ruby versions

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

Test Plan:
- Tested locally on RNTester and an app from template, switch across different versions of Ruby
- CircleCI is green on the commit

Reviewed By: cortinico

Differential Revision: D43567660

Pulled By: cipolleschi

fbshipit-source-id: e7edfe5806a898a83ba39cb58b1318ebde56a57c
2023-02-26 09:32:28 -08:00
Nick Gerleman febf6b7f33 Constrain data type in getItemLayout callback (#36237)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36237

This changes the data parameter type for `getItemLayout` from a mutable array (too lenient, even before), to `ArrayLike`, which is now the most constrained subset of data which may be passed to a FlatList.

We could do something more exact by adding another generic parameter to FlatList, but that would be likely be noticeably more breaking, since during testing I couldn't manage a pattern that both kept the same minimum number of generic arguments while keeping inference working.

Changelog:
[General][Breaking] - Constrain data type in `getItemLayout` callback

Reviewed By: javache

Differential Revision: D43466967

fbshipit-source-id: 7a1ce717e7d5cc96a58b8d3ad9def6cf6250871f
2023-02-24 16:19:14 -08:00
Nick Gerleman c03de97fb4 Make FlatList permissive of ArrayLike data (#36236)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36236

D38198351 (https://github.com/facebook/react-native/commit/d574ea3526e713eae2c6e20c7a68fa66ff4ad7d2) addedd a guard to FlatList, to no-op if passed `data` that was not an array. This broke functionality where Realm had documented using `Realm.Results` with FlatList. `Real.Results` is an array-like JSI object, but not actually an array, and fails any `Array.isArray()` checks.

This change loosens the FlatList contract, to explicitly allow array-like non-array entities. The requirement align to Flow `ArrayLike`, which allows both arrays, and objects which provide a length and indexer. Flow `$ArrayLike` currently also requires an iterator, but this is seemingly a mistake in the type definition, and not enforced.

Though `Realm.Results` has all the methods of TS `ReadonlyArray`, RN has generally assumes its array inputs will pass `Array.isArray()`. This includes any array props still being checked [via prop-types](https://github.com/facebook/prop-types/blob/044efd7a108556c7660f6b62092756666e39d74b/factoryWithTypeCheckers.js#L548).

This change intentionally does not yet change the parameter type of `getItemLayout()`, which is already too loose (allowing mutable arrays). Changing this is a breaking change, that would be disruptive to backport, so we separate it into a different commit that will be landed as part of 0.72 (see next diff in the stack).

Changelog:
[General][Changed] - Make FlatList permissive of ArrayLike data

Reviewed By: yungsters

Differential Revision: D43465654

fbshipit-source-id: 3ed8c76c15da680560d7639b7cc43272f3e46ac3
2023-02-24 16:19:14 -08:00
gabrieldonadel 33d4e2d617 feat: Add iOS Paper implementation of inset logical properties (#36241)
Summary:
This PR adds Paper support to `inset` logical properties on iOS as requested on https://github.com/facebook/react-native/issues/34425. This implementation includes the addition of the following style properties

- `inset`, equivalent to `top`, `bottom`, `right` and `left`.
- `insetBlock`, equivalent to `top` and `bottom`.
- `insetBlockEnd`, equivalent to `bottom`.
- `insetBlockStart`, equivalent to `top`.
- `insetInline`, equivalent to `right` and `left`.
- `insetInlineEnd`, equivalent to `right` or `left`.
- `insetInlineStart`, equivalent to `right` or `left`.

Android changes are in a separate PR to facilitate code review https://github.com/facebook/react-native/pull/36242

## Changelog

[IOS] [ADDED] - Add Paper implementation of inset logical properties

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

Test Plan:
1. Open the RNTester app and navigate to the `View` page
2. Test the new style properties through the `Insets` section

![image](https://user-images.githubusercontent.com/11707729/220512607-a1d89dbe-64db-4140-9fdb-f9d7897fe3bd.png)

Reviewed By: lunaleaps

Differential Revision: D43525110

Pulled By: NickGerleman

fbshipit-source-id: b70b0ef183dcf192b2c3547422bbe161b7bdba50
2023-02-24 16:00:06 -08:00
Harshika faba66b4b2 Fix: Remove extra slash in import path in requireNativeComponent.d.ts (#36244)
Summary:
Fixes: https://github.com/facebook/react-native/issues/36206

## Changelog

[GENERAL] [FIXED] - Remove extra slash in import path

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

Test Plan: CI should pass.

Reviewed By: cipolleschi

Differential Revision: D43573391

Pulled By: cortinico

fbshipit-source-id: a17b8ed260e06e3ec848e8246a20091394b0634e
2023-02-24 10:51:32 -08:00
Tarun Chauhan 371e263847 create throwIfPartialNotAnnotatingTypeParameter and add extractAnnotatedElement method in parsers (#36272)
Summary:
> Create a throwIfPartialNotAnnotatingTypeParameter function in the error-utils.js file and extract the error-emitting code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L174-L178) and [Typescript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L252-L259) index files. Notice that the way in which the annotatedElement is computed is different, therefore we should add an extractAnnotatedElement function to the Flow and TypeScript parsers.

Part of the Codegen ☂️ Issue https://github.com/facebook/react-native/issues/34872

## Changelog

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - create throwIfPartialNotAnnotatingTypeParameter and add extractAnnotatedElement method in parsers

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

Test Plan: `yarn jest react-native-codegen`

Reviewed By: cipolleschi

Differential Revision: D43564134

Pulled By: rshest

fbshipit-source-id: 89a6567340a560d7b6c353cfff8a43e2dd0f76cc
2023-02-24 08:00:20 -08:00
Ruslan Shestopalyuk e106a62b1a Add device event emit test for the sample C++ TurboModule (#36278)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36278

[Changelog][Internal]

The diff creates a test clause for [TurboModule::emitDeviceEvent C++ API for TurboModules](https://www.internalfb.com/code/fbsource/[929870c905c8fe68cb330ce96bda7eb703bb6ae6]/xplat/js/react-native-github/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.h?lines=90), which can be seen in either Catalyst or RNTester.

Reviewed By: cipolleschi

Differential Revision: D43466327

fbshipit-source-id: ff4c111b4beaab72b13d2bd89ed03023c9c7b3cf
2023-02-24 06:49:14 -08:00
Riccardo Cipolleschi bf03e86bc7 Use RNTester init also in the old arch when Fabric is enabled (#36283)
Summary:
This PR fixes the initialization path of RNTester when it is run with the Old Arch and Fabric enabled

## Changelog

[iOS][Fixed] - Make sure to initialize the contextContainer in the Old Arch with Fabric enabled

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

Test Plan:
Tested manually on RNTester
CircleCI is green

Reviewed By: sammy-SC

Differential Revision: D43568205

Pulled By: cipolleschi

fbshipit-source-id: cddba97629b542a044191da14221f3300a9d879f
2023-02-24 05:21:11 -08:00
Nicola Corti e79500e6a7 Add TraceUpdateOverlayComponentDescriptor to CoreComponentsRegistry (#36282)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36282

RN Tester is currently red as `TraceUpdateOverlay` is not registered in the Fabric Core Component Registry.

Changelog:
[Internal] [Changed] - Add TraceUpdateOverlayComponentDescriptor to CoreComponentsRegistry

Reviewed By: cipolleschi

Differential Revision: D43567915

fbshipit-source-id: ceb4b9b674a969f260caf810eade30ae23ce2ce8
2023-02-24 05:02:32 -08:00
Tommy Nguyen 346b028227 fix(ios): fix nullability warnings (#36247)
Summary:
While testing `use_frameworks! :linkage => :static`, I encountered nullability warnings that were previously suppressed because we always build with `-Werror`. I'm not sure why the suppressions no longer work, but they should just be fixed.

## Changelog

[IOS] [FIXED] - Fix nullability warnings

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

Test Plan: iOS build should succeed.

Reviewed By: cipolleschi

Differential Revision: D43531887

Pulled By: javache

fbshipit-source-id: cae0617a20c8d215042cf4c5be2cbb17c801bb41
2023-02-24 03:54:02 -08:00
Riccardo Cipolleschi a7f962c469 Update offline mirrors
Summary:
Update offline mirrors for iOS

allow-large-files

## Changelog: [internal]

Reviewed By: cortinico

Differential Revision: D43567454

fbshipit-source-id: 7711e6062d960d05d1ecd9fe77b3b4c1ea5f3070
2023-02-24 03:50:05 -08:00
Riccardo Cipolleschi 25d10f564a Back out "Replace callback for lambdas"
Summary:
We don't support Lambda in OSS yet, Lambdas were introduced as root of a stack of diffs, so we need to revert the whole stack

## Changelog:
[internal] - revert changes that broke CircleCI

Reviewed By: GijsWeterings

Differential Revision: D43566129

fbshipit-source-id: feae3c3065ed83463c9d887d7ff488c29993e0ae
2023-02-24 03:03:52 -08:00
Riccardo Cipolleschi e36fe691a1 Back out "Fix logic of removal of TMs cache"
Summary:
We don't support Lambda in OSS yet, Lambdas were introduced as root of a stack of diffs, so we need to revert the whole stack

## Changelog:
[internal] - revert changes that broke CircleCI

Reviewed By: GijsWeterings

Differential Revision: D43566121

fbshipit-source-id: 5c4fe8272ca220d8914eb64b3ab395589c007198
2023-02-24 03:03:52 -08:00
Riccardo Cipolleschi e969079216 Back out "Fix lints warnings in RN Android"
Summary:
We don't support Lambda in OSS yet, Lambdas were introduced as root of a stack of diffs, so we need to revert the whole stack

## Changelog:
[internal] - revert changes that broke CircleCI

Reviewed By: GijsWeterings

Differential Revision: D43566086

fbshipit-source-id: 95b8ed404edd6f711fbbb5ae3913010c653a2c28
2023-02-24 03:03:52 -08:00
Pranav Yadav 13628203ab Merge Flow and TS Parsers' IncorrectModuleRegistryCallArgumentTypeParserError error-emitting code (#36252)
Summary:
> [Codegen 83 - assigned to Pranav-yadav] Create a function throwIfIncorrectModuleRegistryCallArgumnent function in the errors.js file and factor together the code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L407-L415) and [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L513-L521). Update the Parsers to return the right Literl type

Merged `Flow` and `TS` Parsers' `IncorrectModuleRegistryCallArgumentTypeParserError` error-emitting code

- into `throwIfIncorrectModuleRegistryCallArgument` fun in `error-utils.js`

## Changelog

[INTERNAL] [CHANGED] -  Merge `Flow` and `TS` Parsers' `IncorrectModuleRegistryCallArgumentTypeParserError` error-emitting code

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

Test Plan: - `yarn test`

Reviewed By: rshest

Differential Revision: D43502843

Pulled By: cipolleschi

fbshipit-source-id: eb63b40d433f90134a80c02c8f750257c82104a3
2023-02-24 02:56:34 -08:00