Make CustomEventNamesResolver a fun interface for SAM conversion (#57112)

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

`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.

Reviewed By: cipolleschi

Differential Revision: D107891295

fbshipit-source-id: da3f76aad4716a9646fd3841df3e13f610642453
This commit is contained in:
Nicola Corti authored and meta-codesync[bot] committed 2026-06-08 10:01:26 -07:00
1 parent 9f20cde724
commit df4cadc126
1 file changed
+1 -1
@@ -85,7 +85,7 @@ import java.util.concurrent.CopyOnWriteArrayList
public open class UIManagerModule : ReactContextBaseJavaModule, LifecycleEventListener, UIManager {
/** Resolves a name coming from native side to a name of the event that is exposed to JS. */
public interface CustomEventNamesResolver {
public fun interface CustomEventNamesResolver {
/** Returns custom event name by the provided event name. */
public fun resolveCustomEventName(eventName: String): String?
}