diff --git a/android/src/main/java/com/sheet2/AppFittedSheet.kt b/android/src/main/java/com/sheet2/AppFittedSheet.kt index 1ce44a3..d805e42 100644 --- a/android/src/main/java/com/sheet2/AppFittedSheet.kt +++ b/android/src/main/java/com/sheet2/AppFittedSheet.kt @@ -319,11 +319,17 @@ open class AppFittedSheet(context: Context) : } override fun getChildCount(): Int = + if (useInlinePresentation) 0 else reactChildCount() + + override fun getChildAt(index: Int): View? = + if (useInlinePresentation) null else reactChildAt(index) + + internal fun reactChildCount(): Int = mHostView.childCount + (if (inlineOverlayView != null) 1 else 0) + (if (dialogOverlayView != null) 1 else 0) - override fun getChildAt(index: Int): View? { + internal fun reactChildAt(index: Int): View? { if (index < mHostView.childCount) return mHostView.getChildAt(index) val overlayIndex = index - mHostView.childCount if (inlineOverlayView != null && overlayIndex == 0) return inlineOverlayView diff --git a/android/src/main/java/com/sheet2/Sheet2ViewManager.kt b/android/src/main/java/com/sheet2/Sheet2ViewManager.kt index 5f84838..8c632e3 100644 --- a/android/src/main/java/com/sheet2/Sheet2ViewManager.kt +++ b/android/src/main/java/com/sheet2/Sheet2ViewManager.kt @@ -1,6 +1,7 @@ package com.sheet2 import android.graphics.Color +import android.view.View import com.behavior.BottomSheetBehavior import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.module.annotations.ReactModule @@ -77,7 +78,7 @@ class Sheet2ViewManager(reactContext: ReactApplicationContext) : ViewGroupManage override fun setPassScrollViewReactTag(view: Sheet2View, value: String?) { println("==========setPassScrollViewReactTag $value") value ?: return - val v = BottomSheetBehavior.findView(view) ?: return + val v = BottomSheetBehavior.findView(view.mHostView) ?: return view.setNewNestedScrollView(v) } @@ -118,6 +119,14 @@ class Sheet2ViewManager(reactContext: ReactApplicationContext) : ViewGroupManage view.mHostView.setVirtualHeight(value.dpToPx()) } + override fun getChildCount(parent: Sheet2View): Int { + return parent.reactChildCount() + } + + override fun getChildAt(parent: Sheet2View, index: Int): View? { + return parent.reactChildAt(index) + } + override fun onDropViewInstance(view: Sheet2View) { super.onDropViewInstance(view) view.onDropInstance() diff --git a/package.json b/package.json index f92fb4d..30d4246 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "example" ], "private": "true", - "version": "7.12.0", + "version": "7.12.1", "description": "Native implementation of Bottom sheet", "main": "src/index.tsx", "module": "src/index",