Skip to content

Commit 2054ee4

Browse files
committed
simplified property
1 parent 41a6562 commit 2054ee4

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ 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.isRemovingClippedSubviews
31+
import com.swmansion.rnscreens.ext.removeClippedSubviews
3232
import java.lang.ref.WeakReference
3333

3434
@SuppressLint("ViewConstructor") // Only we construct this view, it is never inflated.
@@ -401,7 +401,7 @@ class Screen(
401401
if (child is ScreenStackHeaderConfig) {
402402
// we want to start transition on children of the toolbar too,
403403
// which is not a child of ScreenStackHeaderConfig
404-
startTransitionRecursive(child, isPossiblyRemovedClippedSubview || it.isRemovingClippedSubviews)
404+
startTransitionRecursive(child, isPossiblyRemovedClippedSubview || it.removeClippedSubviews)
405405
}
406406
if (child is ViewGroup) {
407407
// The children are miscounted when there's removeClippedSubviews prop
@@ -413,7 +413,7 @@ class Screen(
413413
child.addView(View(context))
414414
}
415415
}
416-
startTransitionRecursive(child, isPossiblyRemovedClippedSubview || it.isRemovingClippedSubviews)
416+
startTransitionRecursive(child, isPossiblyRemovedClippedSubview || it.removeClippedSubviews)
417417
}
418418
}
419419
}

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ 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.scroll.ReactHorizontalScrollView
7-
import com.facebook.react.views.scroll.ReactScrollView
6+
import com.facebook.react.views.view.ReactViewGroup
87

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

@@ -33,10 +32,5 @@ internal fun View.maybeBgColor(): Int? {
3332
return null
3433
}
3534

36-
internal val View.isRemovingClippedSubviews: Boolean
37-
get() =
38-
when (this) {
39-
is ReactHorizontalScrollView -> removeClippedSubviews
40-
is ReactScrollView -> removeClippedSubviews
41-
else -> false
42-
}
35+
internal val View.removeClippedSubviews: Boolean
36+
get() = (this as? ReactViewGroup)?.removeClippedSubviews ?: false

0 commit comments

Comments
 (0)