Skip to content
This repository was archived by the owner on Aug 13, 2024. It is now read-only.

Commit 7816030

Browse files
committed
fix: support 0.63.x compatibility
1 parent cbff1d5 commit 7816030

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

android/src/main/java/com/scrollviewenhancer/MaintainVisibleScrollPositionHelper.kt

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
package com.scrollviewenhancer
1616

1717
import android.graphics.Rect
18-
import android.util.Log
1918
import android.view.View
2019
import com.facebook.infer.annotation.Assertions
2120
import com.facebook.react.bridge.*
2221
import com.facebook.react.uimanager.ReactShadowNode
2322
import com.facebook.react.uimanager.UIImplementation.LayoutUpdateListener
2423
import com.facebook.react.uimanager.UIManagerHelper
2524
import com.facebook.react.uimanager.UIManagerModule
25+
import com.facebook.react.uimanager.UIManagerModuleListener
2626
import com.facebook.react.views.scroll.ReactScrollView
2727
import com.facebook.react.views.view.ReactViewGroup
2828
import java.lang.ref.WeakReference
@@ -61,7 +61,7 @@ abstract class MVCPHelper {
6161
class MaintainVisibleScrollPositionHelper(
6262
private val mScrollView: ReactScrollView,
6363
private val mHorizontal: Boolean = false
64-
): MVCPHelper(), UIManagerListener, LayoutUpdateListener {
64+
): MVCPHelper(), UIManagerModuleListener, LayoutUpdateListener {
6565
private var mFirstVisibleView: WeakReference<View>? = null
6666
private var mPrevFirstVisibleFrame: Rect? = null
6767
private var mListening: Boolean = false
@@ -83,7 +83,7 @@ class MaintainVisibleScrollPositionHelper(
8383
if (mListening) return
8484

8585
mListening = true
86-
uiManager.addUIManagerEventListener(this)
86+
uiManagerModule?.addUIManagerListener(this)
8787
uiManagerModule?.uiImplementation?.setLayoutUpdateListener(this)
8888
}
8989

@@ -94,7 +94,7 @@ class MaintainVisibleScrollPositionHelper(
9494
if (!mListening) return
9595

9696
mListening = false
97-
uiManager.removeUIManagerEventListener(this)
97+
uiManagerModule?.removeUIManagerListener(this)
9898
}
9999

100100
/**
@@ -151,18 +151,11 @@ class MaintainVisibleScrollPositionHelper(
151151
}
152152
}
153153

154-
// UIManagerListener
155-
override fun willDispatchViewUpdates(uiManager: UIManager) {
154+
// UIManagerModuleListener
155+
override fun willDispatchViewUpdates(p0: UIManagerModule?) {
156156
computeTargetView()
157157
}
158158

159-
override fun didDispatchMountItems(uiManager: UIManager) {
160-
// noop
161-
}
162-
163-
override fun didScheduleMountItems(uiManager: UIManager) {
164-
// noop
165-
}
166159

167160
// LayoutUpdateListener
168161
override fun onLayoutUpdated(p0: ReactShadowNode<out ReactShadowNode<*>>?) {

0 commit comments

Comments
 (0)