Skip to content

Commit 8c81ffa

Browse files
fix(android): make getUri and isResource available for override (#46152)
Summary: Fixes following issues: - #46150 - #46155 ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [ANDROID] [FIXED] - Make getUri and isResource open Pull Request resolved: #46152 Reviewed By: NickGerleman, rshest, blakef Differential Revision: D61845164 Pulled By: cortinico fbshipit-source-id: 88ccdad92423b5add9b2fad4c98f296b6cbfb27d
1 parent b10ed0e commit 8c81ffa

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6720,9 +6720,9 @@ public class com/facebook/react/views/imagehelper/ImageSource {
67206720
public final fun getSize ()D
67216721
public final fun getSource ()Ljava/lang/String;
67226722
public static final fun getTransparentBitmapImageSource (Landroid/content/Context;)Lcom/facebook/react/views/imagehelper/ImageSource;
6723-
public final fun getUri ()Landroid/net/Uri;
6723+
public fun getUri ()Landroid/net/Uri;
67246724
public fun hashCode ()I
6725-
public final fun isResource ()Z
6725+
public fun isResource ()Z
67266726
}
67276727

67286728
public final class com/facebook/react/views/imagehelper/ImageSource$Companion {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ImageSource.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ constructor(
2323
) {
2424

2525
/** Get the URI for this image - can be either a parsed network URI or a resource URI. */
26-
public val uri: Uri = computeUri(context)
26+
public open val uri: Uri = computeUri(context)
2727
/** Get the area of this image. */
2828
public val size: Double = width * height
2929
/** Get whether this image source represents an Android resource or a network URI. */
30-
public var isResource: Boolean = false
31-
private set
30+
public open val isResource: Boolean
31+
get() = _isResource
32+
33+
private var _isResource: Boolean = false
3234

3335
override fun equals(other: Any?): Boolean {
3436
if (this === other) {
@@ -58,7 +60,7 @@ constructor(
5860
}
5961

6062
private fun computeLocalUri(context: Context): Uri {
61-
isResource = true
63+
_isResource = true
6264
return ResourceDrawableIdHelper.instance.getResourceDrawableUri(context, source)
6365
}
6466

0 commit comments

Comments
 (0)