Giter VIP home page Giter VIP logo

Comments (5)

billmalarky avatar billmalarky commented on July 30, 2024

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.

shubhi15 avatar shubhi15 commented on July 30, 2024

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.

billmalarky avatar billmalarky commented on July 30, 2024

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.

cris-santos avatar cris-santos commented on July 30, 2024

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.

Jbcampbe avatar Jbcampbe commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.