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

454
Vistas
La animación nativa de React no funciona según lo previsto

Tengo un problema y quisiera ayuda. Quiero crear un botón con flecha derecha que se mueva. Pero desafortunadamente, la flecha comienza a moverse desde el comienzo del botón. Solo quiero mover esa flecha en el lado derecho. Así que por ahora parece que

ingrese la descripción de la imagen aquí

¡Creo que está sucediendo porque la animación se ve afectada por el contenedor del botón!

Así que mi código hasta ahora -

 <TouchableOpacity style={{ position: "absolute", bottom: 40, paddingVertical: 10, paddingHorizontal: 15, justifyContent: "center", width: "40%", borderRadius: 20, flexDirection: "row", backgroundColor: "#a12f2f", alignItems: "center", textAlign: "center" }} activeOpacity={0.9} onPress={() => onPressNext(count)} > <Text style={{ fontSize: 16,color: "white", marginRight: 10,}}> {count === 0 ? "Explain steps" : "Next step"} </Text> {count === 0 && ( <Animatable.View animation={"slideInLeft"} iterationCount={"infinite"} > <VectorIconComponent size={20} name={"arrowright"} color={"white"} type={ICON_TYPES.AntDesign} /> </Animatable.View> )} </TouchableOpacity>

También usé react-native-animatable para crear esa animación. Entonces mi pregunta es ¿cómo puedo hacer esta animación sin cruzar el texto?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Prueba esto !

 import React, { useEffect } from 'react' import { Animated, SafeAreaView, View, Text, TouchableOpacity, Image, Easing } from 'react-native' export default function App() { const animatedValue = new Animated.Value(0) useEffect(() => { _start() }, [animatedValue]) function _start() { const toValue = 35 Animated.loop( Animated.timing(animatedValue, { toValue, duration: 1000, useNativeDriver: true }) ).start() } function handlePress() { alert('ok') } return ( <SafeAreaView style={{ flex: 1 }}> <View style={{ flex: 1 }}> <TouchableOpacity activeOpacity={0.75} style={{ position: 'absolute', bottom: 20, height: 60, width: 200, backgroundColor: 'tan', alignSelf: 'center', borderRadius: 20, flexDirection: 'row' }} onPress={handlePress}> <View style={{ height: 60, width: 140, alignItems: 'center', justifyContent: 'center', }}> <Text> Explain Steps </Text> </View> <View style={{ height: 60, width: 60, justifyContent: 'center', }}> <Animated.View style={{ height: 30, width: 30, transform: [{ translateX: animatedValue }] }}> <Image source={{ uri: 'https://cdn.iconscout.com/icon/free/png-256/right-arrow-1438234-1216195.png' }} style={{ height: '100%', width: '100%' }} /> </Animated.View> </View> </TouchableOpacity> </View> </SafeAreaView> ) }

Producción

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