Skip to content

Commit

Permalink
Migrate ReactVirtualTextViewManager to kotlin and reduce visibility t…
Browse files Browse the repository at this point in the history
…ointernal (#47402)

Summary:
Pull Request resolved: #47402

Migrate ReactVirtualTextViewManager to kotlin and reduce visibility tointernal

changelog: [Android][Breaking] Reduce visibility of ReactVirtualTextViewManager to internal

Reviewed By: cortinico

Differential Revision: D65462051

fbshipit-source-id: fa6daef4e557d527d594616ca032ebf0180cbba2
  • Loading branch information
mdvacca authored and facebook-github-bot committed Nov 6, 2024
1 parent 5c3c152 commit 4a119c4
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 64 deletions.
10 changes: 0 additions & 10 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -7527,16 +7527,6 @@ public class com/facebook/react/views/text/ReactVirtualTextShadowNode : com/face
public fun isVirtual ()Z
}

public class com/facebook/react/views/text/ReactVirtualTextViewManager : com/facebook/react/uimanager/BaseViewManager {
public fun <init> ()V
public synthetic fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/ReactShadowNode;
public fun createShadowNodeInstance ()Lcom/facebook/react/views/text/ReactVirtualTextShadowNode;
public fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Landroid/view/View;
public fun getName ()Ljava/lang/String;
public fun getShadowNodeClass ()Ljava/lang/Class;
public fun updateExtraData (Landroid/view/View;Ljava/lang/Object;)V
}

public class com/facebook/react/views/text/TextAttributeProps {
public static final field TA_KEY_ACCESSIBILITY_ROLE S
public static final field TA_KEY_ALIGNMENT S
Expand Down
6 changes: 1 addition & 5 deletions packages/react-native/ReactAndroid/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ react.internal.disableJavaVersionAlignment=true

# We ignore:
# - BuildConfig classes because they are generated and not part of the public API
# - PropsSetter classes because they are generated by the Annotation processor which is not used in OSS
binaryCompatibilityValidator.ignoredClasses=com.facebook.react.BuildConfig,\
com.facebook.react.views.safeareaview.ReactSafeAreaViewManager$$PropsSetter,\
com.facebook.react.views.unimplementedview.ReactUnimplementedViewManager$$PropsSetter,\
com.facebook.react.views.safeareaview.ReactSafeAreaViewShadowNode$$PropsSetter
binaryCompatibilityValidator.ignoredClasses=com.facebook.react.BuildConfig

binaryCompatibilityValidator.ignoredPackages=com.facebook.debug,\
com.facebook.fbreact,\
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react.views.text

import android.view.View
import com.facebook.react.module.annotations.ReactModule
import com.facebook.react.uimanager.BaseViewManager
import com.facebook.react.uimanager.ThemedReactContext

/**
* Manages raw text nodes. Since they are used only as a virtual nodes any type of native view
* operation will throw an [IllegalStateException]
*/
@ReactModule(name = ReactVirtualTextViewManager.REACT_CLASS)
internal class ReactVirtualTextViewManager : BaseViewManager<View, ReactVirtualTextShadowNode>() {

public override fun getName(): String = REACT_CLASS

protected override fun createViewInstance(context: ThemedReactContext): View {
throw IllegalStateException("Attempt to create a native view for RCTVirtualText")
}

public override fun updateExtraData(view: View, extraData: Any): Unit {}

public override fun getShadowNodeClass(): Class<ReactVirtualTextShadowNode> =
ReactVirtualTextShadowNode::class.java

override fun createShadowNodeInstance(): ReactVirtualTextShadowNode = ReactVirtualTextShadowNode()

internal companion object {
public const val REACT_CLASS: String = "RCTVirtualText"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import android.view.Gravity
import android.widget.LinearLayout
import androidx.appcompat.widget.AppCompatTextView

public class ReactUnimplementedView(context: Context) : LinearLayout(context) {
internal class ReactUnimplementedView(context: Context) : LinearLayout(context) {

private val textView: AppCompatTextView

Expand All @@ -31,7 +31,7 @@ public class ReactUnimplementedView(context: Context) : LinearLayout(context) {
addView(textView)
}

public fun setName(name: String) {
internal fun setName(name: String) {
textView.setText("'$name' is not Fabric compatible yet.")
}
}

0 comments on commit 4a119c4

Please sign in to comment.