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

150
Views
Poner datos de AsyncStorage en texto

He almacenado mis datos en el host local usando AsyncStorage y funciona bien. Puedo alert e iniciar sesión sin conexión, pero cuando voy a otra página puedo alert pero no puedo ponerlo en Text . Intenté algunas formas pero no funcionó.

 onSumbit = async () => { try{ await AsyncStorage.setItem('UserEmail',this.state.UserEmail) }catch (err){ console.log(err) } } getData = async () => { try { const UserEmail = await AsyncStorage.getItem('UserEmail') if(UserEmail !== null) { this.setState({ UserEmail }); console.log(UserEmail); } } catch(e) { //Error reading value } } <Text style={styles.FormText}>{this.state.UserEmail}</Text> <TextInput placeholder="Enter User Email" value={this.state.UserEmail} onChangeText={(UserEmail) => this.setState({UserEmail})} underlineColorAndroid='transparent' style={styles.TextInputStyleClass} /> //This code is working displayData = async ()=> { try{ let user = await AsyncStorage.getItem('UserEmail'); alert(user); }catch(error){ alert(error) } } /// in home page (another page ) render() { return ( <TouchableOpacity onPress ={this.displayData}> <Text>Click to display data</Text> </TouchableOpacity> ); } //This is work too, but in the Text it's not working
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar JSON.parse() para convertir la cadena de datos AsyncStorage al formato JSON

Este es tu código:

 let user = await AsyncStorage.getItem('UserEmail'); alert(user);

Y esto es lo que tienes que hacer:

 let user = await AsyncStorage.getItem('UserEmail'); alert(JSON.parse(user));
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!