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

200
Visualizações
Typescript React Native AnimatedEvent: 'Type 'number' is not assignable to type 'Mapping'.ts(2322)'

Getting this typescript issue 'Type 'number' is not assignable to type 'Mapping'.ts(2322)' This occurs when trying to add an Animated event on scroll... typescript knowledge is a bit sparse wondering if anyone could point me in the right direction? please :)

ScreenShot of the issue 1

Heres the code I have rendering a FlatList

const Carousel: FunctionComponent<CarouselProps> = ({ data }) => {
  if (data && data.length) {
    return (
      <View>
        {data && data.length && (
          <FlatList
            data={data}
            keyExtractor={(item, index) => 'key' + index}
            horizontal
            pagingEnabled
            scrollEnabled
            scrollEventThrottle={16}
            snapToAlignment='center'
            decelerationRate={'fast'}
            showsHorizontalScrollIndicator={false}
            renderItem={({ item }) => {
              return <CarouselItem item={item} />;
            }}
            onScroll={Animated.event([{nativeElement: { contentOffset: { x: screenX }}}])}
          />
        )}
        <View style={styles.dotView}>
          {data.map((_: any, i: any) => {
            let opacity = position.interpolate({
              inputRange: [i - 1, i, i + 1],
              outputRange: [0.3],
              extrapolate: 'clamp'
            });
            return (
              <Animated.View
                key={i}
                style={{
                  opacity,
                  height: 10,
                  width: 10,
                  margin: 8,
                  borderRadius: 5
                }}
              />
            );
          })}
        </View>
      </View>
    );
  } else {
    return null;
  }
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You need to define what is scrollX. For example, create a const like this:

const scrollX = React.useRef(new Animted.Value(0)).current;

And that should be working fine!

about 4 years ago · Juan Pablo Isaza Relatório
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