diff --git a/android/src/main/java/com/swmansion/rnscreens/Screen.kt b/android/src/main/java/com/swmansion/rnscreens/Screen.kt index 124e48233..4f97e2853 100644 --- a/android/src/main/java/com/swmansion/rnscreens/Screen.kt +++ b/android/src/main/java/com/swmansion/rnscreens/Screen.kt @@ -117,7 +117,7 @@ class Screen( * `fitToContents` for formSheets, as this is first entry point where we can acquire * height of our content. */ - override fun onLayoutCallback( + override fun onContentWrapperLayout( changed: Boolean, left: Int, top: Int, diff --git a/android/src/main/java/com/swmansion/rnscreens/ScreenContentWrapper.kt b/android/src/main/java/com/swmansion/rnscreens/ScreenContentWrapper.kt index fb2a29f74..c34766b60 100644 --- a/android/src/main/java/com/swmansion/rnscreens/ScreenContentWrapper.kt +++ b/android/src/main/java/com/swmansion/rnscreens/ScreenContentWrapper.kt @@ -18,7 +18,7 @@ class ScreenContentWrapper( internal var delegate: OnLayoutCallback? = null interface OnLayoutCallback { - fun onLayoutCallback( + fun onContentWrapperLayout( changed: Boolean, left: Int, top: Int, @@ -35,6 +35,6 @@ class ScreenContentWrapper( bottom: Int, ) { Log.i("ScreenContentWrapper", "received layout: ${bottom - top}, ${right - left}") - delegate?.onLayoutCallback(changed, left, top, right, bottom) + delegate?.onContentWrapperLayout(changed, left, top, right, bottom) } } diff --git a/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt b/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt index c9738d4f1..37a10b538 100644 --- a/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt +++ b/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt @@ -327,6 +327,7 @@ class ScreenStackFragment : dimmingDelegate.value.onBehaviourAttached(screen, screen.sheetBehavior!!) val container = screen.container!! + coordinatorLayout.measure(View.MeasureSpec.makeMeasureSpec(container.width, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(container.height, View.MeasureSpec.EXACTLY)) coordinatorLayout.layout(0, 0, container.width, container.height) // // enterTransition = @@ -391,7 +392,16 @@ class ScreenStackFragment : animatedValue?.let { dimmingDelegate.value.dimmingView.alpha = it } } } - val customEvaluator = CustomEvaluator({ if (screen.height != 0) screen.height.toFloat() else 0f }, { 0f }) + val startValueCallback = { + if (screen.height != 0) { + Log.i("CB", "[StartValue] ${screen.height.toFloat()}") + screen.height.toFloat() + } else { + Log.i("CB", "[StartValue] 0f") + 0f + } + } + val customEvaluator = CustomEvaluator(startValueCallback, { 0f }) val slideAnimator = ValueAnimator.ofObject(customEvaluator, screen.height.toFloat(), 0f).apply { addUpdateListener { anim -> val animatedValue = anim.animatedValue as? Float @@ -809,7 +819,7 @@ class ScreenStackFragment : } override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) { - Log.i(TAG, "[Coordinator] onLayout") + Log.i(TAG, "[Coordinator] onLayout ${b - t}, ${r - l}") super.onLayout(changed, l, t, r, b) }