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

247
Views
Quiero mostrar y ocultar un elemento (ActivityIndicator)

Lo que estoy tratando de hacer es cuando hago clic en el botón, desaparece, y cuando ya está cargado en otro componente, muestra nuevamente el botón.

Código JSX:

 import { ActivityIndicator } from 'react-native'; {......} {/button besides loading/} <LinearGradient colors={['#D97B29', '#F2B47E']} style={styles.signIn} > <Text style={[styles.textSign, { color:'#fff' }]}>Entrar</Text> {/loading besides button /} <ActivityIndicator size="large" color="#D97B29" /> </LinearGradient> {...}

¿Cómo puedo manejarlo con el useState?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Suponiendo que desea ocultar/mostrar el indicador cuando se presiona el botón, necesita

 const [ showLoader, setShowLoader ] = useState(false);

Su botón al presionar debería mostrar algo como

 <Button onPress={() => setShowLoader(!showLoader)} text="Some text" />

y su código debería verse como

 {showLoader && ( <ActivityIndicator size="large" color="#D97B29" /> )} {!showLoader && <LinearGradient colors={['#D97B29', '#F2B47E']} style={styles.signIn} > <Text style={[styles.textSign, { color:'#fff' }]}>Entrar</Text> </LinearGradient> } ```
about 4 years ago · Juan Pablo Isaza Report

0

algo como esto

 {state && <ActivityIndicator size="large" color="#D97B29" />}

si state es true , mostrará el componente

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!