@@ -28,7 +28,6 @@ import com.google.android.material.shape.MaterialShapeDrawable
2828import com.google.android.material.shape.ShapeAppearanceModel
2929import com.swmansion.rnscreens.events.HeaderHeightChangeEvent
3030import com.swmansion.rnscreens.events.SheetDetentChangedEvent
31- import com.swmansion.rnscreens.ext.removeClippedSubviews
3231import java.lang.ref.WeakReference
3332
3433@SuppressLint(" ViewConstructor" ) // Only we construct this view, it is never inflated.
@@ -380,10 +379,7 @@ class Screen(
380379 }
381380 }
382381
383- private fun startTransitionRecursive (
384- parent : ViewGroup ? ,
385- isPossiblyRemovedClippedSubview : Boolean = true,
386- ) {
382+ private fun startTransitionRecursive (parent : ViewGroup ? ) {
387383 parent?.let {
388384 for (i in 0 until it.childCount) {
389385 val child = it.getChildAt(i)
@@ -401,19 +397,20 @@ class Screen(
401397 if (child is ScreenStackHeaderConfig ) {
402398 // we want to start transition on children of the toolbar too,
403399 // which is not a child of ScreenStackHeaderConfig
404- startTransitionRecursive(child, isPossiblyRemovedClippedSubview || it.removeClippedSubviews )
400+ startTransitionRecursive(child.toolbar )
405401 }
406402 if (child is ViewGroup ) {
407403 // The children are miscounted when there's removeClippedSubviews prop
408404 // set to true (which is the default for FlatLists).
409- // We add a simple view for each possibly clipped item to make it work as expected.
405+ // Unless the child is a ScrollView it's safe to assume that it's true
406+ // and add a simple view for each possibly clipped item to make it work as expected.
410407 // See https://github.com/software-mansion/react-native-screens/pull/2495
411- if (isPossiblyRemovedClippedSubview && child !is ReactScrollView && child !is ReactHorizontalScrollView ) {
408+ if (child !is ReactScrollView && child !is ReactHorizontalScrollView ) {
412409 for (j in 0 until child.childCount) {
413410 child.addView(View (context))
414411 }
415412 }
416- startTransitionRecursive(child, isPossiblyRemovedClippedSubview || it.removeClippedSubviews )
413+ startTransitionRecursive(child)
417414 }
418415 }
419416 }
0 commit comments