Skip to content

Commit

Permalink
Rename default mount behavior
Browse files Browse the repository at this point in the history
Summary: Just clean up to make it easier to reason when adding new strategies for mount behavior.

Differential Revision: D62964108

fbshipit-source-id: c17c7b885646f513357195187f61dee6079d9c46
  • Loading branch information
Fabio Carballo authored and facebook-github-bot committed Oct 1, 2024
1 parent ff7c1fd commit 9d58f21
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ internal constructor(
*/
@JvmField
val primitiveRecyclerBinderStrategy: PrimitiveRecyclerBinderStrategy =
PrimitiveRecyclerBinderStrategy.RECYCLER_SPEC_EQUIVALENT_AND_ITEM_DECORATION,
PrimitiveRecyclerBinderStrategy.DEFAULT,
/**
* This flag is used to enable a fix for the issue where components that match the host view
* size do not get unmounted when they go out of the viewport.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ enum class PrimitiveRecyclerBinderStrategy {
*/
SPLIT_BINDERS,

/** In this strategy we only remove the item decoration binding from the original approach. */
RECYCLER_SPEC_EQUIVALENT_AND_ITEM_DECORATION
/**
* In this strategy, we are using the original RecyclerSpec Mount and Bind binders, and a separate
* one for the item decoration
*/
DEFAULT
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import com.facebook.rendercore.primitives.PrimitiveLayoutResult
import com.facebook.rendercore.primitives.ViewAllocator
import com.facebook.rendercore.toHeightSpec
import com.facebook.rendercore.toWidthSpec
import java.lang.IllegalStateException
import kotlin.math.max

class Recycler
Expand Down Expand Up @@ -117,8 +116,8 @@ constructor(
recyclerEventsController,
measureChild.value,
)
PrimitiveRecyclerBinderStrategy.RECYCLER_SPEC_EQUIVALENT_AND_ITEM_DECORATION ->
RecyclerSpecEquivalentAndItemDecorationMountBehavior(
PrimitiveRecyclerBinderStrategy.DEFAULT ->
DefaultMountBehavior(
measureVersion,
onRefresh,
onScrollListeners,
Expand All @@ -142,7 +141,7 @@ constructor(
style = style)
}

private fun PrimitiveComponentScope.RecyclerSpecEquivalentAndItemDecorationMountBehavior(
private fun PrimitiveComponentScope.DefaultMountBehavior(
measureVersion: State<Int>,
onRefresh: (() -> Unit)?,
onScrollListeners: List<RecyclerView.OnScrollListener>?,
Expand Down

0 comments on commit 9d58f21

Please sign in to comment.