Skip to content
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

SimpleImageSlider always expects an element at index 0 #66

Closed
Sillenaj opened this issue Feb 23, 2022 · 0 comments
Closed

SimpleImageSlider always expects an element at index 0 #66

Sillenaj opened this issue Feb 23, 2022 · 0 comments

Comments

@Sillenaj
Copy link

Sillenaj commented Feb 23, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants