Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

229
Vistas
Why does using Animated.createAnimatedComponent(Pressable) breaks my Pressable functionality?

I'm trying to animate a Pressable component which is why I'm trying to make it animatable like this:

const AnimatedPressable = Animated.createAnimatedComponent(Pressable);

And then use it instead of this:

    <Pressable
        style={({ pressed }) => [
            styles.button,
            styles[variant],
            { width, elevation: pressed && variant !== 'tertiary' ? 5 : 0 },
            { ...(variant === 'tertiary' && pressed ? { backgroundColor: colors.primary50 } : {}) },
            style,
        ]}
        {...rest}
    >
        <HeaderText variant="h4" style={[styles.text, { color: textColor }]}>
            {title}
        </HeaderText>
    </Pressable>

The problem is that as soon as I replace Pressable with AnimatedPressable, my styles break. After fiddling a bit, I realised that they break because of this:

    style={({ pressed }) => [
        styles.button,
        styles[variant],
        { width, elevation: pressed && variant !== 'tertiary' ? 5 : 0 },
        { ...(variant === 'tertiary' && pressed ? { backgroundColor: colors.primary50 } : {}) },
        style,
    ]}

If I remove the pressed, it works fine:

    style={[
        styles.button,
        styles[variant],
        style,
    ]}

Why can't I use pressed in that case?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda