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

Invalid frame dimension (negative or non-finite) #54

Closed
cbartellds opened this issue Feb 9, 2021 · 2 comments · Fixed by #55
Closed

Invalid frame dimension (negative or non-finite) #54

cbartellds opened this issue Feb 9, 2021 · 2 comments · Fixed by #55

Comments

@cbartellds
Copy link

cbartellds commented Feb 9, 2021

I am getting this warning when I run my app and go to the view that is using the WaterfallGrid.

Screen Shot 2021-02-09 at 8 21 31 AM

I think it's causing what than displays to disappear when I scroll up on the page. I'm not sure.

`///:  FAVORITE ITEMS GRID
     WaterfallGrid(favoriteItems.favorites, id: \.self) { item in
        ZStack(alignment: .topTrailing) {
            FavoriteItemView(favoriteItem: item)
         } ///: ZSTACK
       } //: WATERFALL
          .gridStyle(
             columnsInPortrait: 2,
             columnsInLandscape: 3,
             spacing: 10,
             animation: .easeInOut(duration: 0.5)
          )
          .padding(EdgeInsets(top: 0, leading: 8, bottom: 15, trailing: 8))
                .scrollOptions(direction: .vertical)
                .onAppear(perform: loadFavorites)`

I am pulling the items that display from Cloud Firestore.

`func loadFavorites() {
    
    db.collection("favorites").getDocuments() { (querySnapshot, err) in
        if let err = err {
            print("Error getting documents: \(err)")
        } else {
            for document in querySnapshot!.documents {

                let docId = document.documentID
                let itemInfo = document.data()
                let itemType = itemInfo["itemType"] as? String ?? "shareable"
                let itemTitle = itemInfo["itemTitle"] as? String ?? "DaySpring"
                let itemImage = itemInfo["itemImage"] as? String ?? "No Photo"
                let itemAuthor = itemInfo["itemAuthor"] as? String ?? "DaySpring"
             
                db.collection("users").document(userId!).addSnapshotListener { documentSnapshot, error in
                    guard let userFavs = documentSnapshot else {
                        print("Error fetching document: \(error!)")
                        return
                    }
                    guard let data = userFavs.data() else {
                        print("Document data was empty.")
                        return
                    }
                    if let favorites = data["favorites"] as? [String: Any] {
                        if let favItem = favorites[docId] as? [String: Any] {
                            if let fav = favItem["itemActive"] as? Bool {
                                if fav {
                                    if let itemDate = favItem["itemAdded"] as? Timestamp {
                                        let thisDate = itemDate.dateValue()
                                        self.favorites.append(FavoriteItem(id: docId, itemType: itemType, itemImage: itemImage, itemTitle: itemTitle, itemAuthor: itemAuthor, itemDate: thisDate))
                                        DispatchQueue.main.async {
                                            self.favorites.sort(by: { $0.itemDate > $1.itemDate })
                                        }
                                    }

                                }
                            }
                        }
                    }
                }
                
            }
        }
    }
    
}`
@fabios9702
Copy link

Same problem for me, the first time the datas are fetched are shown, then appears a space :|

@paololeonardi paololeonardi linked a pull request Feb 13, 2021 that will close this issue
@paololeonardi
Copy link
Owner

This should now be fixed with version 1.0.1
Thanks.

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

Successfully merging a pull request may close this issue.

3 participants