Skip to content

Commit 89d4898

Browse files
alanleedevfacebook-github-bot
authored andcommitted
com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager.java (facebook#47561)
Summary: Pull Request resolved: facebook#47561 Convert Java to Kotlin Changelog: [Android][Breaking] changed visibility of FrescoBasedReactTextInlineImageViewManager to internal Reviewed By: javache Differential Revision: D65606954
1 parent 6dd4195 commit 89d4898

File tree

3 files changed

+58
-82
lines changed

3 files changed

+58
-82
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7507,18 +7507,6 @@ public final class com/facebook/react/views/text/TextTransformKt {
75077507
public static final fun applyTextTransform (Ljava/lang/String;Lcom/facebook/react/views/text/TextTransform;)Ljava/lang/String;
75087508
}
75097509

7510-
public class com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageViewManager : com/facebook/react/uimanager/BaseViewManager {
7511-
public static final field REACT_CLASS Ljava/lang/String;
7512-
public fun <init> ()V
7513-
public fun <init> (Lcom/facebook/drawee/controller/AbstractDraweeControllerBuilder;Ljava/lang/Object;)V
7514-
public synthetic fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/ReactShadowNode;
7515-
public fun createShadowNodeInstance ()Lcom/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageShadowNode;
7516-
public fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Landroid/view/View;
7517-
public fun getName ()Ljava/lang/String;
7518-
public fun getShadowNodeClass ()Ljava/lang/Class;
7519-
public fun updateExtraData (Landroid/view/View;Ljava/lang/Object;)V
7520-
}
7521-
75227510
public abstract interface class com/facebook/react/views/textinput/ContentSizeWatcher {
75237511
public abstract fun onLayout ()V
75247512
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageViewManager.java

Lines changed: 0 additions & 70 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
package com.facebook.react.views.text.frescosupport
9+
10+
import android.view.View
11+
import com.facebook.common.references.CloseableReference
12+
import com.facebook.drawee.backends.pipeline.Fresco
13+
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder
14+
import com.facebook.imagepipeline.image.CloseableImage
15+
import com.facebook.imagepipeline.image.ImageInfo
16+
import com.facebook.imagepipeline.request.ImageRequest
17+
import com.facebook.react.module.annotations.ReactModule
18+
import com.facebook.react.uimanager.BaseViewManager
19+
import com.facebook.react.uimanager.ThemedReactContext
20+
21+
/**
22+
* Manages Images embedded in Text nodes using Fresco. Since they are used only as a virtual nodes
23+
* any type of native view operation will throw an [IllegalStateException].
24+
*/
25+
@ReactModule(name = FrescoBasedReactTextInlineImageViewManager.REACT_CLASS)
26+
internal class FrescoBasedReactTextInlineImageViewManager
27+
@JvmOverloads
28+
constructor(
29+
private val draweeControllerBuilder: AbstractDraweeControllerBuilder<*, *, *, *>? = null,
30+
private val callerContext: Any? = null
31+
) : BaseViewManager<View, FrescoBasedReactTextInlineImageShadowNode>() {
32+
33+
override fun getName(): String = REACT_CLASS
34+
35+
public override fun createViewInstance(context: ThemedReactContext): View {
36+
throw IllegalStateException("RCTTextInlineImage doesn't map into a native view")
37+
}
38+
39+
override fun createShadowNodeInstance(): FrescoBasedReactTextInlineImageShadowNode {
40+
@Suppress("UNCHECKED_CAST") // Unsafe cast necessary as this java class used raw generics
41+
val builder =
42+
draweeControllerBuilder
43+
as?
44+
AbstractDraweeControllerBuilder<
45+
*, ImageRequest, CloseableReference<CloseableImage>, ImageInfo>
46+
?: Fresco.newDraweeControllerBuilder()
47+
return FrescoBasedReactTextInlineImageShadowNode(builder, callerContext)
48+
}
49+
50+
override fun getShadowNodeClass(): Class<FrescoBasedReactTextInlineImageShadowNode> =
51+
FrescoBasedReactTextInlineImageShadowNode::class.java
52+
53+
override fun updateExtraData(root: View, extraData: Any) = Unit
54+
55+
public companion object {
56+
public const val REACT_CLASS: String = "RCTTextInlineImage"
57+
}
58+
}

0 commit comments

Comments
 (0)