diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/BridgeTextFragment.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/BridgeTextFragment.kt index 53d1105e6ea814..45ae17b05a8e2a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/BridgeTextFragment.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/BridgeTextFragment.kt @@ -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")