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

7450 Коммитов

Автор SHA1 Сообщение Дата
Jean-Baptiste LARRIVIERE b314e6f147 feat: add initialProps property to RCTAppDelegate (#35848)
Summary:
Hi there,

While upgrading to 0.71 we realised the RCTAppDelegate doesn't offer a way to set custom `initProps` that would depend on `launchOptions`.

This PR adds an `initialProps` property to the RCTAppDelegate. This would let us set this property based on `launchOptions` in our implementation of `didFinishLaunchingWithOptions` before calling `[super didFinishLaunchingWithOptions]`

Thanks !

## Changelog

[IOS] [ADDED] - Add `initialProps` property to `RCTAppDelegate`

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

Reviewed By: rshest

Differential Revision: D42543027

Pulled By: cipolleschi

fbshipit-source-id: 55374914890445f8193c12a06a943b7796edb457
2023-01-18 06:42:39 -08:00
Sam Zhou f4072b1e00 Pre-suppress errors ahead of 0.197.0 release
Summary: Changelog: [internal]

Reviewed By: mroch

Differential Revision: D42558696

fbshipit-source-id: 3367fb1233c9630bd31b0ae9950f7b2f13438057
2023-01-17 22:24:49 -08:00
Rob Walker 8ea1cba06a Remove iOS flag from scrollEventThrottle prop (#35840)
Summary:
The `scrollEventThrottle` prop is documented as only applying to iOS, but in [this commit](cf55fd587e) it was also implemented for Android, but the documentation was not updated.

## Changelog
[GENERAL] [CHANGED] - Removed iOS flag from `scrollEventThrottle` docs
<!-- 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/35840

Test Plan: I've not been able to find how to build the docs locally, so I don't have a screenshot of the changes :(

Reviewed By: cipolleschi

Differential Revision: D42530943

Pulled By: sammy-SC

fbshipit-source-id: 2948eca2621712ccd832f4f99f1aab0cbd4af2d0
2023-01-17 05:38:19 -08:00
Mikhail Mikhaylov 8d2a62931f Fixes an error in the reactConsoleErrorHandler comment (#35830)
Summary:
Fixes an error in the `reactConsoleErrorHandler` comment

## Changelog
[GENERAL] [FIXED] - Fixed a typo in the `reactConsoleErrorHandler` comment
<!-- 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/35830

Test Plan: No tests needed

Reviewed By: cipolleschi

Differential Revision: D42529639

Pulled By: cortinico

fbshipit-source-id: 89a01838bae6c260f510a9bedcc48b157fcf859b
2023-01-16 04:23:22 -08:00
Ruslan Lesiutin 465e937533 internalize Slider module (#35825)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35825

Changelog:
[iOS][Removed] - removed Slider module
[Android][Removed] - removed Slider module

Reviewed By: cortinico

Differential Revision: D42394124

fbshipit-source-id: 92ba3bc50d16996a597148fa2f8178e6bd6d8eb7
2023-01-16 02:42:18 -08:00
Luna Wei ac54a5ba2b Remove SafeAreaView flow declaration
Summary: Changelog: [Internal] Remove flow declaration for SafeAreaView in preparation for TS generation

Reviewed By: christophpurrer

Differential Revision: D42349686

fbshipit-source-id: b792313b18f3804d8c68955afd918ec8cbb0b80f
2023-01-11 14:29:37 -08:00
Luna Wei da415398bd Remove AccessibilityInfo.flow
Summary: Changelog: [Internal] Remove flow declaration in preparation for TS generation

Reviewed By: christophpurrer

Differential Revision: D42350837

fbshipit-source-id: 05e80226931cdea04e7f14ddf2876297ab31ada7
2023-01-11 14:29:37 -08:00
Luna Wei 69716ad9ff Make PanResponder an ES Module
Summary: Changelog: [General][Changed] ESM PanResponder

Reviewed By: christophpurrer

Differential Revision: D42272981

fbshipit-source-id: 1191e8f3425aed024b77365da1ad42f44099e94a
2023-01-11 14:29:37 -08:00
Ruslan Lesiutin 0ff7b7fac2 refactor(react-native-github): move DatePickerIOS to internal (#35366)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35366

# Changelog:
[JS][Removed] - removed DatePickerIOS module
[iOS][Removed] - removed DatePickerIOS module

Reviewed By: lunaleaps

Differential Revision: D41163591

fbshipit-source-id: fda31d6f3a5d7a9ca3e50ae3b4817e7deb22819c
2023-01-09 08:53:29 -08:00
Ruslan Lesiutin ac66512eb3 Revert D41069547: Multisect successfully blamed D40984397 for test or build failures (#35789)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35789

Changelog: [Internal]

This diff is reverting D41069547 (fee9510b2d) D41062668 (4c40014d43) D40984397 (05968d16e1)
D40984397 (05968d16e1) has been identified to be causing the following test or build failures:

We're generating a revert to back out the changes in this diff, please note the backout may land if someone accepts it.

allow-large-files

Differential Revision: D42371475

fbshipit-source-id: daa01c9215811c397f5cef958fd4620f36295b60
2023-01-06 13:06:17 -08:00
Gabriel Donadel Dall'Agnol 4ae4984094 feat: Add logical border radius implementation (#35572)
Summary:
This PR implements logical border-radius as requested on https://github.com/facebook/react-native/issues/34425. This implementation includes the addition of the following style properties

- `borderEndEndRadius`, equivalent to `borderBottomEndRadius`.
- `borderEndStartRadius`, equivalent to `borderBottomStartRadius`.
- `borderStartEndRadius`, equivalent to `borderTopEndRadius`.
- `borderStartStartRadius`, equivalent to `borderTopStartRadius`.

## Changelog

[GENERAL] [ADDED] - Add logical border-radius implementation

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

Test Plan:
1. Open the RNTester app and navigate to the `RTLExample` page
2. Test the new style properties through the `Logical Border Radii Start/End` section

https://user-images.githubusercontent.com/11707729/206623732-6d542347-93f9-40da-be97-f7dcd5f66ca9.mov

Reviewed By: necolas

Differential Revision: D42002043

Pulled By: NickGerleman

fbshipit-source-id: a0aa9783c280398b437aeb7a00c6eb3f767657a5
2023-01-06 06:00:03 -08:00
Moti Zilberman 4c911a2dec Filter out Hermes internal bytecode frames from error stack traces
Summary:
Changelog: [Fixed][General] Filter out Hermes internal bytecode frames (Promise implementation) from error stack traces

Currently, React Native strips native frames from call stacks reported via ExceptionsManager / LogBox. This diff does the same for *internal bytecode* frames in Hermes, which are functionally similar to native frames: they are implementation details of the engine for which source code isn't readily available.

In particular this change will avoid confusing symbolication tools that may otherwise try to treat `InternalBytecode.js` frames as belonging to the main React Native bundle (and produce garbage output).

Reviewed By: GijsWeterings

Differential Revision: D42367135

fbshipit-source-id: b7904f10c7ff6956e7b736b575dde1ce45028200
2023-01-05 11:05:39 -08:00
Moti Zilberman b4d4e85aa8 Refactor types + tests of parseHermesStack
Summary:
Changelog: [Internal]

* Migrate `parseHermesStack.js` to modern Flow syntax
* Use inline snapshots in `parseHermesStack-test.js`

Reviewed By: jacdebug

Differential Revision: D42367093

fbshipit-source-id: 854b11283729ce9f3c2ea6e3b0c46c7f7a767a56
2023-01-05 07:28:22 -08:00
Ruslan Lesiutin 05968d16e1 refactor(react-native-github): internalized Slider JS files
Summary:
# Changelog:
[JS][Removed] - Removed Slider module js files

Reviewed By: NickGerleman

Differential Revision: D40984397

fbshipit-source-id: 8ff451d0f4d821af96c45277956042fa181dd4c5
2023-01-05 06:12:47 -08:00
Arushi Kesarwani 9f6b532bdb Changing the Loading View of Android to rely on the native implementation instead of Toast (#35773)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35773

Changelog:
[Android][Added] - For supporting Dev Loading View across multiple platforms, changing the Loading View of Android to rely on the native implementation instead of Toast while keeping backwards comptability.

Reviewed By: rshest

Differential Revision: D42286466

fbshipit-source-id: 38749cdbc11208b81a6199467bac00cbc1850c92
2023-01-04 15:01:20 -08:00
Ruslan Shestopalyuk 21dbc67c03 Use a more robust method of finding out which events to report
Summary:
[Changelog][Internal]

Use the [list of supported events](https://www.w3.org/TR/event-timing/#sec-events-exposed) explicitly to both filter and transform reported event types, which makes this both more robust and less ambiguous.

The mapping is using a compile-time hash/lookup, similarly to how we do it with the ViewProps in the RN core.

Reviewed By: rubennorte

Differential Revision: D42342655

fbshipit-source-id: 3d0b2465fd5611db110c4792913e0a92e76cd067
2023-01-04 08:57:40 -08:00
Ruslan Shestopalyuk 3aea05651d Remove "first-input" event type from Event Timing API logging implementation (#35771)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35771

[Changelog][Internal]
Based on the internal discussion, we don't want to report `first-input` event types for RN (just use plain `event` instead), in the way that [Event Timing API standard suggests](https://www.w3.org/TR/event-timing), as this is doesn't have that clear semantics in the context of RN, also to keep it simpler.

Reviewed By: rubennorte

Differential Revision: D42341923

fbshipit-source-id: eff2487dee17ef082604e4c807b4d41485328114
2023-01-04 08:29:15 -08:00
Luna Wei 9c57a7f209 ESM ActivityIndicator
Summary: Changelog: [General][Changed] ActivityIndicator and remove .flow

Reviewed By: yungsters

Differential Revision: D42203449

fbshipit-source-id: 52ab1111166d23b7304e8406f299d23f9fd6f399
2023-01-03 18:09:06 -08:00
Luna Wei 9af5c3330c ESM LogBox
Summary: Changelog: [General][Changed] - ESM Logbox

Reviewed By: yungsters

Differential Revision: D42202344

fbshipit-source-id: 8b09fb261c61bd3fb3ab8df66e5732046187cdd8
2023-01-03 18:09:06 -08:00
Luna Wei b6064495f5 ESM RCTNetworking
Summary: Changelog: [General][Changed] - ESM RCTNetworking

Reviewed By: yungsters

Differential Revision: D42201538

fbshipit-source-id: 26139061550c8c86d02b688fa828d475036ac792
2023-01-03 18:09:06 -08:00
Luna Wei 0aece02cb0 ESM requireNativeComponent
Summary: Changelog: [General][Changed] - ESM requireNativeComponent

Reviewed By: yungsters

Differential Revision: D42200329

fbshipit-source-id: f1120f06362dc25e48551b3f2421bbda7b68c571
2023-01-03 18:09:06 -08:00
Luna Wei aa8e69b696 ESM processColor
Summary: Changelog: [General][Changed] - ESM processColor

Reviewed By: yungsters

Differential Revision: D42200330

fbshipit-source-id: aac5650ce0b45400400ebee4e8e8b36148539955
2023-01-03 18:09:06 -08:00
Luna Wei 0365f72be5 ESM PixelRatio
Summary: Changelog: [General][Changed] - Convert PixelRatio to ESM and remove old .flow declaration

Reviewed By: yungsters

Differential Revision: D42197759

fbshipit-source-id: b98a8ac2a83280e0848833bceb3350cd4a91d619
2023-01-03 18:09:06 -08:00
Luna Wei c52ed258bf ESM Dimensions
Summary: Changelog: [General][Changed] - Convert Dimensions to ESM

Reviewed By: yungsters

Differential Revision: D42184285

fbshipit-source-id: 49971043f947367aded5fabc45778d5457a35b35
2023-01-03 18:09:06 -08:00
Janic Duplessis 7683713264 Add onStartReached and onStartReachedThreshold to VirtualizedList (#35321)
Summary:
Add  `onStartReached` and `onStartReachedThreshold` to `VirtualizedList`. This allows implementing bidirectional paging.

## Changelog

[General] [Added] - Add onStartReached and onStartReachedThreshold to VirtualizedList

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

Test Plan: Tested in the new RN tester example that the callback is triggered when close to the start of the list.

Reviewed By: yungsters

Differential Revision: D41653054

Pulled By: NickGerleman

fbshipit-source-id: 368b357fa0d83a43afb52a3f8df84a2fbbedc132
2023-01-03 14:58:40 -08:00
Luna Wei ac5cf32915 ESM UTFSequence
Summary: Changelog: [General][Changed] - Migrate UTFSequence to ESM

Reviewed By: ryancat

Differential Revision: D42182830

fbshipit-source-id: d2b738d5ca3d5a0a7d9f41a465fc0389c2c2115f
2023-01-03 13:19:49 -08:00
Ruslan Shestopalyuk 09ad0cc0c6 Implement reporting of events from native side to WebPerformance API (#35768)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35768

Changelog: [Internal]

This implements native side mechanics for reporting user events timing to JS  (PerformanceObserver API).

See the standard for more details: https://www.w3.org/TR/event-timing/

The events are only logged when there are any active subscriptions (via `PerformanceObserver.observe`), also we only log "discrete events" (i.e. no likes of mouse move), so the overhead is non-existing.

There are two main metrics of interest for an event lifecycle:
* Time the event is spent in the queue, i.e. the time between it's created and dispatched
* Time that is spend in the event handler on the JS side (event dispatch), or processing time

Both of these are measured, and the corresponding fields are populated.

Reviewed By: sammy-SC

Differential Revision: D42294947

fbshipit-source-id: 4fd7938c04b942400befa4057d4929fb2763cee1
2023-01-03 11:11:37 -08:00
Alex Hunt 28a06d2fd1 Add additional help guidance on HMRClient close event
Summary:
Resolves [comment on #35514](https://github.com/facebook/react-native/issues/35514#issuecomment-1359140208).

Changelog: [Internal]

Reviewed By: arushikesarwani94

Differential Revision: D42166587

fbshipit-source-id: bb9a28874727e7df45a73d86a876b3d6febe70da
2023-01-03 07:30:47 -08:00
Gabriel Donadel Dall'Agnol 57f1196557 chore: Add missing documentation to inset logical properties (#35752)
Summary:
This PR adds the missing documentation for the inset logical properties from StyleSheetTypes. Related to https://github.com/facebook/react-native-website/pull/3493 and 9669c10afc

## Changelog

[GENERAL] [ADDED] - Add missing documentation to inset logical properties

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

Test Plan: Ensure CI is green

Reviewed By: christophpurrer

Differential Revision: D42294781

Pulled By: rshest

fbshipit-source-id: 48f28728cc8da2cb7ab2977216fdedd4de510e82
2022-12-30 09:32:10 -08:00
Kudo Chien 5eb25d2186 Fix build errors when inheriting RCTAppDelegate in Swift modules (#35661)
Summary:
When inheriting `RCTAppDelegate` in a module with swift code, the compiler will have a build error when it goes through module headers. because swift does not support cxx headers. we found this issue when we try to inherit the class at Expo's [`EXAppDelegateWrapper`](https://github.com/expo/expo/blob/main/packages/expo-modules-core/ios/AppDelegates/EXAppDelegateWrapper.h) with RCTAppDelegate in new architecture mode.

## Changelog

[IOS][FIXED] - Fix build errors when inheriting RCTAppDelegate in Swift modules

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

Test Plan:
- ci passed
- tested with expo's setup: https://github.com/expo/expo/pull/20470

Reviewed By: rshest

Differential Revision: D42293851

Pulled By: cipolleschi

fbshipit-source-id: 8a173279db070cc0008c6f8214093951f504dcc1
2022-12-30 03:53:39 -08:00
Arushi Kesarwani 8ccb861231 Reverting LoadingView change of native implementation of DevLoadingView (#35744)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35744

Changelog:
[Android][Fixed] - LoadingView of Android to use the Toast till the native implementation is functional

Reviewed By: lunaleaps

Differential Revision: D42284732

fbshipit-source-id: dc187e4602240f270b2fbfb40e47604e3a14415d
2022-12-29 17:45:46 -08:00
Arushi Kesarwani 068a20842d Adding native implementation for Dev Loading View for Android (#35743)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35743

Changelog:
[Android][Added] - For supporting Dev Loading View across multiple platforms, altering the javascript implementation of Loading view of android to also rely on native implementation as iOS instead of Toast, thereby unifying both platforms

Reviewed By: rshest

Differential Revision: D42258041

fbshipit-source-id: 1be56c1e5696b1024ba09a0aa11da96e0a08f210
2022-12-29 15:06:13 -08:00
Ruslan Shestopalyuk afd954efbb Add PerformanceEventTiming API, according to the standard
Summary:
Changelog: [Internal]

This adds definition of `PerformanceEventTiming` interface, according to the W3C standard, so that [event timing](https://www.w3.org/TR/event-timing) data can be reported from native (the C++ part is in the next diff).

See here: https://www.w3.org/TR/event-timing/#performanceeventtiming

Reviewed By: christophpurrer

Differential Revision: D42279486

fbshipit-source-id: 0dfbcd6e5a08fc1b89651bd35b24fb4e731f8b05
2022-12-29 14:30:53 -08:00
XantreGodlike 4e45dce355 Typescript keyboard type fix (#35714)
Summary:
Made typescript typings for keyboardType correct

## Changelog

[INTERNAL] [FIXED] - Typescript typings for TextInput Keyboard type.
Url was placed in incorrect section, so I moved it to general type. Sorted keyboard types order as in React native docs.
![image](https://user-images.githubusercontent.com/57757211/209436128-beb7b872-b5fb-4122-8a82-11bff70f919d.png)
![image](https://user-images.githubusercontent.com/57757211/209436135-4453b398-1424-4e20-afea-40f54dbe88dc.png)

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

Test Plan: I think this fix can be merged without tests, because of it shortness

Reviewed By: yungsters

Differential Revision: D42233193

Pulled By: robhogan

fbshipit-source-id: 11ce98c74aaf77e9cef733d6679d4f0a7fea259a
2022-12-28 06:42:54 -08:00
Gabriel Donadel Dall'Agnol 9669c10afc feat: Add Fabric implementation of inset logical properties (#35692)
Summary:
This PR implements `inset` logical properties 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`.

## Changelog

[GENERAL] [ADDED] - Add Fabric implementation of inset logical properties

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

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

<table>
<tr>
    <td>Android</td>
    <td>iOS</td>
</tr>
  <tr>
    <td><img src="https://user-images.githubusercontent.com/11707729/208821212-fbbac6ed-09a4-43f4-ba98-dfd2cbabf044.png"  alt="1" width="360px"   />
    </td>
<td>
<img src="https://user-images.githubusercontent.com/11707729/208816997-ef044140-8824-4b1b-a77b-085f18ea9e0e.png" alt="2" width="360px"  />
</td>
   </tr>
</table>

Reviewed By: NickGerleman

Differential Revision: D42193661

Pulled By: ryancat

fbshipit-source-id: 3db8bcd2c4db0ef4886b9ec49a46424d57362620
2022-12-21 20:07:35 -08:00
Nick Gerleman 76a14454d7 Add missing AccessibilityInfo Types to TS Typings
Summary:
This adds some missing public methods on AccessibilityInfo.

Changelog:
[General][Fixed] - Add missing AccessibilityInfo Types to TS Typings

Reviewed By: christophpurrer

Differential Revision: D42113713

fbshipit-source-id: bf1945f310b716ff8584dd47fc27752dc592e473
2022-12-17 11:58:19 -08:00
Ruslan Shestopalyuk 4eecab3a76 API to report events
Summary:
Extends the WebPerformance API with ability to report events, [according to the standard](https://www.w3.org/TR/event-timing/#sec-performance-event-timing).

This is an API-only change, the actual reporting comes in a separate diff, to simplify reviewing.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D42097695

fbshipit-source-id: d8b468ffed50c1c3d889151df5e8ca644d6e1a68
2022-12-16 11:45:06 -08:00
Ruslan Shestopalyuk d09c5fd7a9 Limit perf entry buffer size and send back 'droppedEntriesCount' to PerformanceObserver callback
Summary:
Prevents scenarios when internal performance buffer may grow indefinitely (e.g. due to a broken logging), communicating back to `PerformanceObserver` the corresponding amount of dropped entries, `droppedEntriesCount`, [according to the standard](https://w3c.github.io/performance-timeline/#dom-performanceobservercallbackoptions-droppedentriescount).

NOTE: The backwards compatibility check is failing, which is an orthogonal issue. I am looking into it and won't land this one before it is sorted.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D42008409

fbshipit-source-id: 40d30e44d39e643bfb58a6254572823cb2b3b8df
2022-12-16 11:45:06 -08:00
Ruslan Shestopalyuk 70a1e2b053 Clean up NativePerformanceObserver API from unused methods
Summary:
Now that D42097191 allows it, get rid of unused API in the related WebPerformance native modules (these were kept there only to pacify the backwards compatibility checks).

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D42037757

fbshipit-source-id: 5f5e7e76722cade9e730aba037f9e8ab51fc16d9
2022-12-16 11:45:06 -08:00
Nick Gerleman c4862a2322 Fix Errors with TypeScript Tests
Summary:
This fixes some style errors found by dtslint, along with some test cases for StyleSheet.compose() where the recent change made it slightly too permissive when explicit return types are given. I also added runs of the TS tests to a script which runs in sandcastle so we can catch this at diff-submission time in the future.

Changelog:
[General][Fixed] - Fix Errors with TypeScript Tests

Reviewed By: lunaleaps

Differential Revision: D42085257

fbshipit-source-id: 7e6ca49d3c3aef822c61c97ecc07b55b0a949d51
2022-12-15 19:17:58 -08:00
Nick Gerleman 621969b8d8 Add missing VirtualizedList Imperative Types
Summary:
Adds some imperative VirtualizedList methods to the TS types which are documented on the website and are public enough. Also explicitly add `viewOffset` to `scrollToItem` since `scrollToItem` params are indefinite in flow and are passed to `scrollToIndex` (which supports the prop).

Changelog:
[General][Fixed] - Add missing VirtualizedList Imperative Types

Reviewed By: GijsWeterings

Differential Revision: D42047674

fbshipit-source-id: 60f7b35b049853d9fcb724918b3a0008a75ea573
2022-12-15 12:41:38 -08:00
Nick Gerleman 8d6e2f86f5 Add missing types for AppRegistry
Summary:
These are all documented on the website and seem to likely work in OSS to at least some extent. Add the missing types corresponding to functions exported from AppRegistry.

Changelog:
[General][Fixed] - Add missing types for AppRegistry

Reviewed By: GijsWeterings

Differential Revision: D42036018

fbshipit-source-id: 0728d6c5602a50e50f1eaf7f76c54ab47dcb0124
2022-12-15 10:22:43 -08:00
Nick Gerleman 4e5421fd9a Add type for RootTagContext
Summary:
This is exported from the RN entrypoint and documented on the RN website, so we should give types for it.

Changelog:
[General][Fixed] - Add type for RootTagContext

Reviewed By: christophpurrer

Differential Revision: D42040806

fbshipit-source-id: cb8cdf557098ddbe33c143b7ab5d80bda7f80a6e
2022-12-15 10:04:11 -08:00
Nick Gerleman 079312895b Add missing types to PushNotificationIOS
Summary:
Adds some types referenced on the React Native webpage that aren't part of the typings.

Changelog:
[General][Fixed] - Add missing types to PushNotificationIOS

Reviewed By: christophpurrer

Differential Revision: D42040583

fbshipit-source-id: be7b86a02e30b99231f3ab35afc3222954f41cf0
2022-12-15 09:54:03 -08:00
Nick Gerleman b15be0eaa3 Fix missing animation type (CircleCI Break)
Summary:
Accidentally added a reference to a flow type that doesn't exist in TS. This should fix the issue.

Changelog:
[General][Fixed] - Fix missing animation type

Reviewed By: christophpurrer

Differential Revision: D42043293

fbshipit-source-id: 03470aa25f503337e9e2b79cf74cff96c15a4ad8
2022-12-15 09:52:24 -08:00
malacca c0834b884b fix RCTNetworking contentType issue (#35640)
Summary:
96027f787a/Libraries/Network/RCTNetworking.mm (L418)

because  `RCTNullIfNil(response.MIMEType)`,  `contentType` may be `[NSNull null]`

96027f787a/Libraries/Network/RCTNetworking.mm (L114)

Here only check `partContentType` is not nil, This causes the custom type never used

96027f787a/Libraries/Network/RCTNetworking.mm (L334)

more serious here, if `dataContentType` is `[NSNull null]` ,  it will crash the application

`-[NSNull hasPrefix:]: unrecognized selector sent to instance 0x7fff8004b700`

## Changelog

[iOS] [Fixed] - fix dataContentType may be [NSNull null] issue

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

Reviewed By: cipolleschi

Differential Revision: D42067206

Pulled By: dmytrorykun

fbshipit-source-id: 073e6589111f5117486b69b8206a07ef1995c5b8
2022-12-15 08:14:38 -08:00
Ruslan Shestopalyuk 14307b8212 Setup a global Performance singleton, according to the standard
Summary:
Makes sure that the global (standard) `performance` instance is initialized to still both provide `Performance.now()` as before, but also allows for the newly implemented functionality from the WebPerf API, such as marks/measures.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D42017812

fbshipit-source-id: ddbe79e91b45a84871de94018305f2a4536ada4b
2022-12-14 22:38:12 -08:00
Nick Gerleman 0d091318ed Fix types for deprecated scrollTo fields
Summary:
This was renamed in Flow but not in TS.

Changelog:
[General][Fixed] - Fix types for deprecated scrollTo fields

Reviewed By: christophpurrer

Differential Revision: D42040913

fbshipit-source-id: 5d9746be7b785bea8613f199d39940c4d5d7d138
2022-12-14 15:38:03 -08:00
Nick Gerleman 2c2cb09c00 Fix Vibration.vibrate() allowing null params
Summary:
The flow type allows these parameters to be optional but not null. Make TS the same.

Changelog:
[General][Fixed] - Fix Vibration.vibrate() allowing null params

Reviewed By: christophpurrer

Differential Revision: D42046301

fbshipit-source-id: a030d4f141a526dfe2f0fb3a90e36e641fa6d789
2022-12-14 15:23:12 -08:00
Nick Gerleman e1af6302fc Mark scrollToEnd animated as optional
Summary:
The flow type and inheriting TS types mark animated as optional, mark it here as well.

Changelog:
[General][Fixed] - Mark scrollToEnd animated as optional

Reviewed By: christophpurrer

Differential Revision: D42036647

fbshipit-source-id: 59d408adc639ee1e0ca040301511c64d7ba55bfe
2022-12-14 15:04:55 -08:00
Nick Gerleman 1752fdc0f5 Fix type for `StyleSheet.compose()`
Summary:
This was flagged when typechecking the existing examples. The current type enforces that both stylesheets overlap, meaning composed stylesheets with distinct props cause a typechecking error. This changes the signature so that each style can be different, and the intersection type of the two is returned.

Changelog:
[General][Fixed] - Fix type for `StyleSheet.compose()`

Reviewed By: christophpurrer

Differential Revision: D42008355

fbshipit-source-id: 238971a61b387c09be001d5df50fe3db70df566f
2022-12-14 14:59:05 -08:00
Nick Gerleman 454f9dc396 Remove testID from TS ViewStyle
Summary:
testID isn't a valid prop to exist on a style.

Changelog:
[General][Fixed] - Remove testID from TS ViewStyle

Reviewed By: necolas

Differential Revision: D42040627

fbshipit-source-id: d51b0dc7abff14ac72f71753ea1ae708e0858590
2022-12-14 13:23:57 -08:00
Nick Gerleman 25a25ea234 Add missing type for AnimatedValue.resetAnimation() and AnimatedValue.animate()
Summary:
See https://www.internalfb.com/code/fbsource/[d96fd0b6ac13]/xplat/js/react-native-github/Libraries/Animated/nodes/AnimatedValue.js?lines=207

Changelog:
[General][Fixed] - Add missing type for AnimatedValue.resetAnimation() and AnimatedValue.animate()

Reviewed By: christophpurrer

Differential Revision: D42034719

fbshipit-source-id: 40e25940e04bdf296c8b5e4bf39bee2e4baeae07
2022-12-14 10:51:00 -08:00
Abdelhafidh Belalia 64475aeb3b Switch order of onSelectionChange and onChange events on iOS (#35603)
Summary:
Switched order of onSelectionChange and onChange events on iOS

This was already fixed but for fabric only https://github.com/facebook/react-native/blob/main/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm#L36-L46

This PR is a complementary of 7b4889937c

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

## Changelog

[IOS] [FIXED] - onSelectionChange() is fired before onChange() on multiline TextInput

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

Test Plan:
Reproduce the minimal example provided here https://github.com/facebook/react-native/issues/28865
Verify that the events order is onChange then onSelectionChange with no duplicates

Reviewed By: cipolleschi

Differential Revision: D41947673

Pulled By: dmytrorykun

fbshipit-source-id: cf452a6101400b1b54295c83fa7735449d91e781
2022-12-14 09:17:54 -08:00
Sam Zhou fc3565ce8d Pre-suppress errors before the next Flow release
Summary: Changelog: [Internal]

Reviewed By: fred2028

Differential Revision: D42006446

fbshipit-source-id: de6c327a540e5085ac196679cf7db7db8a681298
2022-12-13 16:50:33 -08:00
Samuel Susla 455ca8cfaf Make UIManager.measure* compatible with Fabric
Summary:
changelog: [internal]

To make migration to the new architecture more straight forward, this change makes `UIManager.measure`,  `UIManager.measureInWindow`, `UIManager.measureLayout` and `UIManager.measureLayoutRelativeToParent` functions backwards compatible. Users will not have to make any change to continue using the APIs.

This will make [Migrating .measure*()
](https://reactnative.dev/docs/new-architecture-library-intro#migrating-measure) in the migration guide optional.

Reviewed By: yungsters

Differential Revision: D41613050

fbshipit-source-id: 3c65ced231590243d118fbc120a87b08d5261da0
2022-12-13 11:43:05 -08:00
Moti Zilberman 9b280ad1c5 Replace matchAll with exec
Summary:
When using the `g` modifier on the regex, match and matchAll's behaviour is equivalent, and match has better backwards compatibility on older iOS versions.

Changelog: [General][Fixed] Fixed a backwards compatibility issue with AnimatedInterpolation

Reviewed By: yungsters

Differential Revision: D41879036

fbshipit-source-id: 240dda85ef0de8e27452846c77114ac46823f74f
2022-12-13 02:45:49 -08:00
Ruslan Shestopalyuk 41c17ddd56 Batch/throttle reporting of the performance entries
Summary:
Makes sure that we don't spam too often the JS performance entry reporting callback, which further dispatches entries to `PerformanceObserver` instances.

The logic is as following:
* ~~~If internal buffer of entries reaches the limit, we schedule the callback (with background priority)~~~
*~~~ Once the callback is processed, we schedule the next flush after a timeout of 500ms, this will also be scheduled from native with background priority~~~
* ~~~Whenever new performance type starts to be observed, we also schedule the callback, in order to prime the above~~~
* Schedule the flush with low priority, whenever there is the first entry coming into an empty buffer, and rely on the Scheduler to "do the right thing" when asked to flush it with background priority and not doo it exceedingly often (see the prolonged discussion)

Changelog: [internal]

Reviewed By: rubennorte

Differential Revision: D41875085

fbshipit-source-id: 368b525203215350ceabb43d5e9e8e3bd5242aca
2022-12-12 04:53:31 -08:00
David Vacca 1a514e514b Refactor ReactNativeFeatureFlags
Summary:
Refactor ReactNativeFeatureFlags

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D41750644

fbshipit-source-id: 43fdd7758e68a578afdb799488fda9f8bdf0ddb4
2022-12-10 15:42:08 -08:00
Ahmed Shehata b65ce3c74a Expose setLongPressDeactivationDistance as class method
Summary:
Changelog:
[Internal][Added] - Provided a way to override long press sensitivity,

Reviewed By: javache

Differential Revision: D41766246

fbshipit-source-id: befeafd93a73675ec609b0510dd8b5190b07dda0
2022-12-09 12:58:02 -08:00
David Angulo 910a750fbc Rename `POST_NOTIFICATION` to `POST_NOTIFICATIONS` (#35533)
Summary:
After adding `<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>` on my `AndroidManifest.xml`, I expected to use `PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS` but `POST_NOTIFICATIONS` is `undefined` and is named `POST_NOTIFICATION` instead.

Every other Android permission is 1:1 in spelling except this one where it lacks `S`.

Not sure if this is a welcome change since this can be breaking. Or maybe we can include both with and without `S` to not be a breaking change. Or just keep it as is and close this PR.

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

[Android] [Changed] - Rename `POST_NOTIFICATION` to `POST_NOTIFICATIONS`

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

Test Plan: `PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS` should not be `undefined`.

Reviewed By: cortinico

Differential Revision: D41705866

Pulled By: philIip

fbshipit-source-id: a0328b174f0196421565f0cd2b2f1eb509428553
2022-12-09 12:56:07 -08:00
Rubén Norte 5d8fae9cc0 Improve spec-compliance of PerformanceObserver.prototype.observe
Summary:
Our implementation of `PerformanceObserver.prototype.observe` diverges a little bit from the [spec](https://w3c.github.io/performance-timeline/#dom-performanceobserver-observe) regarding the behavior when calling it multiple times. E.g.:

1. We don't throw errors if both `type ` and `entryTypes` are passed.
2. We don't throw errors if neither `type ` nor `entryTypes` are passed.
3. We don't throw errors if we call observe with `type` and we call again later with `entryTypes`, and vice versa.
4. The logic to consolidate entry types in subsequent observe calls is incorrect.

This fixes those issues and also applies some minor naming improvements.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D41872269

fbshipit-source-id: 9a6b485f4ef2f479c8b6f0307012322f65a11879
2022-12-09 12:15:42 -08:00
Rubén Norte 120e87b86e Show warning when native module for performance marks and measures is not available
Summary:
We're currently showing warnings when we call `performanceObserver.observe` and the native module for performance observers isn't available, but we don't do the same for `performance.mark`, `performance.measure`, etc.

This adds the warning in those cases.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D41872270

fbshipit-source-id: d720580b930550f27c827a58243579c42a4f6da9
2022-12-09 12:15:42 -08:00
Rubén Norte 4328259f66 Minor stylistic and type coverage changes for Web Performance modules in RN
Summary:
Improved Flow coverage to 100% in both modules.

[Changelog][Internal]

Reviewed By: rshest

Differential Revision: D41872271

fbshipit-source-id: f93553dcabd6d78a3946fdf9d2d2d40cb6c8ca23
2022-12-09 12:15:42 -08:00
Moti Zilberman 340c046c2e Remove experimental support for Hermes Modules (CommonJS)
Summary: Changelog: [Internal]

Reviewed By: jacdebug

Differential Revision: D41736222

fbshipit-source-id: 05c03ff31072416f7ee81baccb8a4efd2c8baa85
2022-12-09 04:00:31 -08:00
Nicola Corti bc26a1b9a4 Update reference to statusBarTranslucent in Modal comment
Summary:
Re-apply #29278 that was recently closed by still valid.

Changelog:
[Internal] [Changed] - Update reference to statusBarTranslucent in Modal comment

Reviewed By: christophpurrer

Differential Revision: D41765526

fbshipit-source-id: 0397e86aa9adc5e5495cad8e2612cc5457840273
2022-12-09 02:30:09 -08:00
Saad Najmi 76bf71e2cc Merge AlertIOSExample page into AlertExample page (#35586)
Summary:
`AlertIOS` was deprecated and removed long ago (e2bd7db732) but there continues to be a test page with the name `AlertIOS` in RN-Tester. `AlertIOSExample.js` contains valid examples of how to use `Alert.prompt()` so it's worth keeping them around. Let's move those into `AlertExample.js` and remove `AlertIOSExample.js`. While we're here, let's do some extra fixes to the test page:

- Remove `showsIndividualExamples = true`. For whatever reason, I needed to remove this to show the examples properly...
- Convert all uses of `<TouchableHighlight>` with `<Pressable>`. The latter replaces the former, so I thought that made sense..

Some extra context:

In React Native macOS, we had forked `AlertIOS` into `AlertMacOS`, with a corresponding example page. This PR was made while working on removing those (https://github.com/microsoft/react-native-macos/pull/1548/).

## Changelog

[INTERNAL] [CHANGED] - Moved `Alert.prompt` examples into common rn-tester test page

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

Test Plan:
Test page shows up fine on iOS .

![Simulator Screen Recording - iPhone 14 Pro - 2022-12-07 at 15 15 40](https://user-images.githubusercontent.com/6722175/206318170-1893c8f6-0596-4825-8312-f45e45557095.gif)

Reviewed By: lunaleaps

Differential Revision: D41825889

Pulled By: NickGerleman

fbshipit-source-id: 82e4405b1f3a1ccb558b5a5038a90416e7a32c29
2022-12-07 18:30:49 -08:00
Ruslan Lesiutin 74859c7f0d refactor(react-native/DatePickerAndroid): internalize native module
Summary: Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D41772143

fbshipit-source-id: 842934c930d1f5209f65a70fff9919a99c330bda
2022-12-07 17:06:07 -08:00
Samuel Susla 6fa51e0c47 Fix flow types in NativeUIManager
Summary:
changelog: [internal]

Fix Flow types for UIManager measure functions.
Host platform does not accept null value for reactTag parameter. It errors if null is passed. This moves error closer to developers as Flow can catch it.

Reviewed By: javache

Differential Revision: D41614452

fbshipit-source-id: 2216c195808b8a1aae58c7cb2fa15be8a073e222
2022-12-07 08:37:35 -08:00
Sam Zhou ccefad049a Enable LTI in react-native
Summary: Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D41788271

fbshipit-source-id: 8e40dc3279ee0283b2845b9559a80862fdf59a17
2022-12-06 19:34:14 -08:00
Ruslan Shestopalyuk 62a28e4bdb Native side implementation for Performance.measure()
Summary:
Changelog: [Internal]

This implements the C++ side logic of handling `Performance.measure` calls.

Since measures may refer to earlier logged marks by name, we need to keep track of the former. I also use a fixed size (circular) buffer to prevent the marks from piling forever.

Also adds implementation of clearing marks/measures, as per standard.

Reviewed By: mdvacca

Differential Revision: D41756928

fbshipit-source-id: 19dce28d6af4c5646274e6d5db20b41869282780
2022-12-06 17:34:24 -08:00
Ruslan Shestopalyuk d8bcab2be7 Implement Performance.measure support for RN (JS side)
Summary:
Changelog: [Internal]

This adds JS side implementation (including the API) for the `Performance.measure` functionality, [as described in the corresponding standard](https://www.w3.org/TR/user-timing/#measure-method).

The JS part is separated from the C++ implementation (further down the stack) to help the review being more focused.

Reviewed By: mdvacca

Differential Revision: D41733190

fbshipit-source-id: 72b69f6bb332aed4b9477a186b0e818b62009220
2022-12-06 17:34:24 -08:00
Robert Balicki 96d6680e00 Add iOS + Android support for getting/setting reload-and-profile-related settings
Summary:
@public
* Add support for getting/setting reload-and-profile-related settings in iOS + Android

## Changelog:
[General][Added] - Add support for getting/setting reload-and-profile-related settings in iOS + Android

Reviewed By: NickGerleman

Differential Revision: D41040611

fbshipit-source-id: df99fb0101dfdfc6808708a5a6ecd9cb96a357d5
2022-12-05 22:07:30 -08:00
Ruslan Lesiutin 71399d0891 refactor(react-native/polyfills): rename package to @react-native/js-polyfills and align version
Summary:
Changelog:
[General][Changed] - renamed react-native/polyfills -> react-native/js-polyfills and align with other packages versions (0.72.0) as a part of migration to monorepo

Reviewed By: motiz88

Differential Revision: D41553157

fbshipit-source-id: eef70c8e7639080acdeb6716d1a915760a85458a
2022-12-05 18:34:33 -08:00
Sam Zhou 17f221c852 Add annotations to xplat to prepare for LTI
Summary: Changelog: [Internal]

Reviewed By: mvitousek

Differential Revision: D41739285

fbshipit-source-id: 79db8afaad87a2fbba8f6d30d8468a5997c8509d
2022-12-05 14:58:24 -08:00
Nick Gerleman ff984ac9b5 Move flex gap props to correct type
Summary:
Missed while reviewing https://github.com/facebook/react-native/pull/34974 that flex gap props in Flow typings were added to ShadowStyle instead of LayoutStyle (directly above). The same issue is not present in the TS typings.

Changelog:
[General][Fixed] - Move flex gap props to the correct type

Reviewed By: yungsters

Differential Revision: D41736652

fbshipit-source-id: de0db1676464fbd962b2c7e7e9ef62b795332f1b
2022-12-05 14:41:27 -08:00
Pieter De Baets 56b10a8351 Support colors for AnimatedInterpolation on iOS
Summary:
Color support for AnimatedInterpolation was incomplete with native drivers, as only rgba type strings were supported. There was also an issue where color props instead a StyleAnimatedNode would never get applied. We were also potentially duplicating color parsing support, which is already centralized in normalizeColor / processColor.

Changelog: [iOS][Added] Enable AnimatedInterpolation to interpolate arbitrary color types.

Reviewed By: philIip

Differential Revision: D41649337

fbshipit-source-id: 505ba555b6a79113635fdfb35c6fe69c92d82234
2022-12-05 08:24:54 -08:00
Alec Winograd 36cc71ab36 Prevent native blob resource from being de-allocated prematurely (#31392)
Summary:
This PR prevents blob data from being prematurely de-allocated in native code when using slice to create views into an existing blob. Currently, whenever a new blob is created via createFromOptions, BlobManager.js creates a new blobCollector object since options.__collector is never provided.

dc80b2dcb5/Libraries/Blob/BlobManager.js (L115-L123)

When the reference to a blobCollector is garbage collected, the corresponding native memory for the blob data is de-allocated.

27651720b4/Libraries/Blob/RCTBlobCollector.mm (L19-L25)

Since, `blob.slice()` is supposed to create a new view onto the same binary data as the original blob, we need to re-use the same collector object when slicing so that it is not GC'd until the last reference to the binary data is no longer reachable. Currently, since each blob slice gets a new blobCollector object, the memory is de-allocated when the first blob is GC'd.

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

## 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] - Blob data is no longer prematurely deallocated when using blob.slice

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

Test Plan: I could use help coming up with a test plan here. I could add a referential equality check for the blob.data.__collector in `Blob-test` but it doesn't seem quite right to be testing the implementation detail there.

Reviewed By: javache

Differential Revision: D41730782

Pulled By: cortinico

fbshipit-source-id: 5671ae2c69908f4c9acb5d203ba198b41b421294
2022-12-05 07:22:49 -08:00
Blake Friedman 9c75871a81 Fix abnormal close JS exception
Summary:
D40660765 (3982a2c6bd) introduced extra logging for abnormal closes. The websocked 'close' event may not be called with the event argument.

Changelog: [Internal] - Fix for undefined websocket close

Reviewed By: jacdebug, cortinico

Differential Revision: D41731339

fbshipit-source-id: 92b28dcc0d55d0e9e32b4f4321f325fb3471edcd
2022-12-05 06:26:09 -08:00
Nick Gerleman 1d4396c9d7 Re-enable Text Test Using New Style Prop
Summary:
D41708199 (3e91415696) updated `deprecated-react-native-prop-types` so we should be able to re-enable this test, which I previously disabled as part of making RN tests fail on `console.error()`/`console.warn()` (i.e. any test unintentionally creating a redbox/yellowbox).

Changelog:
[Internal]

Reviewed By: yungsters

Differential Revision: D41724052

fbshipit-source-id: 4e91809940c4bf9bde416367326167598a4d1354
2022-12-04 23:06:46 -08:00
Ruslan Latypov 2e2cd302f1 fix missing imports and set disable_infer_precompiled_header]
Reviewed By: adamjernst

Differential Revision: D41704378

fbshipit-source-id: 92bcbc8710e75e6eccfb252986ebd7b5f8645ba6
2022-12-04 13:30:16 -08:00
Tim Yung 3e91415696 RN: Upgrade to deprecated-react-native-prop-types@3.0.1 (#35549)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35549

Upgrades `react-native` to the newly published `deprecated-react-native-prop-types@3.0.1`, which brings prop-types compatibility up-to-speed with React Native 0.71. (This **is** a release blocker for 0.71.)

Changelog:
[General][Changed] Updated Prop Types for 0.71: https://github.com/facebook/react-native-deprecated-modules/blob/main/deprecated-react-native-prop-types/CHANGELOG.md

Reviewed By: rickhanlonii

Differential Revision: D41708199

fbshipit-source-id: 0cbcf294753203d5a35c8602d5585c5f2b604c6e
2022-12-03 09:27:39 -08:00
Ruslan Shestopalyuk cb552f62f2 Create NativePerformance C++ module
Summary:
[Changelog][Internal]

The NativePerformance module functionality corresponds to the [timing extensions of the Performance API standard interface](https://www.w3.org/TR/user-timing/#extensions-performance-interface).

As this is logically separate from `PerformanceObserver` (which may exist without it), it makes sense to have it as a different native module, so there is no coupling between both.

Reviewed By: christophpurrer

Differential Revision: D41690145

fbshipit-source-id: 7443f4c51f54cc2fdddbdb2e89f9a1fa457ab280
2022-12-03 08:32:58 -08:00
Ruslan Shestopalyuk 1c7e678e08 Handle the case when PerformanceObserver.observe is called multiple times
Summary:
[Changelog][Internal]
Addresses the corresponding TODO in code, to make sure that PerformanceObserver.observe may be called multiple times with different entry types to observe.

Reviewed By: christophpurrer

Differential Revision: D41686237

fbshipit-source-id: 4287f63f7e71e5b1056d30ed616149841ba4f892
2022-12-02 17:23:58 -08:00
Ruslan Shestopalyuk 862a99c491 Use NativePerformanceObserver.popPendingEntries instead of getPendingEntries
Summary:
[Changelog][Internal]

The name corresponds more precisely to what the method does.

Reviewed By: christophpurrer

Differential Revision: D41686205

fbshipit-source-id: 36c47b57fdeb757515cd14b890f38247f7fe8d02
2022-12-02 17:23:58 -08:00
Ruslan Shestopalyuk dfbb63996a Don't use public fields in PerformanceObserver API
Summary:
[Changelog][Internal]

A follow up to the [discussion](https://www.internalfb.com/diff/D41496082 (14e69db482)?dst_version_fbid=831443041436872&transaction_fbid=1281583632681733) in D41496082 (14e69db482), this gets rid of the non-private fields in the `PerformanceObserver` - both to prevent abuse and better conform to the standard.

Reviewed By: rubennorte

Differential Revision: D41683363

fbshipit-source-id: 1fc98ff77e0bcdbf66c2a768e8b27a726831f106
2022-12-02 11:17:27 -08:00
Pieter De Baets 1452a55845 Remove RCTViewConfigEventValidAttributesDisabled
Summary:
Changelog: [Internal]

Codemod-bot already hardcoded this to false a while back, so cleaning up the code related to it.

Reviewed By: RSNara

Differential Revision: D41615378

fbshipit-source-id: 7b62b20b8e25f0a06d207b2457d6caf9ad5c695e
2022-12-02 09:08:16 -08:00
Ruslan Shestopalyuk 14e69db482 Implement native logic for performance event reporting (#35526)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35526

[Changelog][Internal]

This closes the full loop according to the [technical design](https://fb.quip.com/MdqgAk1Eb2dV) of the WebPerf API implementation, with the main components and the working central data flow in place.

The next step is to add some buffering/throttling, as in this diff we just spawn an idle-priority task after every performance entry coming (even though they still naturally do come in batches, because they manage to accumulate before the task is executed).

Reviewed By: christophpurrer

Differential Revision: D41496082

fbshipit-source-id: 5fd4cf22e75806f7bc98d1d1b6691596ccadf8b9
2022-12-01 09:49:44 -08:00
Thibault Malbranche dc3355920d chore: rename normalize-color to normalize-colors (umbrella 480) (#34571)
Summary:
## 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
-->

[General] [Changed] - Rename normalize-color to normalize-colors as part of https://github.com/react-native-community/discussions-and-proposals/pull/480

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

Reviewed By: cortinico

Differential Revision: D39235696

Pulled By: hoxyq

fbshipit-source-id: b6d5fcae9fb5c953c2f7b48f73a95cd883ff8f63
2022-12-01 08:46:57 -08:00
Nick Gerleman 217696ee17 Fail tests on `console.error()` or `console.warn()`
Summary:
This makes it so that React Native unit tests will fail if code unexpectedly outputs a warning or error (which would show as a redbox error).

This logic split out from the normal `jest/setup.js` which is included by the jest-preset, to only effect our tests instead of existing RN Jest users.

Changelog:
[Internal][Changed] - Fail tests on `console.error()` or `console.warn()`

Reviewed By: huntie

Differential Revision: D41564032

fbshipit-source-id: 3cc7d3a8433fcb75f654669b9c350dea2da937a8
2022-12-01 06:59:04 -08:00
Di Chen de7a323f6b Revert D40632443: Support colors for AnimatedInterpolation on iOS
Differential Revision:
D40632443 (6003e70e84)

Original commit changeset: 4dfb29edca4b

Original Phabricator Diff: D40632443 (6003e70e84)

fbshipit-source-id: 0718fbd18c3a7a06e116d9926d40d8d9a75ed4cd
2022-11-30 14:45:07 -08:00
fortmarek 3c5a8290ae Rename `assets` to `assets-registry` (#34572)
Summary:
Part of the [monorepo RFC](04671deebe/proposals/0006-react-native-monorepo.md)

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

[General] [Changed] - Rename assets to assets-registry

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

Reviewed By: cortinico

Differential Revision: D39235817

Pulled By: hoxyq

fbshipit-source-id: ff4d4a7ff980d3fc6e28b83ad3b36250eba79fc3
2022-11-30 12:25:02 -08:00
Pieter De Baets 6003e70e84 Support colors for AnimatedInterpolation on iOS
Summary:
Color support for AnimatedInterpolation was incomplete with native drivers, as only rgba type strings were supported. There was also an issue where color props instead a StyleAnimatedNode would never get applied. We were also potentially duplicating color parsing support, which is already centralized in normalizeColor / processColor.

Changelog: [iOS][Added] Enable AnimatedInterpolation to interpolate arbitrary color types.

Reviewed By: sammy-SC

Differential Revision: D40632443

fbshipit-source-id: 4dfb29edca4b919474408b43c3917ac9406a147a
2022-11-30 10:19:12 -08:00
Pieter De Baets e7dbfb2dbd Support colors in AnimatedInterpolation on Android
Summary:
Color support for AnimatedInterpolation was incomplete with native drivers, as only rgba type strings were supported. There was also an issue where color props instead a StyleAnimatedNode would never get applied. We were also potentially duplicating color parsing support, which is already centralized in `normalizeColor` / `processColor`.

Changelog: [Android][Added] Enable AnimatedInterpolation to interpolate arbitrary color types.

Reviewed By: mdvacca

Differential Revision: D40571873

fbshipit-source-id: 41857ab0391279c5307bc31b855ea8fbcb4cccd8
2022-11-30 10:19:12 -08:00
Pieter De Baets b589123a3d Rewrite AnimatedInterpolation JS driver support for colors
Summary:
Restructured the JS implementation of AnimatedInterpolation to make it clearer how colors and other string-based interpolatables are supported. We're then able to use a very similar structure to implement this interpolation on the native driver as well, which simplifies implementation, and improves support for different color types.

Changelog: [General][Fixed] Improved support for AnimatedInterpolation of color props.

Reviewed By: mdvacca

Differential Revision: D40571890

fbshipit-source-id: 7c204a7b736722732dc5f9e0d158ef5af81b4bb1
2022-11-30 10:19:12 -08:00
Ruslan Shestopalyuk a64319a2b2 Add API and scaffolding for Performance.mark implementation
Summary:
[Changelog][Internal]

Adds API definition for [Performance.mark](https://www.w3.org/TR/user-timing/#mark-method) support.

This is a bare bone implementation, that just logs events on the native side. The next step is the native logic for queuing, flushing etc.

Note that here I route both JS and native marks to native for now, for simplicity sake - ultimately this may not be what we want,  as it may be more efficient to process marks, logged from JS, on the JS side.

Reviewed By: rubennorte

Differential Revision: D41472148

fbshipit-source-id: bdf2b182b8472a71a5500235849bca5af1c2f360
2022-11-30 09:28:53 -08:00
Pieter De Baets dccb57fb50 Fix Animated.Color callbacks when switching between native colors
Summary:
Animated.Color was never calling `flush`, and thus didn't trigger any animated views to update when the Animated.Color had (a native-only) color change when using the JS driver.

Changelog: [General][Fixed] Improved handling of native colors in Animated.Colors

Reviewed By: mdvacca

Differential Revision: D41519965

fbshipit-source-id: 52f78460cf67ab9260d3868b0d27692b64fc3c58
2022-11-29 07:52:46 -08:00
Ali Akbar Azizi 6c33fd1c48 Fix virtual list type (#35434)
Summary:
Add missing props to virtual list

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

[General] [Fixed] - Virtual list props

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

Test Plan:
relative pull request in DefinitelyTyped
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/63323

Reviewed By: javache

Differential Revision: D41553396

Pulled By: NickGerleman

fbshipit-source-id: d51a93410ece9ad5f0bb61e2ee51076973e80c8c
2022-11-28 12:14:21 -08:00
Vojtech Novak e325c9505a chore: RCTConvert - allocate array with capacity (#35490)
Summary:
this is a trivial change that allocates the NSMutableArray with the correct capacity before it is filled

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Changed] - RCTConvertVecToArray - allocate array with capacity

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

Test Plan: tested locally: the code builds and runs as expected

Reviewed By: cipolleschi

Differential Revision: D41548050

Pulled By: GijsWeterings

fbshipit-source-id: a5b947331d6c5fffcfecc7c20c827f42442b1ab8
2022-11-28 07:29:04 -08:00
Moti Zilberman 6c6dbf63de Add @flow and @format to NativeComponentRegistryUnstable
Summary:
Changelog: [Internal]

`NativeComponentRegistryUnstable.js` has Flow syntax but no `flow` directive. It seems to typecheck fine so I'm adding the directive here. (Plus `format` for good measure.)

Reviewed By: huntie

Differential Revision: D41547266

fbshipit-source-id: 1b6a03c705add91843633166a245d0447a21af6d
2022-11-28 07:17:33 -08:00