com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager.java (#47561)

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

Convert Java to Kotlin

Changelog:

[Android][Breaking] changed visibility of FrescoBasedReactTextInlineImageViewManager to internal

Reviewed By: javache

Differential Revision: D65606954

fbshipit-source-id: bfdb5624a104029c8d667ddb9262c862ab846a61
This commit is contained in:
Alan Lee
2025-01-06 01:26:14 -08:00
committed by Facebook GitHub Bot
parent 088fcb1e5d
commit d5f33c19cb
3 changed files with 50 additions and 82 deletions
@@ -7520,18 +7520,6 @@ public final class com/facebook/react/views/text/TextTransformKt {
public static final fun applyTextTransform (Ljava/lang/String;Lcom/facebook/react/views/text/TextTransform;)Ljava/lang/String;
}
public class com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageViewManager : com/facebook/react/uimanager/BaseViewManager {
public static final field REACT_CLASS Ljava/lang/String;
public fun <init> ()V
public fun <init> (Lcom/facebook/drawee/controller/AbstractDraweeControllerBuilder;Ljava/lang/Object;)V
public synthetic fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/ReactShadowNode;
public fun createShadowNodeInstance ()Lcom/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageShadowNode;
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 abstract interface class com/facebook/react/views/textinput/ContentSizeWatcher {
public abstract fun onLayout ()V
}
@@ -1,70 +0,0 @@
/*
* 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.frescosupport;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
/**
* Manages Images embedded in Text nodes using Fresco. Since they are used only as a virtual nodes
* any type of native view operation will throw an {@link IllegalStateException}.
*/
@Nullsafe(Nullsafe.Mode.LOCAL)
@ReactModule(name = FrescoBasedReactTextInlineImageViewManager.REACT_CLASS)
public class FrescoBasedReactTextInlineImageViewManager
extends BaseViewManager<View, FrescoBasedReactTextInlineImageShadowNode> {
public static final String REACT_CLASS = "RCTTextInlineImage";
private final @Nullable AbstractDraweeControllerBuilder mDraweeControllerBuilder;
private final @Nullable Object mCallerContext;
public FrescoBasedReactTextInlineImageViewManager() {
this(null, null);
}
public FrescoBasedReactTextInlineImageViewManager(
@Nullable AbstractDraweeControllerBuilder draweeControllerBuilder,
@Nullable Object callerContext) {
mDraweeControllerBuilder = draweeControllerBuilder;
mCallerContext = callerContext;
}
@Override
public String getName() {
return REACT_CLASS;
}
@Override
public View createViewInstance(ThemedReactContext context) {
throw new IllegalStateException("RCTTextInlineImage doesn't map into a native view");
}
@Override
public FrescoBasedReactTextInlineImageShadowNode createShadowNodeInstance() {
return new FrescoBasedReactTextInlineImageShadowNode(
(mDraweeControllerBuilder != null)
? mDraweeControllerBuilder
: Fresco.newDraweeControllerBuilder(),
mCallerContext);
}
@Override
public Class<FrescoBasedReactTextInlineImageShadowNode> getShadowNodeClass() {
return FrescoBasedReactTextInlineImageShadowNode.class;
}
@Override
public void updateExtraData(View root, Object extraData) {}
}
@@ -0,0 +1,50 @@
/*
* 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.frescosupport
import android.view.View
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder
import com.facebook.react.module.annotations.ReactModule
import com.facebook.react.uimanager.BaseViewManager
import com.facebook.react.uimanager.ThemedReactContext
/**
* Manages Images embedded in Text nodes using Fresco. Since they are used only as a virtual nodes
* any type of native view operation will throw an [IllegalStateException].
*/
@ReactModule(name = FrescoBasedReactTextInlineImageViewManager.REACT_CLASS)
internal class FrescoBasedReactTextInlineImageViewManager
@JvmOverloads
constructor(
private val draweeControllerBuilder:
@JvmSuppressWildcards
AbstractDraweeControllerBuilder<*, *, *, *>? =
null,
private val callerContext: Any? = null
) : BaseViewManager<View, FrescoBasedReactTextInlineImageShadowNode>() {
override fun getName(): String = REACT_CLASS
public override fun createViewInstance(context: ThemedReactContext): View {
throw IllegalStateException("RCTTextInlineImage doesn't map into a native view")
}
override fun createShadowNodeInstance(): FrescoBasedReactTextInlineImageShadowNode =
FrescoBasedReactTextInlineImageShadowNode(
draweeControllerBuilder ?: Fresco.newDraweeControllerBuilder(), callerContext)
override fun getShadowNodeClass(): Class<FrescoBasedReactTextInlineImageShadowNode> =
FrescoBasedReactTextInlineImageShadowNode::class.java
override fun updateExtraData(root: View, extraData: Any) = Unit
public companion object {
public const val REACT_CLASS: String = "RCTTextInlineImage"
}
}