Validate textAttributeProps is created with a non-null textAttributes map (#42932)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42932

Validate textAttributeProps is created with a non-null textAttributes map

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D53558784

fbshipit-source-id: 2f7521a7f0a1cfdf67c0ab8ea0048e7f5da365b8
This commit is contained in:
David Vacca
2024-02-23 02:42:20 -08:00
committed by Facebook GitHub Bot
parent 0eac4181cc
commit 93b4ec3472
@@ -15,8 +15,12 @@ import com.facebook.react.views.text.TextAttributeProps
/** A [TextFragment] implementation backed by a a [ReadableMap] */
internal class BridgeTextFragment(private val fragment: ReadableMap) : TextFragment {
override val textAttributeProps: TextAttributeProps
get() =
TextAttributeProps.fromReadableMap(ReactStylesDiffMap(fragment.getMap("textAttributes")))
get() {
val textAttributesMap =
fragment.getMap("textAttributes")
?: throw IllegalStateException("Missing required field `textAttributes`")
return TextAttributeProps.fromReadableMap(ReactStylesDiffMap(textAttributesMap))
}
override val string: String?
get() = fragment.getString("string")