mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
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:
1 parent
9f20cde724
commit
df4cadc126
1 file changed
+1
-1
+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?
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user