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

138
Views
firebase react native animate flatlist

im developing a react native application using Flatlist.i having been through a lot tutorials. i'm not exactly sure what is the problem, i need a fresh pair of eyes. This is my code,

i am trying to display data in an animate flatlist. i have not been able to retrieve the data. i used the react hook and put it into an array, what exactly am i doing wrong here. is the

 useEffect(() => {
    firebase.firestore()
      .collection('Courses')
   .doc('CourseID')
           .get()
             .then((snapshot) => {
      let myData = [];
        snapshot.forEach((doc) => {
        
       
            const data = doc.data()
              myData.push({
            id: doc.id,
            name:  data.CourseName,
            number: data.price,img: data.courseImage,
            pres: data.CourseTime
          });  });
            setToken(myData)
        
      }).catch((error) => {
          console.log("Error getting document:", error);
    
  }) }, []);

  const TCard = ({name,number,pres,img,index}) => {
    const inputRange = [
      (index - 1) * cardWidth,
      index * cardWidth,
      (index + 1) * cardWidth,
    ];
    const opacity = scrollX.interpolate({
      inputRange,
      outputRange: [0.7, 0, 0.7],
    });
    const scale = scrollX.interpolate({
      inputRange,
      outputRange: [0.8, 1, 0.8],
    });

  return (    <Animated.FlatList
            onMomentumScrollEnd={(e) => {
              setActiveCardIndex(
                Math.round(e.nativeEvent.contentOffset.x / cardWidth),
              );
            }}
            onScroll={Animated.event(
              [{nativeEvent: {contentOffset: {x: scrollX}}}],
              {useNativeDriver: true},
            )}
            horizontal
            data={token}
            contentContainerStyle={{
              paddingVertical: 30,
              paddingLeft: 20,
              paddingRight: cardWidth / 2 - 40,
            }}
            showsHorizontalScrollIndicator={false}
            renderItem={({item, index}) => <TCard name={item.CourseName} pres={item.price} img={item.img} index={index} />}
            snapToInterval={cardWidth}
          />)```
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!