Skip to content

Commit b4416e2

Browse files
committed
removed redundant logic
1 parent 2054ee4 commit b4416e2

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

android/src/main/java/com/swmansion/rnscreens/Screen.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import com.google.android.material.shape.MaterialShapeDrawable
2828
import com.google.android.material.shape.ShapeAppearanceModel
2929
import com.swmansion.rnscreens.events.HeaderHeightChangeEvent
3030
import com.swmansion.rnscreens.events.SheetDetentChangedEvent
31-
import com.swmansion.rnscreens.ext.removeClippedSubviews
3231
import 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
}

android/src/main/java/com/swmansion/rnscreens/ext/ViewExt.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.swmansion.rnscreens.ext
33
import android.graphics.drawable.ColorDrawable
44
import android.view.View
55
import android.view.ViewGroup
6-
import com.facebook.react.views.view.ReactViewGroup
76

87
internal fun View.parentAsView() = this.parent as? View
98

@@ -31,6 +30,3 @@ internal fun View.maybeBgColor(): Int? {
3130
}
3231
return null
3332
}
34-
35-
internal val View.removeClippedSubviews: Boolean
36-
get() = (this as? ReactViewGroup)?.removeClippedSubviews ?: false

0 commit comments

Comments
 (0)