Skip to content

Commit

Permalink
Extract common logic for ViewAttributes creation into method
Browse files Browse the repository at this point in the history
Summary: Add further refactor around `ViewAttributes` method creation so that it can accomodatte better the creation of `ViewAttributes` for the `ViewAttributesBinder`.

Reviewed By: zielinskimz

Differential Revision: D59324627

fbshipit-source-id: ba828e6e1c2f2f500134cf7934844fff3216eaf3
  • Loading branch information
Fabio Carballo authored and facebook-github-bot committed Jul 26, 2024
1 parent a2dbb7e commit 25bac9e
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions litho-core/src/main/java/com/facebook/litho/LithoNodeUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,6 @@ object LithoNodeUtils {
@ImportantForAccessibility importantForAccessibility: Int,
disableBgFgOutputs: Boolean
): ViewAttributes? {

val nodeInfo: NodeInfo? = unit.nodeInfo
val willMountView: Boolean =
when (type) {
OutputUnitType.HOST -> true
Expand All @@ -422,6 +420,24 @@ object LithoNodeUtils {
else -> false
}

return createViewAttributes(
nodeInfo = unit.nodeInfo,
component = component,
willMountView = willMountView,
importantForAccessibility = importantForAccessibility,
disableBgFgOutputs = disableBgFgOutputs,
lithoNode = lithoNode)
}

@JvmStatic
private fun createViewAttributes(
nodeInfo: NodeInfo?,
component: Component,
willMountView: Boolean,
@ImportantForAccessibility importantForAccessibility: Int,
disableBgFgOutputs: Boolean,
lithoNode: LithoNode?
): ViewAttributes? {
if (nodeInfo == null && !willMountView) {
return null
}
Expand Down Expand Up @@ -455,6 +471,7 @@ object LithoNodeUtils {

attrs.systemGestureExclusionZones = lithoNode.systemGestureExclusionZones
}

return attrs
}
}

0 comments on commit 25bac9e

Please sign in to comment.