Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
Problem while upgrading a code snippet from firebasev8 to firebase v9

Before you read and look out for the answer of this question, Please read this question, as the current question is just the continuation of it. It was basically a code to display a List of Chat from firestore database. But it was a firebase v8 snippet.

The answer I got from the question was:


import { collection, onSnapshot } from "firebase/firestore";

useEffect(() => {
  const colRef = collection(db, "chats")

  onSnapshot(colRef, (snapshot) => {
    setChats(
      snapshot.docs.map((doc) => ({
        id: doc.id,
        data: doc.data(),
      }))
    )
  });

  return unsubscribe;
}, [])

But I was unable to verify the answer, because as I was using React Native, in the return() part. The code which I was running was not displaying the ChatNames. Most probably it was due to the incorrect syntax. Note: I did not receive any error, the chatName was simply not getting displayed

The following code was in my return() part:

// screens/HomeScreen.js
        {chats.map(({ id, data: { chatName }}) => (
          <CustomChatList /> // I have imported it correctly from '../components/CustomChatList'
        ))}

components/CustomChatScreen.js

import { View, Text } from 'react-native'
import React from 'react'
import { ListItem, Avatar } from 'react-native-elements'

const CustomChatList = ({ id, chatName, enterChat }) => {

  return (
    <ListItem bottomDivider>
        <Avatar rounded source={{ uri : 'https://toppng.com/uploads/preview/roger-berry-avatar-placeholder-11562991561rbrfzlng6h.png'}} />
        <ListItem.Content>
            <ListItem.Title>
                {chatName}
            </ListItem.Title>
            <ListItem.Subtitle numberOfLines={1} ellipsizeMode="tail">
                Lorem Ipsum Dummy Text
            </ListItem.Subtitle>
        </ListItem.Content>
    </ListItem>
  )
}

export default CustomChatList

Also Note: It is showing the ListItem.Subtitle and Avatar correctly.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!