Skip to content

Commit 965141e

Browse files
javachemeta-codesync[bot]
authored andcommitted
Accept readable Android event payloads
Summary: Widen Android event payload contracts from `WritableMap` to `ReadableMap` across the event emitters, UI managers and Fabric dispatch pipeline, including `Event.getEventData`. Existing event producers can continue returning writable maps. Build native touch payloads as a complete `folly::dynamic` and return them through `ReadableNativeMap::createWithContents` without constructing and populating a writable Java map. Document Fabric’s native-backed, consumed-payload contract, update the touch test shadow to return a read-only native map and regenerate the Android API snapshot. Changelog: [Android][Breaking] - Change Android event payload APIs from `WritableMap` to `ReadableMap`; update custom emitter and UI manager implementations to match. Differential Revision: D128208007
1 parent 04c288e commit 965141e

21 files changed

Lines changed: 110 additions & 105 deletions

File tree

‎packages/react-native/ReactAndroid/api/ReactAndroid.api‎

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,8 +1372,8 @@ public abstract interface class com/facebook/react/bridge/UIManager : com/facebo
13721372
public abstract fun initialize ()V
13731373
public abstract fun invalidate ()V
13741374
public abstract fun markActiveTouchForTag (II)V
1375-
public abstract fun receiveEvent (IILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
1376-
public abstract fun receiveEvent (ILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
1375+
public abstract fun receiveEvent (IILjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V
1376+
public abstract fun receiveEvent (ILjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V
13771377
public abstract fun removeUIManagerEventListener (Lcom/facebook/react/bridge/UIManagerListener;)V
13781378
public abstract fun resolveCustomDirectEventName (Ljava/lang/String;)Ljava/lang/String;
13791379
public abstract fun resolveView (I)Landroid/view/View;
@@ -2275,11 +2275,11 @@ public class com/facebook/react/fabric/FabricUIManager : com/facebook/react/brid
22752275
public fun onRequestEventBeat ()V
22762276
public fun prependUIBlock (Lcom/facebook/react/fabric/interop/UIBlock;)V
22772277
public fun profileNextBatch ()V
2278-
public fun receiveEvent (IILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
2279-
public fun receiveEvent (IILjava/lang/String;ZLcom/facebook/react/bridge/WritableMap;I)V
2280-
public fun receiveEvent (IILjava/lang/String;ZLcom/facebook/react/bridge/WritableMap;IZ)V
2281-
public fun receiveEvent (IILjava/lang/String;ZLcom/facebook/react/bridge/WritableMap;IZJ)V
2282-
public fun receiveEvent (ILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
2278+
public fun receiveEvent (IILjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V
2279+
public fun receiveEvent (IILjava/lang/String;ZLcom/facebook/react/bridge/ReadableMap;I)V
2280+
public fun receiveEvent (IILjava/lang/String;ZLcom/facebook/react/bridge/ReadableMap;IZ)V
2281+
public fun receiveEvent (IILjava/lang/String;ZLcom/facebook/react/bridge/ReadableMap;IZJ)V
2282+
public fun receiveEvent (ILjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V
22832283
public fun removeUIManagerEventListener (Lcom/facebook/react/bridge/UIManagerListener;)V
22842284
public fun resolveCustomDirectEventName (Ljava/lang/String;)Ljava/lang/String;
22852285
public fun resolveView (I)Landroid/view/View;
@@ -3503,6 +3503,7 @@ public final class com/facebook/react/uimanager/NativeViewHierarchyOptimizer {
35033503

35043504
public final class com/facebook/react/uimanager/OnLayoutEvent : com/facebook/react/uimanager/events/Event {
35053505
public static final field Companion Lcom/facebook/react/uimanager/OnLayoutEvent$Companion;
3506+
public synthetic fun getEventData ()Lcom/facebook/react/bridge/ReadableMap;
35063507
public fun getEventName ()Ljava/lang/String;
35073508
public static final fun obtain (IIIII)Lcom/facebook/react/uimanager/OnLayoutEvent;
35083509
public static final fun obtain (IIIIII)Lcom/facebook/react/uimanager/OnLayoutEvent;
@@ -4275,8 +4276,8 @@ public class com/facebook/react/uimanager/UIManagerModule : com/facebook/react/b
42754276
public fun onHostResume ()V
42764277
public fun prependUIBlock (Lcom/facebook/react/uimanager/UIBlock;)V
42774278
public fun profileNextBatch ()V
4278-
public fun receiveEvent (IILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
4279-
public fun receiveEvent (ILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
4279+
public fun receiveEvent (IILjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V
4280+
public fun receiveEvent (ILjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V
42804281
public fun removeRootView (I)V
42814282
public fun removeUIManagerEventListener (Lcom/facebook/react/bridge/UIManagerListener;)V
42824283
public fun resolveCustomDirectEventName (Ljava/lang/String;)Ljava/lang/String;
@@ -4679,6 +4680,7 @@ public abstract interface class com/facebook/react/uimanager/events/BatchEventDi
46794680
public final class com/facebook/react/uimanager/events/ContentSizeChangeEvent : com/facebook/react/uimanager/events/Event {
46804681
public fun <init> (III)V
46814682
public fun <init> (IIII)V
4683+
public synthetic fun getEventData ()Lcom/facebook/react/bridge/ReadableMap;
46824684
public fun getEventName ()Ljava/lang/String;
46834685
}
46844686

@@ -4695,7 +4697,7 @@ public abstract class com/facebook/react/uimanager/events/Event {
46954697
public fun getCoalescingKey ()S
46964698
public fun getEventAnimationDriverMatchSpec ()Lcom/facebook/react/uimanager/events/Event$EventAnimationDriverMatchSpec;
46974699
protected fun getEventCategory ()I
4698-
protected fun getEventData ()Lcom/facebook/react/bridge/WritableMap;
4700+
protected fun getEventData ()Lcom/facebook/react/bridge/ReadableMap;
46994701
public abstract fun getEventName ()Ljava/lang/String;
47004702
public final fun getSurfaceId ()I
47014703
public final fun getTimestampMs ()J
@@ -4734,7 +4736,7 @@ public final class com/facebook/react/uimanager/events/NativeGestureUtil {
47344736
}
47354737

47364738
public abstract interface class com/facebook/react/uimanager/events/RCTEventEmitter : com/facebook/react/bridge/JavaScriptModule {
4737-
public abstract fun receiveEvent (ILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
4739+
public abstract fun receiveEvent (ILjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V
47384740
public fun receiveTouches (Ljava/lang/String;Lcom/facebook/react/bridge/WritableArray;Lcom/facebook/react/bridge/WritableArray;)V
47394741
}
47404742

@@ -4743,16 +4745,16 @@ public final class com/facebook/react/uimanager/events/RCTEventEmitter$DefaultIm
47434745
}
47444746

47454747
public abstract interface class com/facebook/react/uimanager/events/RCTModernEventEmitter : com/facebook/react/uimanager/events/RCTEventEmitter {
4746-
public fun receiveEvent (IILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
4747-
public abstract fun receiveEvent (IILjava/lang/String;ZILcom/facebook/react/bridge/WritableMap;I)V
4748-
public fun receiveEvent (IILjava/lang/String;ZILcom/facebook/react/bridge/WritableMap;IJ)V
4749-
public fun receiveEvent (ILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
4748+
public fun receiveEvent (IILjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V
4749+
public abstract fun receiveEvent (IILjava/lang/String;ZILcom/facebook/react/bridge/ReadableMap;I)V
4750+
public fun receiveEvent (IILjava/lang/String;ZILcom/facebook/react/bridge/ReadableMap;IJ)V
4751+
public fun receiveEvent (ILjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V
47504752
}
47514753

47524754
public final class com/facebook/react/uimanager/events/RCTModernEventEmitter$DefaultImpls {
4753-
public static fun receiveEvent (Lcom/facebook/react/uimanager/events/RCTModernEventEmitter;IILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
4754-
public static fun receiveEvent (Lcom/facebook/react/uimanager/events/RCTModernEventEmitter;IILjava/lang/String;ZILcom/facebook/react/bridge/WritableMap;IJ)V
4755-
public static fun receiveEvent (Lcom/facebook/react/uimanager/events/RCTModernEventEmitter;ILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
4755+
public static fun receiveEvent (Lcom/facebook/react/uimanager/events/RCTModernEventEmitter;IILjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V
4756+
public static fun receiveEvent (Lcom/facebook/react/uimanager/events/RCTModernEventEmitter;IILjava/lang/String;ZILcom/facebook/react/bridge/ReadableMap;IJ)V
4757+
public static fun receiveEvent (Lcom/facebook/react/uimanager/events/RCTModernEventEmitter;ILjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V
47564758
public static fun receiveTouches (Lcom/facebook/react/uimanager/events/RCTModernEventEmitter;Ljava/lang/String;Lcom/facebook/react/bridge/WritableArray;Lcom/facebook/react/bridge/WritableArray;)V
47574759
}
47584760

@@ -5238,6 +5240,7 @@ public final class com/facebook/react/views/image/ImageLoadEvent : com/facebook/
52385240
public static final fun createProgressEvent (ILjava/lang/String;II)Lcom/facebook/react/views/image/ImageLoadEvent;
52395241
public static final fun eventNameForType (I)Ljava/lang/String;
52405242
public fun getCoalescingKey ()S
5243+
public synthetic fun getEventData ()Lcom/facebook/react/bridge/ReadableMap;
52415244
public fun getEventName ()Ljava/lang/String;
52425245
}
52435246

@@ -5924,6 +5927,7 @@ public final class com/facebook/react/views/scroll/ReactScrollViewManager$Compan
59245927
public final class com/facebook/react/views/scroll/ScrollEvent : com/facebook/react/uimanager/events/Event {
59255928
public static final field Companion Lcom/facebook/react/views/scroll/ScrollEvent$Companion;
59265929
public fun canCoalesce ()Z
5930+
public synthetic fun getEventData ()Lcom/facebook/react/bridge/ReadableMap;
59275931
public fun getEventName ()Ljava/lang/String;
59285932
public static final fun obtain (IILcom/facebook/react/views/scroll/ScrollEventType;FFFFIIII)Lcom/facebook/react/views/scroll/ScrollEvent;
59295933
public static final fun obtain (ILcom/facebook/react/views/scroll/ScrollEventType;FFFFIIII)Lcom/facebook/react/views/scroll/ScrollEvent;

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/EventAnimationDriver.kt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import com.facebook.react.bridge.ReadableArray
1111
import com.facebook.react.bridge.ReadableMap
1212
import com.facebook.react.bridge.ReadableType
1313
import com.facebook.react.bridge.UnexpectedNativeTypeException
14-
import com.facebook.react.bridge.WritableMap
1514
import com.facebook.react.uimanager.events.EventCategoryDef
1615
import com.facebook.react.uimanager.events.RCTModernEventEmitter
1716

@@ -29,7 +28,7 @@ internal class EventAnimationDriver(
2928
eventName: String,
3029
canCoalesceEvent: Boolean,
3130
customCoalesceKey: Int,
32-
params: WritableMap?,
31+
params: ReadableMap?,
3332
@EventCategoryDef category: Int,
3433
) {
3534
requireNotNull(params) { "Native animated events must have event data." }

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManager.kt‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public interface UIManager : PerformanceCounter {
2525
@ThreadConfined(ThreadConfined.UI)
2626
@Deprecated(
2727
"This legacy surface API will be removed in a future release. " +
28-
"Use ReactHost.createSurface(...) and ReactSurface.start() instead."
28+
"Use ReactHost.createSurface(...) and ReactSurface.start() instead.",
2929
)
3030
public fun <T : View> addRootView(rootView: T, initialProps: WritableMap?): Int
3131

@@ -37,7 +37,7 @@ public interface UIManager : PerformanceCounter {
3737
@AnyThread
3838
@Deprecated(
3939
"This legacy surface API will be removed in a future release. " +
40-
"Use ReactHost.createSurface(...) and ReactSurface.start() instead."
40+
"Use ReactHost.createSurface(...) and ReactSurface.start() instead.",
4141
)
4242
public fun <T : View?> startSurface(
4343
rootView: T,
@@ -55,7 +55,7 @@ public interface UIManager : PerformanceCounter {
5555
*/
5656
@AnyThread
5757
@Deprecated(
58-
"This legacy surface API will be removed in a future release. Use ReactSurface.stop() instead."
58+
"This legacy surface API will be removed in a future release. Use ReactSurface.stop() instead.",
5959
)
6060
public fun stopSurface(surfaceId: Int)
6161

@@ -156,10 +156,11 @@ public interface UIManager : PerformanceCounter {
156156
*
157157
* @param reactTag tag
158158
* @param eventName name of the event
159-
* @param event parameters
159+
* @param event native-backed event parameters; Fabric consumes the payload during dispatch, so it
160+
* must not be reused afterwards
160161
*/
161162
@Deprecated("", ReplaceWith("receiveEvent(surfaceId, reactTag, eventName, event)"))
162-
public fun receiveEvent(reactTag: Int, eventName: String, event: WritableMap?)
163+
public fun receiveEvent(reactTag: Int, eventName: String, event: ReadableMap?)
163164

164165
/**
165166
* This method dispatches events from RN Android code to JS. The delivery of this event will not
@@ -168,9 +169,10 @@ public interface UIManager : PerformanceCounter {
168169
* @param surfaceId
169170
* @param reactTag tag
170171
* @param eventName name of the event
171-
* @param event parameters
172+
* @param event native-backed event parameters; Fabric consumes the payload during dispatch, so it
173+
* must not be reused afterwards
172174
*/
173-
public fun receiveEvent(surfaceId: Int, reactTag: Int, eventName: String, event: WritableMap?)
175+
public fun receiveEvent(surfaceId: Int, reactTag: Int, eventName: String, event: ReadableMap?)
174176

175177
/** Resolves Direct Event name exposed to JS from the one known to the Native side. */
176178
@Deprecated("") public fun resolveCustomDirectEventName(eventName: String): String?

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,14 +1180,14 @@ public void updateRootLayoutSpecs(
11801180

11811181
@Deprecated
11821182
@Override
1183-
public void receiveEvent(int reactTag, String eventName, @Nullable WritableMap params) {
1183+
public void receiveEvent(int reactTag, String eventName, @Nullable ReadableMap params) {
11841184
receiveEvent(View.NO_ID, reactTag, eventName, false, params, EventCategoryDef.UNSPECIFIED);
11851185
}
11861186

11871187
@Deprecated
11881188
@Override
11891189
public void receiveEvent(
1190-
int surfaceId, int reactTag, String eventName, @Nullable WritableMap params) {
1190+
int surfaceId, int reactTag, String eventName, @Nullable ReadableMap params) {
11911191
receiveEvent(surfaceId, reactTag, eventName, false, params, EventCategoryDef.UNSPECIFIED);
11921192
}
11931193

@@ -1212,7 +1212,7 @@ public void receiveEvent(
12121212
int reactTag,
12131213
String eventName,
12141214
boolean canCoalesceEvent,
1215-
@Nullable WritableMap params,
1215+
@Nullable ReadableMap params,
12161216
@EventCategoryDef int eventCategory) {
12171217
receiveEvent(
12181218
surfaceId,
@@ -1248,7 +1248,7 @@ public void receiveEvent(
12481248
int reactTag,
12491249
String eventName,
12501250
boolean canCoalesceEvent,
1251-
@Nullable WritableMap params,
1251+
@Nullable ReadableMap params,
12521252
@EventCategoryDef int eventCategory,
12531253
boolean experimentalIsSynchronous) {
12541254
receiveEvent(
@@ -1284,7 +1284,7 @@ public void receiveEvent(
12841284
int reactTag,
12851285
String eventName,
12861286
boolean canCoalesceEvent,
1287-
@Nullable WritableMap params,
1287+
@Nullable ReadableMap params,
12881288
@EventCategoryDef int eventCategory,
12891289
boolean experimentalIsSynchronous,
12901290
long eventTimestamp) {

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventEmitterWrapper.kt‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import android.annotation.SuppressLint
1111
import com.facebook.jni.HybridClassBase
1212
import com.facebook.proguard.annotations.DoNotStripAny
1313
import com.facebook.react.bridge.NativeMap
14+
import com.facebook.react.bridge.ReadableMap
1415
import com.facebook.react.bridge.UiThreadUtil
15-
import com.facebook.react.bridge.WritableMap
1616
import com.facebook.react.fabric.FabricSoLoader.staticInit
1717
import com.facebook.react.uimanager.events.EventCategoryDef
1818

@@ -46,14 +46,14 @@ internal class EventEmitterWrapper private constructor() : HybridClassBase() {
4646
* Invokes the execution of the C++ EventEmitter.
4747
*
4848
* @param eventName [String] name of the event to execute.
49-
* @param params [WritableMap] payload of the event
49+
* @param params [ReadableMap] payload of the event
5050
* @param eventCategory event category
5151
* @param eventTimestamp timestamp when the event was triggered (in milliseconds since boot)
5252
*/
5353
@Synchronized
5454
fun dispatch(
5555
eventName: String,
56-
params: WritableMap?,
56+
params: ReadableMap?,
5757
@EventCategoryDef eventCategory: Int,
5858
eventTimestamp: Long,
5959
) {
@@ -64,7 +64,7 @@ internal class EventEmitterWrapper private constructor() : HybridClassBase() {
6464
}
6565

6666
@Synchronized
67-
fun dispatchEventSynchronously(eventName: String, params: WritableMap?, eventTimestamp: Long) {
67+
fun dispatchEventSynchronously(eventName: String, params: ReadableMap?, eventTimestamp: Long) {
6868
if (!isValid) {
6969
return
7070
}
@@ -77,11 +77,11 @@ internal class EventEmitterWrapper private constructor() : HybridClassBase() {
7777
* target.
7878
*
7979
* @param eventName [String] name of the event to execute.
80-
* @param params [WritableMap] payload of the event
80+
* @param params [ReadableMap] payload of the event
8181
* @param eventTimestamp timestamp when the event was triggered (in milliseconds since boot)
8282
*/
8383
@Synchronized
84-
fun dispatchUnique(eventName: String, params: WritableMap?, eventTimestamp: Long) {
84+
fun dispatchUnique(eventName: String, params: ReadableMap?, eventTimestamp: Long) {
8585
if (!isValid) {
8686
return
8787
}

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/events/FabricEventEmitter.kt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
package com.facebook.react.fabric.events
99

1010
import android.os.SystemClock
11-
import com.facebook.react.bridge.WritableMap
11+
import com.facebook.react.bridge.ReadableMap
1212
import com.facebook.react.fabric.FabricUIManager
1313
import com.facebook.react.uimanager.events.EventCategoryDef
1414
import com.facebook.react.uimanager.events.RCTModernEventEmitter
@@ -22,7 +22,7 @@ internal class FabricEventEmitter(private val uiManager: FabricUIManager) : RCTM
2222
eventName: String,
2323
canCoalesceEvent: Boolean,
2424
customCoalesceKey: Int,
25-
params: WritableMap?,
25+
params: ReadableMap?,
2626
@EventCategoryDef category: Int,
2727
) {
2828
receiveEvent(
@@ -43,7 +43,7 @@ internal class FabricEventEmitter(private val uiManager: FabricUIManager) : RCTM
4343
eventName: String,
4444
canCoalesceEvent: Boolean,
4545
customCoalesceKey: Int,
46-
params: WritableMap?,
46+
params: ReadableMap?,
4747
@EventCategoryDef category: Int,
4848
eventTimestamp: Long,
4949
) {

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.kt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import com.facebook.react.bridge.ReadableArray
1818
import com.facebook.react.bridge.ReadableMap
1919
import com.facebook.react.bridge.RetryableMountingLayerException
2020
import com.facebook.react.bridge.UiThreadUtil.assertOnUiThread
21-
import com.facebook.react.bridge.WritableMap
2221
import com.facebook.react.fabric.events.EventEmitterWrapper
2322
import com.facebook.react.fabric.mounting.mountitems.MountItem
2423
import com.facebook.react.touch.JSResponderHandler
@@ -342,7 +341,7 @@ internal class MountingManager(
342341
reactTag: Int,
343342
eventName: String,
344343
canCoalesceEvent: Boolean,
345-
params: WritableMap?,
344+
params: ReadableMap?,
346345
@EventCategoryDef eventCategory: Int,
347346
eventTimestamp: Long,
348347
) {

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ internal constructor(
11711171
reactTag: Int,
11721172
eventName: String,
11731173
canCoalesceEvent: Boolean,
1174-
params: WritableMap?,
1174+
params: ReadableMap?,
11751175
@EventCategoryDef eventCategory: Int,
11761176
eventTimestamp: Long,
11771177
) {
@@ -1252,7 +1252,7 @@ internal constructor(
12521252

12531253
private class PendingViewEvent(
12541254
private val eventName: String,
1255-
private val params: WritableMap?,
1255+
private val params: ReadableMap?,
12561256
@field:EventCategoryDef private val eventCategory: Int,
12571257
private val canCoalesceEvent: Boolean,
12581258
private val eventTimestamp: Long,

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/interop/InteropEvent.kt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
package com.facebook.react.internal.interop
99

10-
import com.facebook.react.bridge.WritableMap
10+
import com.facebook.react.bridge.ReadableMap
1111
import com.facebook.react.common.annotations.internal.InteropLegacyArchitecture
1212
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
1313
import com.facebook.react.uimanager.events.Event
@@ -20,14 +20,14 @@ import com.facebook.react.uimanager.events.Event
2020
@InteropLegacyArchitecture
2121
internal class InteropEvent(
2222
@get:JvmName("eventName") val interopEventName: String,
23-
@get:JvmName("eventData") val eventData: WritableMap?,
23+
@get:JvmName("eventData") val eventData: ReadableMap?,
2424
surfaceId: Int,
2525
viewTag: Int,
2626
) : Event<InteropEvent>(surfaceId, viewTag) {
2727

2828
override fun getEventName(): String = interopEventName
2929

30-
override fun getEventData(): WritableMap? = eventData
30+
override fun getEventData(): ReadableMap? = eventData
3131

3232
private companion object {
3333
init {

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/interop/InteropEventEmitter.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
package com.facebook.react.internal.interop
1111

1212
import com.facebook.react.bridge.ReactContext
13-
import com.facebook.react.bridge.WritableMap
13+
import com.facebook.react.bridge.ReadableMap
1414
import com.facebook.react.common.annotations.VisibleForTesting
1515
import com.facebook.react.common.annotations.internal.InteropLegacyArchitecture
1616
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
@@ -34,7 +34,7 @@ internal class InteropEventEmitter(private val reactContext: ReactContext) : RCT
3434
private var eventDispatcherOverride: EventDispatcher? = null
3535

3636
@Deprecated("Deprecated in Java")
37-
override fun receiveEvent(targetTag: Int, eventName: String, params: WritableMap?) {
37+
override fun receiveEvent(targetTag: Int, eventName: String, params: ReadableMap?) {
3838
val dispatcher = eventDispatcherOverride ?: UIManagerHelper.getEventDispatcher(reactContext)
3939
val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
4040
dispatcher?.dispatchEvent(InteropEvent(eventName, params, surfaceId, targetTag))

0 commit comments

Comments
 (0)