Commit Graph
32655 Commits
Author SHA1 Message Date
Blake Friedman 09115012c8 Fix failing Publish @react-native-community/template step
In build_npm_package, the publishing of the bumped template is failing
because it's running in sh instead of bash, but using bash syntax.

Changelog: [Internal]
2024-08-06 14:39:33 +01:00
Oskar KwaśniewskiandFacebook GitHub Bot 21bdce7286 feat(iOS): implement automicallyAdjustsKeyboardInsets for new arch (#45819)
Summary:
This PR implements the missing `automicallyAdjustsKeyboardInsets` for new architecture.

After fixing this I've noticed there is an open issue (https://github.com/facebook/react-native/issues/45647) with somebody assigned (sorry shubhamguptadream11 for taking your task)

Here is the app running on new arch:

https://github.com/user-attachments/assets/673f0587-6a67-47e3-8050-d6ee33a45724

## Changelog:

[IOS] [FIXED] - implement automicallyAdjustsKeyboardInsets for new arch

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

Test Plan:
1. Test out ScrollViewKeyboardInsets example
2. See if it works the same with old and new arch

Reviewed By: sammy-SC

Differential Revision: D60453404

Pulled By: cipolleschi

fbshipit-source-id: bd7ce5bac8facffc527106b50c54112acf687bc3
2024-08-06 04:15:49 -07:00
Pavel GurkovskiiandFacebook GitHub Bot 3572ef3f1b T183626616 - [KP][WP iOS v] App crashes after rotation in landscape view during playing a video. (#45846)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45846

In general this diff fixes all crashes related to RTCImageUtills happened because of uncovered cases in switch.

In this current bug the problem was in this part of code
RCTTargetSize(imageSize, imageScale, frame.size, RCTScreenScale(), (RCTResizeMode)self.contentMode, YES);

when we cast UIViewContentMode to RCTResizeMode. RCTResizeMode doesnt cover all of UIViewContentMode values.

So just added default cases to swithces in places where it was lost.

Changelog:
[iOS][Fixed] - fixed crash in RCTImageUtils

Reviewed By: philIip

Differential Revision: D60523540

fbshipit-source-id: b8027537c600a7ca226e62238d16a6b05301d4de
2024-08-06 02:07:47 -07:00
Zeya PengandFacebook GitHub Bot 67367a0bba Make normalizeEventType public (#45900)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45900

Changelog: [internal]

make `normalizeEventType` public, it looks like a nice util when we want to write code to intercept event, e.g. "scroll" event could be named as "onScroll" or "topScroll", this function contains the source of truth of how RN parses it

Reviewed By: christophpurrer

Differential Revision: D60767388

fbshipit-source-id: b3880fda57e2d92d9d199db5f5d39b8a8435820c
2024-08-05 22:12:26 -07:00
Zeya PengandFacebook GitHub Bot b0b898b460 ScrollEvent 2/n - use ScrollEvent over ScrollViewEventEmitter::Metrics (#45899)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45899

Changelog: [internal]

replace ScrollViewEventEmitter::Metrics for ScrollEvent payload type created earlier
make ScrollViewEventEmitter::Metrics an alias of ScrollEvent as well

Reviewed By: christophpurrer

Differential Revision: D60767390

fbshipit-source-id: 8db88c0e1fa837b5dbad92d7bcce825882feaaf6
2024-08-05 22:12:26 -07:00
Zeya PengandFacebook GitHub Bot e7caad2ee4 ScrollEvent 1/n - Create ScrollEvent payload (#45851)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45851

Create ScrollEvent payload type, so we can unwrap the scroll event metrics if intercept it in C++

Changelog: [internal]

Reviewed By: christophpurrer

Differential Revision: D60526048

fbshipit-source-id: 219a690ccf67d0b1c90e3496b8e5970ab7e2a79b
2024-08-05 22:12:26 -07:00
Sam ZhouandFacebook GitHub Bot ae73fe462e Replace React$Element that will cause an error in the future
Summary:
For the ones where `React.MixedElement` would suffice, I change them to `React.MixedElement`. For everything else, I changed it to be `React.Element`

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D60798229

fbshipit-source-id: 40176b44769aade2c6b63a680d03c10056b2ddfa
2024-08-05 18:42:05 -07:00
Sam ZhouandFacebook GitHub Bot 4f47b385fa Cleanup all uses of internal flow type React$ElementRef in react-native (#45904)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45904

Flow will error on these dollar types soon. For all the ones changed here, they can all be further simplified.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D60786768

fbshipit-source-id: e26bf0be1c4a933fc0bd8b59827e10cbd7242a83
2024-08-05 14:51:30 -07:00
Thibault MalbrancheandFacebook GitHub Bot fbcb3d469c chore: changelog for 0.74.5 (#45898)
Summary:
Adds changelog for the 0.74.5 patch.

## 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] - Add 0.74.5 changelog

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

Reviewed By: christophpurrer

Differential Revision: D60768626

Pulled By: arushikesarwani94

fbshipit-source-id: 62196fc8a4fec1ff992ecc4622116b97dd96b79b
2024-08-05 13:30:07 -07:00
zhongwuzwandFacebook GitHub Bot 4e12c2e37c Fixes typo of function callFunctionOnBufferedRumtimeExecutor (#45902)
Summary:
I introduced a typo in https://github.com/facebook/react-native/issues/45486 . Thanks migueldaipre
 for the catch-up. cc cipolleschi

## Changelog:

[IOS] [FIXED] - Fixes typo of  function callFunctionOnBufferedRumtimeExecutor

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

Test Plan: Just a typo.

Reviewed By: cipolleschi

Differential Revision: D60775511

Pulled By: arushikesarwani94

fbshipit-source-id: da781ea5ecf2e0a15e5419430240e10194043b1b
2024-08-05 13:02:04 -07:00
Samuel SuslaandFacebook GitHub Bot 9ee50e5db9 ship use of passive effects in Animated (#45893)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45893

changelog: [internal]

This is mainly impact for the Event Loop where setting up of animation graph will no longer block paint.

Reviewed By: rubennorte

Differential Revision: D60648823

fbshipit-source-id: 8efa1dac2a42b14a609adae05e9266f78a181d43
2024-08-05 08:30:49 -07:00
Alex HuntandFacebook GitHub Bot 7b34870564 Replace usage of Java OptionalInt (#45862)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45862

Fixes compatibility with Android API < 24, and removes our `JOptionalInt` wrapper implementation for now.

Changelog: [Internal]

Reviewed By: robhogan, motiz88

Differential Revision: D60581676

fbshipit-source-id: 7e79fc59a4199a967e62ac3aeafc5d5681c60077
2024-08-05 08:15:45 -07:00
Jordan BrownandFacebook GitHub Bot fa3f769979 Deploy 0.242.0 to xplat (#45886)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45886

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D60688497

fbshipit-source-id: 09c6daeef56e87317cbdb5c9ee0a8bc0828fa4ce
2024-08-05 07:04:16 -07:00
Blake FriedmanandFacebook GitHub Bot 8689aa48bb AdditionalAnimatedNode → Kotlin
Summary: Changelog: [Android][Changed] AdditionalAnimatedNode.java → Kotlin

Reviewed By: rshest

Differential Revision: D60523059

fbshipit-source-id: de4e60854a03b5a6f061882c03cf191998888015
2024-08-05 05:21:36 -07:00
generatedunixname89002005232357andFacebook GitHub Bot a4cd5994a7 Revert D57327835 (#45884)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45884

Pull Request resolved: https://github.com/facebook/react-native/pull/44569
Changelog:
[Internal] -
Reverting this diff due to internal build crashes:

This converts the vertical of NativeArray/ReadableNativeArray/WritableNativeArray classes to Kotlin.

Reviewed By: bvanderhoof

Differential Revision: D60707170

fbshipit-source-id: 95e66ebe725d0ff625b50f4711872b9f70ec2f7c
2024-08-03 00:36:01 -07:00
Thomas NardoneandFacebook GitHub Bot 8d4fd07469 Fix up UIManagerModuleConstantsHelper + test (#45877)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45877

A couple fixes:
- Test was mixing up event names - refactored to make the code [hopefully] clearer
- Code potentially recreates `events` if it's a singleton map, but that was lost due to it not being returned

Changelog: [Internal] Minor fix to UIManagerModuleConstantsHelper

Reviewed By: cortinico

Differential Revision: D60609294

fbshipit-source-id: 3c82ba30b9401674e678585b1612324f885c9ae1
2024-08-02 13:58:32 -07:00
Thomas NardoneandFacebook GitHub Bot a696d2ed6b Deprecate MapBuilder and remove Kotlin usages (#45743)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45743

This is a Java-centric class that can be replaced by Kotlin's map extensions.

Changelog:
[Android][Deprecated] Deprecate MapBuilder

Reviewed By: cortinico

Differential Revision: D60309106

fbshipit-source-id: 4a764fa1d59993dc735b2181a2270dc79a0e0396
2024-08-02 13:58:32 -07:00
zhongwuzwandFacebook GitHub Bot a778979ed6 Fixes main thread stuck when reload in bridgeless mode (#45486)
Summary:
In fabric bridgeless mode, when we reload, main thread may block because of dead lock. the backtrace example as below:

```
(lldb) bt
* thread https://github.com/facebook/react-native/issues/1, stop reason = signal SIGSTOP
  * frame #0: 0x000000010a5c76f2 libsystem_kernel.dylib`__psynch_mutexwait + 10
    frame https://github.com/facebook/react-native/issues/1: 0x00000001099e0a70 libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_wait + 78
    frame https://github.com/facebook/react-native/issues/2: 0x00000001099de82b libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_slow + 217
    frame https://github.com/facebook/react-native/issues/3: 0x00007ff80030c6b9 libc++.1.dylib`std::__1::mutex::lock() + 9
    frame https://github.com/facebook/react-native/issues/4: 0x0000000106968b13 RNTester`std::__1::lock_guard<std::__1::mutex>::lock_guard[abi:ue170006](this=0x00007ff7b95e2478, __m=0x000060000377c958) at lock_guard.h:35:10
    frame https://github.com/facebook/react-native/issues/5: 0x00000001069689ed RNTester`std::__1::lock_guard<std::__1::mutex>::lock_guard[abi:ue170006](this=0x00007ff7b95e2478, __m=0x000060000377c958) at lock_guard.h:34:19
    frame https://github.com/facebook/react-native/issues/6: 0x00000001070691c1 RNTester`-[RCTInstance invalidate](self=0x000060000377c900, _cmd="invalidate") at RCTInstance.mm:146:31
    frame https://github.com/facebook/react-native/issues/7: 0x0000000107060fd2 RNTester`-[RCTHost didReceiveReloadCommand](self=0x0000600003d100f0, _cmd="didReceiveReloadCommand") at RCTHost.mm:317:3
    frame https://github.com/facebook/react-native/issues/8: 0x0000000106b005a5 RNTester`RCTTriggerReloadCommandListeners(reason=@"Global hotkey") at RCTReloadCommand.m:57:5
    frame https://github.com/facebook/react-native/issues/9: 0x0000000106b86da5 RNTester`__28-[RCTDevSettings initialize]_block_invoke.157(.block_descriptor=0x0000000107496170, params=0x00007ff84002f610) at RCTDevSettings.mm:201:11
    frame https://github.com/facebook/react-native/issues/10: 0x0000000106ae658e RNTester`__65-[RCTPackagerConnection reconnectingWebSocket:didReceiveMessage:]_block_invoke.68(.block_descriptor=0x0000600000c82df0) at RCTPackagerConnection.mm:293:9
    frame https://github.com/facebook/react-native/issues/11: 0x0000000109a4529d libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame https://github.com/facebook/react-native/issues/12: 0x0000000109a4658f libdispatch.dylib`_dispatch_client_callout + 8
    frame https://github.com/facebook/react-native/issues/13: 0x0000000109a563ee libdispatch.dylib`_dispatch_main_queue_drain + 1362
    frame https://github.com/facebook/react-native/issues/14: 0x0000000109a55e8e libdispatch.dylib`_dispatch_main_queue_callback_4CF + 31
    frame https://github.com/facebook/react-native/issues/15: 0x00007ff800429af4 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    frame https://github.com/facebook/react-native/issues/16: 0x00007ff80042442f CoreFoundation`__CFRunLoopRun + 2463
    frame https://github.com/facebook/react-native/issues/17: 0x00007ff8004236ad CoreFoundation`CFRunLoopRunSpecific + 557
    frame https://github.com/facebook/react-native/issues/18: 0x00007ff8103da08f GraphicsServices`GSEventRunModal + 137
    frame https://github.com/facebook/react-native/issues/19: 0x00007ff805cc0ad1 UIKitCore`-[UIApplication _run] + 972
    frame https://github.com/facebook/react-native/issues/20: 0x00007ff805cc5551 UIKitCore`UIApplicationMain + 123
    frame https://github.com/facebook/react-native/issues/21: 0x00000001069205a0 RNTester`main(argc=1, argv=0x00007ff7b95e3b60) at main.m:15:12
    frame https://github.com/facebook/react-native/issues/22: 0x00000001099023e0 dyld_sim`start_sim + 10
    frame https://github.com/facebook/react-native/issues/23: 0x0000000116b92366 dyld`start + 1942

(lldb) bt
* thread https://github.com/facebook/react-native/issues/3
    frame #0: 0x000000010a5c6b86 libsystem_kernel.dylib`__ulock_wait + 10
    frame https://github.com/facebook/react-native/issues/1: 0x0000000109a46eb1 libdispatch.dylib`_dlock_wait + 46
    frame https://github.com/facebook/react-native/issues/2: 0x0000000109a46d08 libdispatch.dylib`_dispatch_thread_event_wait_slow + 40
    frame https://github.com/facebook/react-native/issues/3: 0x0000000109a5774a libdispatch.dylib`__DISPATCH_WAIT_FOR_QUEUE__ + 371
    frame https://github.com/facebook/react-native/issues/4: 0x0000000109a57161 libdispatch.dylib`_dispatch_sync_f_slow + 240
    frame https://github.com/facebook/react-native/issues/5: 0x0000000106b3b33b RNTester`RCTUnsafeExecuteOnMainQueueSync(block=0x0000000106f116c0) at RCTUtils.m:291:5
  * frame https://github.com/facebook/react-native/issues/6: 0x0000000106f115ad RNTester`-[RCTFabricSurface start](self=0x000000010af0df40, _cmd="start") at RCTFabricSurface.mm:102:3
    frame https://github.com/facebook/react-native/issues/7: 0x00000001070601ce RNTester`__108-[RCTHost initWithBundleURLProvider:hostDelegate:turboModuleManagerDelegate:jsEngineProvider:launchOptions:]_block_invoke_2(.block_descriptor=0x0000600000c75590) at RCTHost.mm:211:9
    frame https://github.com/facebook/react-native/issues/8: 0x000000010706cdc8 RNTester`-[RCTInstance _loadScriptFromSource:](self=0x000060000377c900, _cmd="_loadScriptFromSource:", source=0x0000600000cd57d0) at RCTInstance.mm:472:5
    frame https://github.com/facebook/react-native/issues/9: 0x000000010706ca81 RNTester`__29-[RCTInstance _loadJSBundle:]_block_invoke.120(.block_descriptor=0x0000600000c96d00, error=0x0000000000000000, source=0x0000600000cd57d0) at RCTInstance.mm:452:9
    frame https://github.com/facebook/react-native/issues/10: 0x0000000106ab1919 RNTester`invocation function for block in attemptAsynchronousLoadOfBundleAtURL(.block_descriptor=0x00006000017b0fc0, statusCode=200, headers=6 key/value pairs, data=0x00006000002a4760, error=0x0000000000000000, done=YES) block_pointer, void (NSError*, RCTSource*) block_pointer) at RCTJavaScriptLoader.mm:318:9
    frame https://github.com/facebook/react-native/issues/11: 0x0000000106ad92a6 RNTester`__80-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]_block_invoke(.block_descriptor=0x000070000035c7a0, headers=6 key/value pairs, content=0x00006000002a4760, done=YES) at RCTMultipartDataTask.m:121:9
    frame https://github.com/facebook/react-native/issues/12: 0x0000000106ad9b4f RNTester`-[RCTMultipartStreamReader emitChunk:headers:callback:done:](self=0x00006000002b4220, _cmd="emitChunk:headers:callback:done:", data=0x00006000002a4020, headers=6 key/value pairs, callback=0x0000000106ad9230, done=YES) at RCTMultipartStreamReader.m:57:5
    frame https://github.com/facebook/react-native/issues/13: 0x0000000106ada800 RNTester`-[RCTMultipartStreamReader readAllPartsWithCompletionCallback:progressCallback:](self=0x00006000002b4220, _cmd="readAllPartsWithCompletionCallback:progressCallback:", callback=0x0000000106ad9230, progressCallback=0x0000000106ab2a60) at RCTMultipartStreamReader.m:154:7
    frame https://github.com/facebook/react-native/issues/14: 0x0000000106ad9130 RNTester`-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:](self=0x00006000017b0d40, _cmd="URLSession:streamTask:didBecomeInputStream:outputStream:", session=0x000000010e02a0a0, streamTask=0x000000010c83ba00, inputStream=0x000060000300d4d0, outputStream=0x000060000300c990) at RCTMultipartDataTask.m:119:20
    frame https://github.com/facebook/react-native/issues/15: 0x00007ff80479fdf9 CFNetwork`___lldb_unnamed_symbol2876 + 42
    frame https://github.com/facebook/react-native/issues/16: 0x0000000109a4529d libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame https://github.com/facebook/react-native/issues/17: 0x0000000109a4658f libdispatch.dylib`_dispatch_client_callout + 8
    frame https://github.com/facebook/react-native/issues/18: 0x0000000109a4e4ba libdispatch.dylib`_dispatch_lane_serial_drain + 1127
    frame https://github.com/facebook/react-native/issues/19: 0x0000000109a4f255 libdispatch.dylib`_dispatch_lane_invoke + 441
    frame https://github.com/facebook/react-native/issues/20: 0x0000000109a5c356 libdispatch.dylib`_dispatch_root_queue_drain_deferred_wlh + 318
    frame https://github.com/facebook/react-native/issues/21: 0x0000000109a5b751 libdispatch.dylib`_dispatch_workloop_worker_thread + 590
    frame https://github.com/facebook/react-native/issues/22: 0x00000001099dfb84 libsystem_pthread.dylib`_pthread_wqthread + 327
    frame https://github.com/facebook/react-native/issues/23: 0x00000001099deacf libsystem_pthread.dylib`start_wqthread + 15
```

## Changelog:

[IOS] [FIXED] - Fixes main thread stuck when reload in bridgeless mode

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

Test Plan: RNTester, enables fabric, which is very easy to repro by tapping `r`  command multiple times quickly to trigger reload.

Reviewed By: philIip

Differential Revision: D59911929

Pulled By: cipolleschi

fbshipit-source-id: e7e431a11d26c399fa767b6cbf45e16bce24b9a0
2024-08-02 13:48:31 -07:00
Ruslan ShestopalyukandFacebook GitHub Bot 878e1f3d93 Migrate NativeArray classes to Kotlin (#44569)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44569

# Changelog:
[Internal] -

This converts the vertical of NativeArray/ReadableNativeArray/WritableNativeArray classes to Kotlin.

NOTE: the `getArray`, `getMap` and `getString` being annotated as `NonNull` in the Java code is a scam - there is no guarantee that native side will send non-null to the Java side, and in practice, indeed, in certain cases it doesn't. So I opted to make it nullable instead - this way it's at least explicit and is not a ticking bomb hidden to explode behind the false sense of security.

Reviewed By: javache

Differential Revision: D57327835

fbshipit-source-id: 1b546b2ff22af2be903fe6ab91f0148b645595fb
2024-08-02 10:56:27 -07:00
Rubén NorteandFacebook GitHub Bot 631d4dea25 Migrate Web Performance API tests to Flow (#45875)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45875

Changelog: [internal]

Just adopting Flow in all tests in `react-native/src/private` :)

Reviewed By: rshest

Differential Revision: D60654714

fbshipit-source-id: 34a9ae618fbd254044e2faf801adccc12fc0e244
2024-08-02 10:19:49 -07:00
Rubén NorteandFacebook GitHub Bot ed63646fc2 Move ErrorHandlers to react-native/src/private (#45876)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45876

Changelog: [internal]

Reviewed By: dmytrorykun

Differential Revision: D60597776

fbshipit-source-id: 1093aee0f2b84312b55a2b0c22e2b1576c60e26e
2024-08-02 10:19:49 -07:00
Rubén NorteandFacebook GitHub Bot e14b5f1d6f Move default export of PerformanceObserver to named export (#45874)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45874

Changelog: [internal]

Move default export of `PerformanceObserver` to named export.

Reviewed By: sammy-SC

Differential Revision: D60597779

fbshipit-source-id: 39f82c1903aa32a5318b112cbb03b63e4e6d2fc0
2024-08-02 10:19:49 -07:00
Nicola CortiandFacebook GitHub Bot 52fc64c602 Unbreak build_android by not depending on PreferenceManager from androidx (#45872)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45872

build_android is currently broken, this should fix it.

Changelog:
[Internal] [Changed] - Unbreak build_android by not depending on PreferenceManager from androidx

Reviewed By: cipolleschi, hezi

Differential Revision: D60652912

fbshipit-source-id: a089609c6643c40c95919fdc882a89406f6ce871
2024-08-02 09:14:01 -07:00
Ruslan ShestopalyukandFacebook GitHub Bot 51278d3f30 Migrate UIManager interface to Kotlin (#44589)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44589

## Changelog:
[Internal] -

As in the title.

Reviewed By: tdn120

Differential Revision: D57434432

fbshipit-source-id: ce2504d5a27a9e8dd8d8d02b052b6cf9414491ab
2024-08-02 07:10:36 -07:00
Ruslan ShestopalyukandFacebook GitHub Bot de73e44569 Migrate Promise interface to Kotlin (#44587)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44587

# Changelog:
[Internal] -

As in the title, moving towards migrating all the interfaces in react.bridge.

Reviewed By: tdn120

Differential Revision: D57433401

fbshipit-source-id: 35581d27d6d093edb1cc59b245e6468758825f68
2024-08-02 06:38:55 -07:00
Antony M. KithinziandFacebook GitHub Bot 491c3e9d76 chore: migrate GenerateCodegenArtifactsTaskTest to assertj (#45845)
Summary:
Issue: https://github.com/facebook/react-native/issues/45596

## 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] - Migrated `packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt` to assertj.

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

Test Plan: Run `./gradlew -p packages/gradle-plugin test`

Reviewed By: hezi

Differential Revision: D60597025

Pulled By: cortinico

fbshipit-source-id: 4228b958c7b9e1506640b9ff217f098e2626ea81
2024-08-02 04:08:08 -07:00
Omar BafagihandFacebook GitHub Bot ea78d68906 Migrate PackagerConnectionSettings.java to Kotlin (#45800)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45800

convert PackagerConnectionSettings.java to PackagerConnectionSettings.kt

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D60296462

fbshipit-source-id: 77a4ef164cd3405c3b7c85ecb301ae6e1d965e57
2024-08-01 14:28:57 -07:00
Ruslan ShestopalyukandFacebook GitHub Bot c8a1da4c9e Migrate JavaTimerManager to Kotlin (#45820)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45820

# Changelog:
[Internal] -

As in the title.

Reviewed By: mdvacca

Differential Revision: D60449157

fbshipit-source-id: c3c8ae9bcc270d421ee71deef0159477206c6ca3
2024-08-01 14:03:13 -07:00
Nicola CortiandFacebook GitHub Bot 9679756682 Re-apply Use BackgroundStyleApplicator in View setters on ReactImageView.kt
Summary:
This re-applies D60495100 after I've fixed the history for `ReactImageView`.

bypass-github-export-checks

Changelog:
[Internal] [Changed] - Re-apply Use BackgroundStyleApplicator in View setters on ReactImageView.kt

Reviewed By: NickGerleman

Differential Revision: D60578453

fbshipit-source-id: 995f5e54ea6ca3161935e8b7814df390d827a463
2024-08-01 13:31:06 -07:00
Nicola CortiandFacebook GitHub Bot fd231c5eaf Convert com.facebook.react.views.image to Kotlin
Summary:
This converts the 3 remaining files inside `com.facebook.react.views.image` to Kotlin

bypass-github-export-checks

Changelog:
[Internal] [Changed] - Convert com.facebook.react.views.image to Kotlin

Reviewed By: NickGerleman

Differential Revision: D60578452

fbshipit-source-id: 6a5951f1f74561c1c45fe697e7cfc68fcec92412
2024-08-01 13:31:06 -07:00
Nicola CortiandFacebook GitHub Bot 6393a3cd78 Back out "Convert com.facebook.react.views.image to Kotlin"
Summary:
bypass-github-export-checks

Changelog:
[Internal] [Changed] - Back out "[RN][Android] Convert com.facebook.react.views.image to Kotlin"

Original commit changeset: 72450d37969b

Original Phabricator Diff: D60170084

Reviewed By: sammy-SC, rshest

Differential Revision: D60578451

fbshipit-source-id: b6c57eaf1e3cceff43b10680f6b9abf53cbf8605
2024-08-01 13:31:06 -07:00
Nick GerlemanandFacebook GitHub Bot 5f14963da0 Breaking: Set "enableBackgroundStyleApplicator" by default (#45866)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45866

This turns on enableBackgroundStyleApplicator() by default, which will get us more screenshot tests over existing apps, and let us add new screenshot tests for box-shadow against stock RNTester.

This is a breaking change, for the small number of libraries which use CSSBackgroundDrawable/ReactViewBackgroundDrawable off of a view directly, for setting or accessing styles (this was already unreliably), along with libraries which read `mBorderRadius` from views using reflection. This is more or less confined to Reanimated, react-native-navigation, and one internal library.

Users who want to access or mutate background styles should use the public `BackgroundStyleApplicator` instead.

Changelog:
[Android][Breaking] - Set "enableBackgroundStyleApplicator" by default

Reviewed By: joevilches

Differential Revision: D60365677

fbshipit-source-id: aab8588b27c1125920adb257406c53dadb356767
2024-08-01 12:06:40 -07:00
Abdelhafidh BelaliaandFacebook GitHub Bot 48669af562 Android: Fix uploading GIF URI (#45826)
Summary:
In Android, when constructing a multipart body for a file and that file source is a uri (base64-encoded) we do the following:
1. Decode the base64 string into bytes
2. Create a bitmap object
3. Compress the bitmap object as PNG into new bytes

The process does an unnecessary work (bytes -> bitmap -> bytes) and creates unexpected results e.g. a GIF file will be converted into PNG when uploaded. This PR removes the unnecessary steps (2 and 3).

## Changelog:

[ANDROID] [FIXED] - Fix uploading GIF URI

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

Test Plan:
1. Upload a GIF; use URI (base64-encoded)
2. Verify that the uploaded file is a GIF

```js
const formData = new FormData();
formData.append('photo', {
  uri: GIFURI,
  type: 'image/gif',
  name: 'photo.gif',
});

fetch(UPLOAD_URL,
{
    body: formData,
    method: "POST",
}):
```

| Before | After |
|:------:|:-----:|
|   <video src="https://github.com/user-attachments/assets/6ce4769a-8fa5-4d00-8066-9a1911608632" />     |  <video src="https://github.com/user-attachments/assets/76a29d14-ce9d-48cd-94d0-7591064a5b1b" />      |

Reviewed By: cortinico

Differential Revision: D60515478

Pulled By: tdn120

fbshipit-source-id: d6ad1c42631c184c3dcdf3a956641e25d0c1b926
2024-08-01 12:04:42 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 54a6438eaa Fix default imageSource on Filters example (#45799)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45799

No idea how I missed this but I don't think `defaultProps` is a thing in React Native? So the images were not showing

Changelog: [internal]

Reviewed By: joevilches

Differential Revision: D60392853

fbshipit-source-id: 27280033fb719340a809053d6ca98ac3f178c8c3
2024-08-01 10:38:53 -07:00
NishanandFacebook GitHub Bot bd0aedc8c3 feat: linear gradient android (#45433)
Summary:
- Adds `background` prop that supports CSS's linear gradient. Later this can be extended to support various other gradients and possibly CSS's background image (less motivation as better solutions exists for image)
- Extended `CSSBackgroundDrawable` to draw Linear Gradient shader while preserving the border style support.
- Style supports JS object to specify `LinearGradient`, so it can support Animated libraries.

## Changelog:
[ANDROID] [ADDED] - linear gradient

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

Test Plan:
- Check out `processBackground-test.js` for supported syntax testcases.
- Checkout examples added in `LinearGradientExample.js`

Although the PR is tested well but open to any changes/feedback on the approach taken.

iOS PR - https://github.com/facebook/react-native/pull/45433. Separated the PRs to keep it easier to review. Both PRs can be reviewed individually.

Reviewed By: joevilches

Differential Revision: D60493360

Pulled By: NickGerleman

fbshipit-source-id: 762929c4fe16d87cbbd9ebe83ecce96a9e13192c
2024-08-01 09:38:51 -07:00
Ruslan ShestopalyukandFacebook GitHub Bot 6483a28b3a Convert modules/core/ReactChoreographer to Kotlin (#45811)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45811

# Changelog:
[Internal] -

Converts both ReactChoreographer.java and ChoreographerCompat.java to Kotlin.

Reviewed By: mdvacca

Differential Revision: D60445731

fbshipit-source-id: 597c9f2ea1a89ee13a210a4b3e172ea239297ae7
2024-08-01 06:59:40 -07:00
Ruslan ShestopalyukandFacebook GitHub Bot c30ee464eb Kotlinify AnimationDriver (#45836)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45836

# Changelog:
[Internal] -

As in the title.

Reviewed By: cortinico

Differential Revision: D60502487

fbshipit-source-id: 003f2eade8f8425636b2023397ec29545175b487
2024-08-01 03:52:44 -07:00
Nick GerlemanandFacebook GitHub Bot fdfa0b17bb Enable BackgroundStyleApplicator and boxShadow for View (#45832)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45832

The main one! This allows box-shadow to be used in View, and uses BackgroundStyleApplicator (if flag is enabled) for background management.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D60491176

fbshipit-source-id: c068b1dc971253f1303de5bae62e42a9eceb0de6
2024-07-31 23:49:48 -07:00
Nick GerlemanandFacebook GitHub Bot 087193c98e Add missing invalidate() to setOverflow() (#45835)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45835

`ReactViewBackgroundManager` will do this for us (and otherwise doesn't do anything draw related), but this will be removed when BackgroundStyleApplicator is rolled out, and not all callers use `ReactViewBackgroundManager`.

Changelog:
[Android][Fixed]

Reviewed By: philIip

Differential Revision: D60489756

fbshipit-source-id: 37cfc2b90af057bc142ad95b93e32941edb17ca5
2024-07-31 23:49:48 -07:00
Nick GerlemanandFacebook GitHub Bot 7047b7eaeb BackgroundStyleApplicator and boxShadow in TextInput (#45831)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45831

Like the previous diffs, but for TextInput!

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D60489444

fbshipit-source-id: 13edc2fada0ef55a84916e6bdff151e4f8a16d34
2024-07-31 23:49:48 -07:00
Nick GerlemanandFacebook GitHub Bot f26027e3c0 BackgroundStyleApplicator and boxShadow in Text (#45830)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45830

Like the previous diffs, but for Text!

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D60488060

fbshipit-source-id: 9ce89f65f44df75a83f86f14d2cbdfbf96f32a7c
2024-07-31 23:49:48 -07:00
Nick GerlemanandFacebook GitHub Bot 5d1a3bd07b Use BackgroundStyleApplicator in View setters (#45834)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45834

These are very rarely called, outside of directly by the view manager, but they are still public, so we should make these work off the same composite drawable as the view managers (eventually BasrViewManager).

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D60495100

fbshipit-source-id: 90f51870dd9929d1f3657d8f5368ef46216c8544
2024-07-31 23:49:48 -07:00
Nick GerlemanandFacebook GitHub Bot b988e1cb58 Handle resetting boxShadow prop (#45829)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45829

`ReadableArray` here should be nullable, according to https://reactnative.dev/docs/next/native-components-android#3-expose-view-property-setters-using-reactprop-or-reactpropgroup-annotation

Filter is doing this correctly already.

That form will be used to reset state, back to no box shadows.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D60465486

fbshipit-source-id: b8024ad02a0eabc0da8dfca141d51387983cc031
2024-07-31 23:49:48 -07:00
Nick GerlemanandFacebook GitHub Bot 92dca53702 Add borderStartWidth and borderEndWidth support (#45854)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45854

Right now these border widths are incorporated into Yoga layout, but view manager never responds to it.

This adds the props supported by <View> to text, still missing many others. The underlying functions are aware of the spacing type,

I plan to fix this more thoroughly, across the different edges, properties, and different components, after we remove the legacy background stack, and all of these can live in a single place on BaseViewManager.

Changelog:
[Android][Fixed] - Add borderStartWidth and borderEndWidth support

Reviewed By: necolas

Differential Revision: D60560343

fbshipit-source-id: 8e1ebaa087e0728b5758850239c41aeae5d619a9
2024-07-31 22:32:23 -07:00
Kyle RosenbergandFacebook GitHub Bot 8d6ec66b48 Update AccessibilityInfo mocks to return promises (#45825)
Summary:
Many `AccessibilityInfo` functions (`isReduceMotionEnabled`, `isBoldTextEnabled`, etc.) return promises, but the mocked versions of them in jest/setup.js aren't returning promises.

All of these functions live in [packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js), where you can verify their return types are Promises.

When using `react-native/jest-preset` and running tests that utilize one of these functions, you'll get an error:
```
AccessibilityInfo.isReduceMotionEnabled().then() is not a function
```

https://github.com/facebook/react-native/pull/29381 was opened in 2020 but closed after becoming stale. My PR is nearly identical but covers additional Promise-returning functions that have been added to `AccessibilityInfo` since then.

## Changelog:

[GENERAL] [FIXED] - Update the react-native/jest-preset mock of AccessibilityInfo to better match its API

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

Test Plan:
I've tested by making the change locally in my project's `node_modules/react-native/jest/setup.js` file and confirming that I no longer get an error when running this test:
```
it("should pass", async () => {
  await AccessibilityInfo.isReduceMotionEnabled().then(enabled => {
    expect(enabled).toBe(false);
  });
});
```

Before:
```
TypeError: Cannot read properties of undefined (reading 'then')

  16 |
  17 |   it.only("should pass", async () => {
> 18 |     await AccessibilityInfo.isReduceMotionEnabled().then(enabled => {
     |                                                    ^
  19 |       expect(enabled).toBe(false);
  20 |     });
  21 |   });
```

After: No type error, and test passes.

Reviewed By: robhogan

Differential Revision: D60519836

Pulled By: tdn120

fbshipit-source-id: 24fc77b0f9693e131686a0a45b81fbd33ff65f01
2024-07-31 12:35:41 -07:00
Thomas NardoneandFacebook GitHub Bot 2f651c8783 Convert common.ShakeDetector (#45744)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45744

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D60311462

fbshipit-source-id: 142649a18b365b0954dd138c895030fad4780ed1
2024-07-31 11:28:07 -07:00
Thomas NardoneandFacebook GitHub Bot 2962d69b67 Convert Convert ReactBuildConfig, ClearableSynchronizedPool, DebugServerException (#45680)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45680

Changelog:
[Internal] [Changed] - Convert ReactBuildConfig, ClearableSynchronizedPool, DebugServerException to Kotlin

Reviewed By: rshest

Differential Revision: D60246428

fbshipit-source-id: de4584b84c18972b31370530b2ab4b2f9ab38b4a
2024-07-31 11:28:07 -07:00
Thomas NardoneandFacebook GitHub Bot 5812ee1969 Convert common.futures.SimpleSettableFuture (#45677)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45677

Changelog:
[Internal] [Changed] - Convert com.facebook.react.common.futures.SimpleSettableFuture to Kotlin

Reviewed By: rshest

Differential Revision: D60237075

fbshipit-source-id: e8a94fa3bb5d09da85b13d86b55a020d42a770cd
2024-07-31 11:28:07 -07:00
Thomas NardoneandFacebook GitHub Bot fbfb430b3b Convert common/assets/ReactFontManager.java (#45668)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45668

Changelog:
[Internal] [Changed] - Convert com.facebook.react.common.assets.ReactFontManager to Kotlin

Reviewed By: cortinico

Differential Revision: D60188666

fbshipit-source-id: 17ca6f162545e9185e1e0a24d8ebacf6cb49a064
2024-07-31 11:28:07 -07:00
Alan LeeandFacebook GitHub Bot 34e3a6cc88 provide default implementation for ReactHostDelegate.handleInstanceException() (#45521)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45521

[ReactHostDelegate.handleInstanceException()](https://github.com/facebook/react-native/blob/a6f5e5adebed3d9da411f99548e2d8ce96636e16/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHostDelegate.kt#L48) is a no-op so providing a default implementation for this.
As a simplified solution, just throw a `RuntimeException` (on non-debug bulid) in this case. Below is the justification.

1) We may want to consider using `ExceptionsManagerModule` TurboModule in OSS to report the exception but current implementation  just [throws JavaScriptException](https://github.com/facebook/react-native/blob/a6f5e5adebed3d9da411f99548e2d8ce96636e16/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java#L67) when it is fatal

2) If the exception happens during ReactInstance initialization then we may not have Turbo Module initialized and may not be able to access it. While we might want to fix how this works in longer term but for now just throw an Exception and let the app handle it.

3) In debug build, `DevSupportManager` is called before `handleInstanceException()` which would display a RedBox so don't throw when it is a debug build.

So it seems to best for now to just throw an exception so it can be handled by the app than silently ignoring it.

Changelog:
[Android][Added] - provide default implementation for ReactHostDelegate.handleInstanceException()

Reviewed By: javache

Differential Revision: D59847543

fbshipit-source-id: 0dd3c7688d13d159dfceb8defc8d0250273ef2ff
2024-07-31 11:23:34 -07:00