rakannimer / react-firebase

🔥Declarative React bindings for Firebase Auth & Realtime Database.

Home Page:https://react-firebase-js.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FirestoreDocument within a FirestoreCollection

isobarwill opened this issue · comments

Thanks for creating this library. Great job!

I have a unique case where I am attempting to render FirestoreDocument with a dynamic path. For example:

                      <FirestoreCollection path={parentPath} >
                        {items => {
                          return items.value ? (
                            <FlatList
                              data={items.value}
                              renderItem={({ item }) => (     
                                //item.ref is a Firestore reference type
                                <FirestoreDocument path={item.ref.path}>
                                  {match => {
                                    return match.value ? (
                                      <Text>Never rendered</Text>
                                    ) : (
                                      <Text> Loading.....forever</Text>
                                    );
                                  }}
                                </FirestoreDocument>
                              )}
                            />
                          ) : (
                               <Text> Loading...</Text>
                          );
                        }}
                      </FirestoreCollection>

match.value is always null.

Thanks!

Hey @isobarwill ,

Thanks for reporting the issue.
Your use-case makes sense to me, does the collection render and did you make sure the path is arriving as expected to the child ?

If you could fork one of the sandboxes and try to reproduce that would be awesome too !

Cheers !