Skip to content

SimpleImageSlider always expects an element at index 0 #66

@Sillenaj

Description

@Sillenaj

The package has some issues which i will list here.

1)url key word must be present for it to work.
2) it's always expecting an element at index 0 for some reason
3) When the page first loads it always shows a black screen
4)if there is only one image, it doesn't load it or show it.

I had to make a workaround to fix these problems as such

const [imgUrls, setIMGUrls] = useState([{url:""}]);

await firebase.firestore().collection("Properties").where("propertyID","==",propID).get().then((snapshot) => { let images = [] snapshot.forEach((doc) => { const {imageUrls} = doc.data(); images = [...images, ...imageUrls.map(url => ({ url }))] }) setIMGUrls(images) }) return ( <SimpleImageSlider width={896} height={504} images={imgUrls} showBullets={true} showNavs={true} autoPlay={true} /> ) 

line of code that is causing the problem:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions