Skip to content

Commit

Permalink
fix(android): make getUri and isResource available for override (#46152)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
shubhamguptadream11 authored and facebook-github-bot committed Aug 27, 2024
1 parent b10ed0e commit 8c81ffa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -6720,9 +6720,9 @@ public class com/facebook/react/views/imagehelper/ImageSource {
public final fun getSize ()D
public final fun getSource ()Ljava/lang/String;
public static final fun getTransparentBitmapImageSource (Landroid/content/Context;)Lcom/facebook/react/views/imagehelper/ImageSource;
public final fun getUri ()Landroid/net/Uri;
public fun getUri ()Landroid/net/Uri;
public fun hashCode ()I
public final fun isResource ()Z
public fun isResource ()Z
}

public final class com/facebook/react/views/imagehelper/ImageSource$Companion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ constructor(
) {

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

private var _isResource: Boolean = false

override fun equals(other: Any?): Boolean {
if (this === other) {
Expand Down Expand Up @@ -58,7 +60,7 @@ constructor(
}

private fun computeLocalUri(context: Context): Uri {
isResource = true
_isResource = true
return ResourceDrawableIdHelper.instance.getResourceDrawableUri(context, source)
}

Expand Down

0 comments on commit 8c81ffa

Please sign in to comment.