mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
committed by
Facebook GitHub Bot
parent
0eac4181cc
commit
93b4ec3472
+6
-2
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user