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

88
Views
Animado. El estilo de vista no cambia aunque el valor de la variable de animación se actualice

Quiero que el texto se mueva hacia arriba cuando haga clic en él. Pero a pesar de que el valor de topPosition se actualiza al hacer clic en -40, la vista nunca se mueve. ¿Cómo puedo hacer que la animación se ejecute?

 const TabButton = () => { //Animation variables const topPosition = useRef(new Animated.Value(1)).current; const labelVisibility = useRef(false); const pushIconUp = () => { console.log('dwad'); Animated.timing(topPosition, { toValue: -40, duration: 1000, useNativeDriver: false, }).start(); console.log(topPosition); }; const pushIconDown = () => { Animated.timing(topPosition, { toValue: 0, duration: 100, useNativeDriver: false, }).start(); }; return ( <TouchableHighlight onPress={pushIconUp}> <Animated.View style={{marginTop: topPosition, borderColor: 'white'}}> <Text>daw</Text> </Animated.View> </TouchableHighlight> ); }; export default TabButton;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Creo que es mejor si animas la traducción y también TouchableOpacity debería estar dentro de Animated.View .

 <Animated.View style={{ transform: [{ translateY: topPosition }], borderColor: 'white'}}> <TouchableHighlight onPress={pushIconUp}> <Text>daw</Text> </TouchableHighlight> </Animated.View>

También puede habilitar useNativeDriver

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