Skip to content

Commit

Permalink
com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlin…
Browse files Browse the repository at this point in the history
…eImageViewManager.java (#47561)

Summary:
Pull Request resolved: #47561

Convert Java to Kotlin

Changelog:

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

Reviewed By: javache

Differential Revision: D65606954
  • Loading branch information
alanleedev authored and facebook-github-bot committed Dec 30, 2024
1 parent 6dd4195 commit c3f602b
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 82 deletions.
12 changes: 0 additions & 12 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -7507,18 +7507,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
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* 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.common.references.CloseableReference
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder
import com.facebook.imagepipeline.image.CloseableImage
import com.facebook.imagepipeline.image.ImageInfo
import com.facebook.imagepipeline.request.ImageRequest
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: 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 {
@Suppress("UNCHECKED_CAST") // Unsafe cast necessary as this java class used raw generics
val builder =
draweeControllerBuilder
as?
AbstractDraweeControllerBuilder<
*, ImageRequest, CloseableReference<CloseableImage>, ImageInfo>
?: Fresco.newDraweeControllerBuilder()
return FrescoBasedReactTextInlineImageShadowNode(builder, 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"
}
}

0 comments on commit c3f602b

Please sign in to comment.