Comments (5)
Hi Shubhi,
Can you post sample code where you initialize CacheableImage and also how you use it in a render function?
Thanks
from react-native-image-cache-hoc.
Hello
I have created instance of cacheable image as follow
import imageCacheHoc from 'react-native-image-cache-hoc';
const CacheableImage = new imageCacheHoc(Image, {
fileHostWhitelist: ['localhost', 'i.redd.it'],
validProtocols: ['http', 'https'],
defaultPlaceholder: defaultPlaceholderObject
});
Within render i am using cacheableimage as follow:
<CacheableImage
style={{
height: this.state.newHeight,
width: width * 0.85,
marginTop: 10,
resizeMode: 'contain'
}}
source={{ uri: this.props.imageRef.ImageLink }}
onLoad={(event) => this.onSourceLinkEnd(event)}
onError={(event) => this.onSourceLinkError(event)}
onLoadStart={(event) => this.onSourceLinkLoadStart(event)} />
Upon app startup it is giving me warning /error invalid property resizemode passed to _class.
I am using react-native version 0.53. Although native Image object supports resizeMode style object property.
Regards
Shubhi
from react-native-image-cache-hoc.
Have you done a "sanity check" and tried this code using the standard <Image> to see if it works? The CacheableImage logic simply passes CacheableImage props directly through to the underlying Image component, see here, so I wonder if your syntax is incorrect in some way?
Also during this "sanity check" testing, I suggest you simplify further and remove the defaultPlaceholder option so we can rule that out as not being the issue.
Tangentially related but could be useful: https://stackoverflow.com/questions/36436913/image-contain-resizemode-not-working-in-react-native
from react-native-image-cache-hoc.
I'm also facing this issue :/
@shubhi15 did you manage to make it work?
@billmalarky it works with RN using
resizeMode: Image.resizeMode.center
from react-native-image-cache-hoc.
I think this error is stemming from the viewPropTypes check on the style object. It looks like in react-native 0.50 resizeMode
was a prop passed directly to the image instead of being defined in the styles?
from react-native-image-cache-hoc.
Related Issues (20)
- Usable with ImageBackground? HOT 6
- Image loading issue - Half images HOT 15
- app showing error while http url images in ios and android platform HOT 14
- Unable to determine remote image filetype HOT 4
- Static methods (cacheFile, flush) works only with default directory
- [Improvements] Request headers, filename, rejection callback
- how to get the cache size? HOT 3
- it will crash when given a wrong image uri HOT 2
- Make rn-fetch-blob a peer dependency
- Caching Folder absolute path
- Clear cache
- The image can't be cache if the link is in HTTP
- react-native link rn-fetch-blob throws error HOT 1
- Cacheable Image not working with ImageBackground which does not use a uri.
- [TypeError: Network request failed] in android HOT 1
- Getting the following exception when the image loads on iOS
- Warning: componentWillReceiveProps has been renamed HOT 1
- Caches images non-unique naming
- Package abandoned? HOT 3
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-image-cache-hoc.