Cleanup and document ReactUnimplementedView (#51063)

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

Cleanup and document ReactUnimplementedView

changelog: [internal] internal

Reviewed By: rshest, cortinico

Differential Revision: D74036571

fbshipit-source-id: 75077914697cac56743c99fba7d7cdccad5c828a
This commit is contained in:
David Vacca authored and Facebook GitHub Bot committed 2025-05-02 12:22:32 -07:00
1 parent 809372c49e
commit 5ae6f6be25
2 files changed
+18 -13

No files matched your search

@@ -12,26 +12,29 @@ import android.graphics.Color
import android.view.Gravity
import android.widget.LinearLayout
import androidx.appcompat.widget.AppCompatTextView
import com.facebook.react.common.build.ReactBuildConfig
internal class ReactUnimplementedView(context: Context) : LinearLayout(context) {
private val textView: AppCompatTextView
private val textView: AppCompatTextView = AppCompatTextView(context)
init {
textView = AppCompatTextView(context)
textView.layoutParams =
LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT)
textView.layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)
textView.setGravity(Gravity.CENTER)
textView.setTextColor(Color.WHITE)
textView.text = ""
setBackgroundColor(0x55ff0000)
setGravity(Gravity.CENTER_HORIZONTAL)
setOrientation(LinearLayout.VERTICAL)
if (ReactBuildConfig.DEBUG) {
setBackgroundColor(0x55ff0000)
}
gravity = Gravity.CENTER_HORIZONTAL
orientation = VERTICAL
addView(textView)
}
internal fun setName(name: String) {
textView.setText("'$name' is not Fabric compatible yet.")
if (ReactBuildConfig.DEBUG) {
textView.text = "'$name' is not registered."
}
}
}
@@ -15,7 +15,10 @@ import com.facebook.react.uimanager.annotations.ReactProp
import com.facebook.react.viewmanagers.UnimplementedNativeViewManagerDelegate
import com.facebook.react.viewmanagers.UnimplementedNativeViewManagerInterface
/** ViewManager for [ReactUnimplementedView] to represent a component that is not yet supported. */
/**
* ViewManager that renders [ReactUnimplementedView] to represent a component that is not properly
* implemented or registered.
*/
@ReactModule(name = ReactUnimplementedViewManager.REACT_CLASS)
internal class ReactUnimplementedViewManager :
ViewGroupManager<ReactUnimplementedView>(),
@@ -32,9 +35,8 @@ internal class ReactUnimplementedViewManager :
override fun getName(): String = REACT_CLASS
@ReactProp(name = "name")
override fun setName(view: ReactUnimplementedView, name: String?): Unit {
view.setName(name ?: "<null component name>")
}
override fun setName(view: ReactUnimplementedView, name: String?): Unit =
view.setName(name ?: "<null component name>")
internal companion object {
const val REACT_CLASS: String = "UnimplementedNativeView"