Skip to content

Commit

Permalink
Remove RecyclerCollectionComponent::canMeasureRecycler
Browse files Browse the repository at this point in the history
Summary: After resolving all call site issues with codemode and manual fixes, we're now able to get rid of the old API, `canMeasureRecycler`, which should be replaced by `CrossAxisWrapMode`.

Reviewed By: zielinskimz

Differential Revision: D69755915

fbshipit-source-id: f75dae1b464093a641915d071c58c97cb3036386
  • Loading branch information
Andrew Wang authored and facebook-github-bot committed Feb 18, 2025
1 parent 3edaabb commit cbbe4b5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ public class RecyclerCollectionComponentSpec {
LithoRecyclerView.OnBeforeLayoutListener onBeforeLayoutListener,
@Prop(optional = true) @Nullable
LithoRecyclerView.OnAfterLayoutListener onAfterLayoutListener,
@Prop(optional = true) boolean canMeasureRecycler,
@State(canUpdateLazily = true) boolean hasSetSectionTreeRoot,
@State RecyclerCollectionEventsController internalEventsController,
@State LayoutInfo layoutInfo,
Expand Down Expand Up @@ -252,7 +251,6 @@ public class RecyclerCollectionComponentSpec {

boolean shouldNotWrapContent =
!recyclerBinderConfig.wrapContent
&& !canMeasureRecycler
&& (recyclerBinderConfig.crossAxisWrapMode == CrossAxisWrapMode.NoWrap);

/*
Expand Down Expand Up @@ -312,7 +310,6 @@ public class RecyclerCollectionComponentSpec {
listenersToUse,
snapHelper,
canPTR,
canMeasureRecycler,
touchInterceptor,
itemTouchListener,
canPTR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ inline fun ResourcesScope.RecyclerCollectionComponent(
RecyclerCollectionComponentSpec.recyclerConfiguration,
itemAnimator: ItemAnimator? = RecyclerCollectionComponentSpec.itemAnimator,
itemDecoration: ItemDecoration? = null,
canMeasureRecycler: Boolean = false,
loadingComponent: Component? = null,
emptyComponent: Component? = null,
errorComponent: Component? = null,
Expand Down Expand Up @@ -77,7 +76,6 @@ inline fun ResourcesScope.RecyclerCollectionComponent(
.recyclerConfiguration(recyclerConfiguration)
.itemAnimator(itemAnimator)
.itemDecoration(itemDecoration)
.canMeasureRecycler(canMeasureRecycler)
.loadingComponent(loadingComponent)
.emptyComponent(emptyComponent)
.errorComponent(errorComponent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ constructor(
private val onScrollListeners: List<RecyclerView.OnScrollListener>? = null,
private val snapHelper: SnapHelper? = null,
private val isPullToRefreshEnabled: Boolean = true,
private val canMeasureRecycler: Boolean = false,
private val touchInterceptor: LithoRecyclerView.TouchInterceptor? = null,
private val onItemTouchListener: RecyclerView.OnItemTouchListener? = null,
private val onRefresh: (() -> Unit)? = null,
Expand Down Expand Up @@ -142,8 +141,7 @@ constructor(
startPadding = leftPadding,
endPadding = rightPadding,
topPadding = topPadding,
bottomPadding = bottomPadding,
canMeasureRecycler = canMeasureRecycler) {
bottomPadding = bottomPadding) {
measureVersion.update { v -> v + 1 }
},
mountBehavior = mountBehavior,
Expand Down Expand Up @@ -457,7 +455,6 @@ private class RecyclerLayoutBehavior(
private val endPadding: Int,
private val topPadding: Int,
private val bottomPadding: Int,
private val canMeasureRecycler: Boolean = false,
private val onRemeasure: () -> Unit
) : LayoutBehavior {
override fun LayoutScope.layout(sizeConstraints: SizeConstraints): PrimitiveLayoutResult {
Expand All @@ -467,7 +464,7 @@ private class RecyclerLayoutBehavior(
size,
maybeGetSpecWithPadding(sizeConstraints.toWidthSpec(), startPadding + endPadding),
maybeGetSpecWithPadding(sizeConstraints.toHeightSpec(), topPadding + bottomPadding),
if (binder.isCrossAxisWrapContent || binder.isMainAxisWrapContent || canMeasureRecycler)
if (binder.isCrossAxisWrapContent || binder.isMainAxisWrapContent)
eventHandler { onRemeasure() }
else null)
return PrimitiveLayoutResult(
Expand Down

0 comments on commit cbbe4b5

Please sign in to comment.