Giter VIP home page Giter VIP logo

Comments (4)

cbothra avatar cbothra commented on June 3, 2024 2

I think I have a temporary solution for now

          // source={{ uri: item }}
          source={typeof item === 'string' ? { uri: item } : item}
          resizeMethod={this.props.resizeMethod || 'resize'} 
          resizeMode={this.props.resizeMode || 'cover'}

I commented out the current source property of <ImageComponent> in the _renderItem() in SliderBox.js and added a check to support both local and https images.

I also added two more properties resizeMethod & resizeMode which I think are basic requirement while dealing with images.

Hope this helps someone.

from react-native-image-slider-box.

intellidev1991 avatar intellidev1991 commented on June 3, 2024

you can use this approach:

 images: [
        require('./my-icon1.png'),
        require('./my-icon2.png'),
        require('./my-icon3.png'),
]

from react-native-image-slider-box.

cbothra avatar cbothra commented on June 3, 2024

Hi @intellidev1991,
I tried importing the local files as below:

state = {
    images: [
        require('../assets/my-icon1.png'),
        require('../assets/my-icon1.png'),
        require('../assets/my-icon1.png'),
      ]
  };

But its not working as expected. I cannot see images and the simulator throws error

Could not find Image file:///users/......

On a side note when I load images from http or https url it works fine. But In my case I want to load them from local assets repository.
Any Help?

from react-native-image-slider-box.

intellidev1991 avatar intellidev1991 commented on June 3, 2024

Hi, Please first, install the last version( new version published )
then use require in images array:

 images: [
        "https://source.unsplash.com/1024x768/?tree", // Network image
        require('./assets/images/girl.jpg'),          // Local image
]

from react-native-image-slider-box.

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.