Skip to content

Commit 291276d

Browse files
cortinicometa-codesync[bot]
authored andcommitted
Make CustomEventNamesResolver a fun interface for SAM conversion
Summary: `UIManagerModule` was recently converted from Java to Kotlin. The nested `CustomEventNamesResolver` interface has a single abstract method, but was declared as a regular `interface` rather than `fun interface`. In Java, single-method interfaces support SAM (Single Abstract Method) conversion in Kotlin callers. After the Kotlin conversion, SAM conversion no longer works unless the interface is declared as `fun interface`. This breaks downstream libraries like `react-native-reanimated` that use lambda syntax to instantiate `CustomEventNamesResolver`: ``` UIManagerModule.CustomEventNamesResolver { eventName -> ... } ``` Adding `fun` restores SAM conversion support. This is backward compatible — existing `object : CustomEventNamesResolver { ... }` code continues to work. Differential Revision: D107891295
1 parent 2546ce4 commit 291276d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ import java.util.concurrent.CopyOnWriteArrayList
8585
public open class UIManagerModule : ReactContextBaseJavaModule, LifecycleEventListener, UIManager {
8686

8787
/** Resolves a name coming from native side to a name of the event that is exposed to JS. */
88-
public interface CustomEventNamesResolver {
88+
public fun interface CustomEventNamesResolver {
8989
/** Returns custom event name by the provided event name. */
9090
public fun resolveCustomEventName(eventName: String): String?
9191
}

0 commit comments

Comments
 (0)