Refactor ReactAndroid to use buildReadableMap, buildReadableArray DSL (#51145)

Summary:
This PR refactors the entire ReactAndroid package to replace manual `Arguments.createMap()…` and `Arguments.createArray()…` calls with the new Kotlin DSL helpers `buildReadableMap { … }` and `buildReadableArray { … }`. All eligible call sites have been migrated to the DSL, except in functions whose signatures explicitly declare or return WritableMap or WritableArray.

No runtime behavior changes are introduced; existing functionality and tests continue to pass unchanged.

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

[ANDROID] [CHANGED] Apply Collections DSL on ReactAndroid package

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

Test Plan:
```
yarn android
yarn test-android
```

Reviewed By: rshest

Differential Revision: D74401357

Pulled By: cortinico

fbshipit-source-id: 0f7b7dfbb7b495675bc4730bdf018666e9041884
This commit is contained in:
HyunWoo Lee authored and Facebook GitHub Bot committed 2025-05-12 16:35:07 -07:00
1 parent d362e496eb
commit b2ffd34a39
19 files changed
+289 -235

No files matched your search

@@ -1353,6 +1353,8 @@ public final class com/facebook/react/bridge/ReadableArrayBuilder {
public final fun add (D)V
public final fun add (I)V
public final fun add (J)V
public final fun add (Lcom/facebook/react/bridge/ReadableArray;)V
public final fun add (Lcom/facebook/react/bridge/ReadableMap;)V
public final fun add (Ljava/lang/String;)V
public final fun add (Z)V
public final fun addArray (Lkotlin/jvm/functions/Function1;)V
@@ -1386,6 +1388,8 @@ public final class com/facebook/react/bridge/ReadableMapBuilder {
public final fun put (Ljava/lang/String;D)V
public final fun put (Ljava/lang/String;I)V
public final fun put (Ljava/lang/String;J)V
public final fun put (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
public final fun put (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V
public final fun put (Ljava/lang/String;Ljava/lang/String;)V
public final fun put (Ljava/lang/String;Z)V
public final fun putArray (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V