Comments (27)
Temporary Workaround.
You can try modifying the library code until the library is officially updated.
Open the file causing issues: /node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageSource.java.
Replace the code with the one below.
package com.dylanvann.fastimage;
import android.content.Context;
import android.content.res.Resources;
import android.net.Uri;
import android.text.TextUtils;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.load.model.Headers;
import com.facebook.react.views.imagehelper.ImageSource;
import javax.annotation.Nullable;
public class FastImageSource {
private static final String DATA_SCHEME = "data";
private static final String LOCAL_RESOURCE_SCHEME = "res";
private static final String ANDROID_RESOURCE_SCHEME = "android.resource";
private static final String ANDROID_CONTENT_SCHEME = "content";
private static final String LOCAL_FILE_SCHEME = "file";
private final Headers mHeaders;
private Uri mUri;
private final ImageSource imageSource; // Composition instead of inheritance
public static boolean isBase64Uri(Uri uri) {
return DATA_SCHEME.equals(uri.getScheme());
}
public static boolean isLocalResourceUri(Uri uri) {
return LOCAL_RESOURCE_SCHEME.equals(uri.getScheme());
}
public static boolean isResourceUri(Uri uri) {
return ANDROID_RESOURCE_SCHEME.equals(uri.getScheme());
}
public static boolean isContentUri(Uri uri) {
return ANDROID_CONTENT_SCHEME.equals(uri.getScheme());
}
public static boolean isLocalFileUri(Uri uri) {
return LOCAL_FILE_SCHEME.equals(uri.getScheme());
}
public FastImageSource(Context context, String source) {
this(context, source, null);
}
public FastImageSource(Context context, String source, @Nullable Headers headers) {
this(context, source, 0.0d, 0.0d, headers);
}
public FastImageSource(Context context, String source, double width, double height, @Nullable Headers headers) {
imageSource = new ImageSource(context, source, width, height); // Create ImageSource instance
mHeaders = headers == null ? Headers.DEFAULT : headers;
mUri = imageSource.getUri(); // Get URI from ImageSource
if (isResource() && TextUtils.isEmpty(mUri.toString())) {
throw new Resources.NotFoundException("Local Resource Not Found. Resource: '" + getSource() + "'.");
}
if (isLocalResourceUri(mUri)) {
// Convert res:/ scheme to android.resource:// so
// Glide can understand the URI.
mUri = Uri.parse(mUri.toString().replace("res:/", ANDROID_RESOURCE_SCHEME + "://" + context.getPackageName() + "/"));
}
}
public boolean isBase64Resource() {
return mUri != null && FastImageSource.isBase64Uri(mUri);
}
public boolean isResource() {
return mUri != null && FastImageSource.isResourceUri(mUri);
}
public boolean isLocalFile() {
return mUri != null && FastImageSource.isLocalFileUri(mUri);
}
public boolean isContentUri() {
return mUri != null && FastImageSource.isContentUri(mUri);
}
public Object getSourceForLoad() {
if (isContentUri()) {
return getSource();
}
if (isBase64Resource()) {
return getSource();
}
if (isResource()) {
return getUri();
}
if (isLocalFile()) {
return getUri().toString();
}
return getGlideUrl();
}
public Uri getUri() {
return mUri;
}
public Headers getHeaders() {
return mHeaders;
}
public GlideUrl getGlideUrl() {
return new GlideUrl(getUri().toString(), getHeaders());
}
public String getSource() {
return imageSource.getSource(); // Delegate to ImageSource
}
}
Finally you can use patch package (https://github.com/ds300/patch-package) to patch it.
from react-native-fast-image.
Hello use https://www.npmjs.com/package/@d11/react-native-fast-image
It is actively maintained and issue will be resolved soon
from react-native-fast-image.
same here
from react-native-fast-image.
This PR on react-native will solve this issue:
from react-native-fast-image.
same issue
from react-native-fast-image.
Same here
from react-native-fast-image.
it's not working with 0.75.2 also
from react-native-fast-image.
0.75.2 is fixed this issues
not fixed for me
from react-native-fast-image.
Getting below errors with 0.75.2 version
/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageSource.java:72: error: isResource() in FastImageSource cannot override isResource() in ImageSource
public boolean isResource() {
^
overridden method is final/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageSource.java:101: error: getUri() in FastImageSource cannot override getUri() in ImageSource
public Uri getUri() {
^
overridden method is final
from react-native-fast-image.
I am also getting the same issue. I am using the latest 0.75.1 version of the React Native library. Please heeeeeeeeeeeeeelp!
from react-native-fast-image.
I am also getting the same issue, i am using latest 0.75.1 version of react native library
from react-native-fast-image.
same here, any solutions?
from react-native-fast-image.
same here, any solutions?
from react-native-fast-image.
Temporary Workaround.
You can try modifying the library code until the library is officially updated.
Open the file causing issues: /node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageSource.java.
Replace the code with the one below.
package com.dylanvann.fastimage; import android.content.Context; import android.content.res.Resources; import android.net.Uri; import android.text.TextUtils; import com.bumptech.glide.load.model.GlideUrl; import com.bumptech.glide.load.model.Headers; import com.facebook.react.views.imagehelper.ImageSource; import javax.annotation.Nullable; public class FastImageSource { private static final String DATA_SCHEME = "data"; private static final String LOCAL_RESOURCE_SCHEME = "res"; private static final String ANDROID_RESOURCE_SCHEME = "android.resource"; private static final String ANDROID_CONTENT_SCHEME = "content"; private static final String LOCAL_FILE_SCHEME = "file"; private final Headers mHeaders; private Uri mUri; private final ImageSource imageSource; // Composition instead of inheritance public static boolean isBase64Uri(Uri uri) { return DATA_SCHEME.equals(uri.getScheme()); } public static boolean isLocalResourceUri(Uri uri) { return LOCAL_RESOURCE_SCHEME.equals(uri.getScheme()); } public static boolean isResourceUri(Uri uri) { return ANDROID_RESOURCE_SCHEME.equals(uri.getScheme()); } public static boolean isContentUri(Uri uri) { return ANDROID_CONTENT_SCHEME.equals(uri.getScheme()); } public static boolean isLocalFileUri(Uri uri) { return LOCAL_FILE_SCHEME.equals(uri.getScheme()); } public FastImageSource(Context context, String source) { this(context, source, null); } public FastImageSource(Context context, String source, @Nullable Headers headers) { this(context, source, 0.0d, 0.0d, headers); } public FastImageSource(Context context, String source, double width, double height, @Nullable Headers headers) { imageSource = new ImageSource(context, source, width, height); // Create ImageSource instance mHeaders = headers == null ? Headers.DEFAULT : headers; mUri = imageSource.getUri(); // Get URI from ImageSource if (isResource() && TextUtils.isEmpty(mUri.toString())) { throw new Resources.NotFoundException("Local Resource Not Found. Resource: '" + getSource() + "'."); } if (isLocalResourceUri(mUri)) { // Convert res:/ scheme to android.resource:// so // Glide can understand the URI. mUri = Uri.parse(mUri.toString().replace("res:/", ANDROID_RESOURCE_SCHEME + "://" + context.getPackageName() + "/")); } } public boolean isBase64Resource() { return mUri != null && FastImageSource.isBase64Uri(mUri); } public boolean isResource() { return mUri != null && FastImageSource.isResourceUri(mUri); } public boolean isLocalFile() { return mUri != null && FastImageSource.isLocalFileUri(mUri); } public boolean isContentUri() { return mUri != null && FastImageSource.isContentUri(mUri); } public Object getSourceForLoad() { if (isContentUri()) { return getSource(); } if (isBase64Resource()) { return getSource(); } if (isResource()) { return getUri(); } if (isLocalFile()) { return getUri().toString(); } return getGlideUrl(); } public Uri getUri() { return mUri; } public Headers getHeaders() { return mHeaders; } public GlideUrl getGlideUrl() { return new GlideUrl(getUri().toString(), getHeaders()); } public String getSource() { return imageSource.getSource(); // Delegate to ImageSource } }
Finally you can use patch package (https://github.com/ds300/patch-package) to patch it.
@hpanwar521 try this solution. It will work.
from react-native-fast-image.
This is also not working for me ... is there any other solution
from react-native-fast-image.
I am also getting the same issue. I am using the latest 0.75.1 version of the React Native library. Please heeeeeeeeeeeeeelp!
@mohsenfl2022 follow these steps:-
- Put the attached patch file inside the patches folder. If there is no patches folder, create one and put that file
-
Install
patch-package
. -
After installation, run
npx patch-package react-native-fast-image
.
After that try building the app. It will work fine
react-native-fast-image+8.6.3.patch
from react-native-fast-image.
facing the same issue with react-native 0.75.1 version while running the application in android.
node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageSource.java:14: error: cannot inherit from final ImageSource
public class FastImageSource extends ImageSource {
^
@DylanVann Kindly look into this
from react-native-fast-image.
This is fixed in https://github.com/facebook/react-native/pull/46092/files
You can also try @d11/react-native-fast-image
from react-native-fast-image.
it's a fork of this. can we upgrade this in the same?
from react-native-fast-image.
it's a fork of this. can we upgrade this in the same?
react-native is the peer dependency of react-native-fast-image. So when you upgrade your app to the fixed version of react-native , it will automatically work
from react-native-fast-image.
Here are the versions of libs. still, it's not working.
"react": "18.3.1",
"react-native": "0.75.1",
"react-native-fast-image": "^8.6.3",
from react-native-fast-image.
+1
from react-native-fast-image.
+1
from react-native-fast-image.
+1
from react-native-fast-image.
Any progress on this fam
from react-native-fast-image.
Someone have a solution for this issue, can someone contact with the repo owner?
from react-native-fast-image.
There's also a new alternative, Faster Image, https://github.com/candlefinance/faster-image
from react-native-fast-image.
Related Issues (20)
- Error due tintColor HOT 2
- Is it abandoned? HOT 16
- Crashes the app, as IOS has deprecated UIGraphicsBeginImageContextWithOptions from IOS 17. HOT 7
- Critical WebP 0-day security CVE-2023-4863 HOT 3
- Gif in ios HOT 1
- Gifs only play once HOT 2
- react-native 0.73 [FFFastImageView setOnClick:]: unrecognized selector sent to instance HOT 6
- Android FastImage keeps refreshing on background to foreground, iOS is fine. HOT 3
- Android onError is not called when uri is empty or null HOT 1
- Kotlin support for the current React native version
- "FastImageView" was not found in the UIManager HOT 4
- Update to SDWebImage to 5.18.7 or higher for privacy manifest before Apple's May 1 deadline HOT 5
- App crashes when loading high resolution image. HOT 1
- setOnFastImageError
- New Package Update HOT 6
- Tried to access a JS module before the React instance was fully set up. HOT 9
- how to get fastimage image data
- When fallback is set to true, images cannot be imported using require. HOT 1
- Patch for fix HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-fast-image.