Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.76] Undo breaking change on UIManager eventDispatcher accessor #47090

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.annotation.AnyThread
import androidx.annotation.UiThread
import com.facebook.infer.annotation.ThreadConfined
import com.facebook.react.common.annotations.UnstableReactNativeAPI
import com.facebook.react.uimanager.events.EventDispatcher

@OptIn(UnstableReactNativeAPI::class)
public interface UIManager : PerformanceCounter {
Expand Down Expand Up @@ -78,7 +79,7 @@ public interface UIManager : PerformanceCounter {
public fun dispatchCommand(reactTag: Int, commandId: String, commandArgs: ReadableArray?)

/** @return the [EventDispatcher] object that is used by this class. */
public fun <T> getEventDispatcher(): T
public val eventDispatcher: EventDispatcher

/**
* Used by native animated module to bypass the process of updating the values through the shadow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,6 @@ public void onHostResume() {

@Override
@NonNull
@SuppressWarnings("unchecked")
public EventDispatcher getEventDispatcher() {
return mEventDispatcher;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class RootViewTest {
val eventEmitterModuleMock = mock(RCTEventEmitter::class.java)
whenever(catalystInstanceMock.getNativeModule(UIManagerModule::class.java))
.thenReturn(uiManager)
whenever(uiManager.getEventDispatcher()).thenReturn(eventDispatcher)
whenever(uiManager.eventDispatcher).thenReturn(eventDispatcher)

// RootView IDs is React Native follow the 11, 21, 31, ... progression.
val rootViewId = 11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class NativeAnimatedNodeTraversalTest {

uiManagerMock = mock(UIManagerModule::class.java)
eventDispatcherMock = mock(EventDispatcher::class.java)
whenever(uiManagerMock.getEventDispatcher()).thenAnswer { eventDispatcherMock }
whenever(uiManagerMock.eventDispatcher).thenAnswer { eventDispatcherMock }
whenever(uiManagerMock.constants).thenAnswer {
mapOf("customDirectEventTypes" to emptyMap<Any, Any>())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ class TouchEventDispatchTest {
spy(FabricUIManager(reactContext, viewManagerRegistry, batchEventDispatchedListener))
uiManager.initialize()

eventDispatcher = uiManager.getEventDispatcher()
eventDispatcher = uiManager.eventDispatcher

// Ignore scheduled choreographer work
val reactChoreographerMock = mock(ReactChoreographer::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.facebook.react.bridge.UIManagerListener
import com.facebook.react.bridge.WritableMap
import com.facebook.react.common.annotations.UnstableReactNativeAPI
import com.facebook.react.fabric.interop.UIBlockViewResolver
import com.facebook.react.uimanager.events.EventDispatcher

@OptIn(UnstableReactNativeAPI::class)
class FakeUIManager : UIManager, UIBlockViewResolver {
Expand Down Expand Up @@ -65,7 +66,10 @@ class FakeUIManager : UIManager, UIBlockViewResolver {
error("Not yet implemented")
}

override fun <T : Any?> getEventDispatcher(): T {
override val eventDispatcher: EventDispatcher
get() = TODO("Not yet implemented")

fun <T : Any?> getEventDispatcher(): T {
error("Not yet implemented")
}

Expand Down
Loading