Skip to content

Commit 870f301

Browse files
authored
fix: 안드로이드 ScrollView 내에서 사용시 상하 스크롤 터치 이벤트 충돌 또는 버블링 현상 수정 (#135)
1 parent 38e7b97 commit 870f301

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

android/src/main/java/com/mjstudio/reactnativenavermap/mapview/RNCNaverMapViewWrapper.kt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
44
import android.os.Bundle
55
import android.view.Choreographer
66
import android.view.Choreographer.FrameCallback
7+
import android.view.MotionEvent
78
import android.view.View
89
import android.widget.FrameLayout
910
import com.facebook.react.bridge.LifecycleEventListener
@@ -95,6 +96,26 @@ class RNCNaverMapViewWrapper(
9596

9697
override fun onHostDestroy() {}
9798

99+
override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
100+
mapView?.withMap { map ->
101+
if (map.uiSettings.isScrollGesturesEnabled) {
102+
when (ev?.action) {
103+
MotionEvent.ACTION_DOWN,
104+
MotionEvent.ACTION_MOVE,
105+
-> {
106+
parent?.requestDisallowInterceptTouchEvent(true)
107+
}
108+
MotionEvent.ACTION_UP,
109+
MotionEvent.ACTION_CANCEL,
110+
-> {
111+
parent?.requestDisallowInterceptTouchEvent(false)
112+
}
113+
}
114+
}
115+
}
116+
return super.dispatchTouchEvent(ev)
117+
}
118+
98119
companion object {
99120
/**
100121
* A helper to get react tag id by given MapView

0 commit comments

Comments
 (0)