Skip to content

Commit

Permalink
Add support for contentDescription in StyleCompat
Browse files Browse the repository at this point in the history
Summary: This was missing in `StyleCompat`, it's needed in D67295372.

Reviewed By: zielinskimz

Differential Revision: D67295363

fbshipit-source-id: 6dd82f65e4d847be08e6b9206a60b31f3b85c658
  • Loading branch information
Karan Bhatia authored and facebook-github-bot committed Dec 17, 2024
1 parent 74f272d commit b762ae3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions litho-core/src/main/java/com/facebook/litho/StyleCompat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.annotation.SuppressLint
import android.graphics.drawable.Drawable
import com.facebook.litho.AccessibilityRole.AccessibilityRoleType
import com.facebook.litho.accessibility.accessibilityRole
import com.facebook.litho.accessibility.contentDescription
import com.facebook.litho.animated.translationX
import com.facebook.litho.animated.translationY
import com.facebook.litho.core.height
Expand Down Expand Up @@ -182,6 +183,10 @@ object StyleCompat {
fun accessibilityRole(@AccessibilityRoleType role: String): JavaStyle =
JavaStyle().accessibilityRole(role)

/** @see [JavaStyle.contentDescription] */
@JvmStatic
fun contentDescription(value: CharSequence?): JavaStyle = JavaStyle().contentDescription(value)

/** @see [JavaStyle.translationY] */
@JvmStatic
fun translationY(value: DynamicValue<Float>): JavaStyle = JavaStyle().translationY(value)
Expand Down Expand Up @@ -461,6 +466,11 @@ class JavaStyle {
return this
}

fun contentDescription(value: CharSequence?): JavaStyle {
style = style.contentDescription(value)
return this
}

fun translationY(value: DynamicValue<Float>): JavaStyle {
style = style.translationY(value)
return this
Expand Down

0 comments on commit b762ae3

Please sign in to comment.