-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image caching? #66
Comments
Approach:
|
I didn't do anything proper because I want to stop working on this, but this might be useful: master...mrexodia:proper-cache I tested and it currently hits the server twice (which can be improved), but it's already much better than whatever crappy caching |
Hi, you can try react-native-auto-height-fast-image2, |
@alantoa So how can I install your library rather than the original one, and how do I call yours instead of the original? |
@pierroo You don't need this lib anymore, there are better solutions now. import FastImage from "react-native-fast-image"
const AutoHeightImage = React.memo(function AutoHeightImage ({ width, ...props }: ImageProps) {
const [state, setstate] = React.useState(0)
return (
<FastImage
{...props}
style={{ width: width, height: state }}
onLoad={(evt) => {
setstate((evt.nativeEvent.height / evt.nativeEvent.width) * width)
}}
/>
)
}) Simple to use: <AutoHeightImage width={300} /> |
@alantoa Quite amazing, it actually works perfectly, thank you so much! :) |
You're welcome! |
Is your feature request related to a problem? Please describe.
We're using the plugin in a Modal which loads the images from a URI based on the image clicked on a slider. However, every time I click on the same image, it loads the image again from the source.
Describe the solution you'd like
Cache the image so the next time the resource image is accessed, it will be from cache. OR at least set something like 'only-if-cached' from React Native Image.
The text was updated successfully, but these errors were encountered: