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

403
Views
¿Cómo manejar los cambios en el elemento de alternancia @ionic-react?

Estoy usando la biblioteca @ionic-react y ahora tengo que agregar un valor verdadero/falso de IonToggle simple pero estoy atascado, no puedo manejar los cambios y lo gracioso es que si imprimo en la pantalla el nuevo valor que veo "encendido" cada vez. ¿Cómo puedo manejar eventos en @ionic-react Toggle?

Código:

 import { IonToggle } from "@ionic/react"; /... .../ <IonItem> <IonLabel color="primary" position="stacked"> Enable Photo </IonLabel> <IonToggle datatype = "boolean" onChange={(e) => {console.log('test')}}/> </IonItem>

Resultado: ingrese la descripción de la imagen aquí

Espero valor verdadero/falso. ¿Tienes alguna idea? :)

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

0

Puede usar el estado para administrar el valor de alternancia (true/false)

 import React, { useState } from 'react'; const YourContainer: React.FC<ContainerProps> = ({ name }) => { // here you set the initial state using the useState hook: const [isChecked, setIsChecked] = useState(false); const buttonToggle = () => { setIsChecked(!isChecked); } return ( <IonContent> <IonList> <IonItem> <IonLabel color="primary" position="stacked"> Enable Photo </IonLabel> <IonToggle checked={isChecked} onChange={(e) => buttonToggle()}/> </IonItem> </IonList> </IonContent> ) }
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!