Skip to content

Commit

Permalink
Validate textAttributeProps is created with a non-null textAttributes…
Browse files Browse the repository at this point in the history
… map (facebook#42932)

Summary:

Validate textAttributeProps is created with a non-null textAttributes map

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D53558784
  • Loading branch information
mdvacca authored and facebook-github-bot committed Feb 22, 2024
1 parent 6549216 commit 114c921
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 114c921

Please sign in to comment.