-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
65 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 0 additions & 74 deletions
74
...ative/ReactAndroid/src/main/java/com/facebook/react/fabric/events/FabricEventEmitter.java
This file was deleted.
Oops, something went wrong.
64 changes: 64 additions & 0 deletions
64
...-native/ReactAndroid/src/main/java/com/facebook/react/fabric/events/FabricEventEmitter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.facebook.react.fabric.events | ||
|
||
import com.facebook.react.bridge.WritableArray | ||
import com.facebook.react.bridge.WritableMap | ||
import com.facebook.react.fabric.FabricUIManager | ||
import com.facebook.react.uimanager.common.ViewUtil | ||
import com.facebook.react.uimanager.events.EventCategoryDef | ||
import com.facebook.react.uimanager.events.RCTModernEventEmitter | ||
import com.facebook.react.uimanager.events.TouchEvent | ||
import com.facebook.systrace.Systrace | ||
|
||
public class FabricEventEmitter(private val uiManager: FabricUIManager) : RCTModernEventEmitter { | ||
public override fun receiveEvent(reactTag: Int, eventName: String, params: WritableMap?): Unit { | ||
receiveEvent(ViewUtil.NO_SURFACE_ID, reactTag, eventName, params) | ||
} | ||
|
||
public override fun receiveEvent( | ||
surfaceId: Int, | ||
reactTag: Int, | ||
eventName: String, | ||
params: WritableMap? | ||
) { | ||
receiveEvent(surfaceId, reactTag, eventName, false, 0, params, EventCategoryDef.UNSPECIFIED) | ||
} | ||
|
||
public override fun receiveEvent( | ||
surfaceId: Int, | ||
reactTag: Int, | ||
eventName: String, | ||
canCoalesceEvent: Boolean, | ||
customCoalesceKey: Int, | ||
params: WritableMap?, | ||
@EventCategoryDef category: Int | ||
) { | ||
Systrace.beginSection( | ||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricEventEmitter.receiveEvent('$eventName')") | ||
try { | ||
uiManager.receiveEvent(surfaceId, reactTag, eventName, canCoalesceEvent, params, category) | ||
} finally { | ||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE) | ||
} | ||
} | ||
|
||
/** Touches are dispatched by [.receiveTouches] */ | ||
public override fun receiveTouches( | ||
eventName: String, | ||
touches: WritableArray, | ||
changedIndices: WritableArray | ||
): Unit { | ||
throw UnsupportedOperationException("EventEmitter#receiveTouches is not supported by Fabric") | ||
} | ||
|
||
public override fun receiveTouches(event: TouchEvent): Unit { | ||
// Calls are expected to go via TouchesHelper | ||
throw UnsupportedOperationException("EventEmitter#receiveTouches is not supported by Fabric") | ||
} | ||
} |