Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

139
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda