Each time I register to the app via expo after I insert the new mail and the password I get this screen.this is the screen error
even after I close the expo end open again it show the same red screen with message.But if I close the project (refresh it by shake) and enter the whole project again, now with an exist user it and works perfectly so far...(still got fixes to do).
This is the **Register.js page code:**
import React, { Component } from "react";import { View, Button, StyleSheet, TextInput, Alert, AsyncStorage } from "react-native";const URL = 'http://185.60.170.14/plesk-site-preview/ruppinmobile.ac.il/site17/WebService.asmx';export default class Register extends Component { state = { email: "", password: "", repassword: "" }; Register = () => { if(this.state.password != this.state.repassword){ Alert.alert("Error",'Password does not match', [{ text: "OK", onPress: () => null }], { cancelable: false } ); this.setState({password: '', repassword: ''}); return; } let data = { email: this.state.email, password: this.state.password }; fetch(URL +"/Register", { // בקשהלשרתלמתודה Register body: JSON.stringify(data), // שליחתפרמטרים method: "POST", headers: {"Content-type": "application/json; charset=UTF-8" } }) .then(res => { return res.json(); }) .then(userData => { console.log(userData.d); if (userData.d == "Error: This email is already in use") { Alert.alert("Error", userData.d, [{ text: "OK", onPress: () => null }], { cancelable: false } ); } else { AsyncStorage.setItem("@KnowingFriends:user", userData.d); this.props.navigation.navigate("MainApp"); } }) .catch(err => { console.error(err); }); }; render() { return (<View style={styles.container}><TextInput style={styles.input} onChangeText={text => this.setState({ email: text })} value={this.state.email} placeholder="Email" /><TextInput style={styles.input} onChangeText={text => this.setState({ password: text })} value={this.state.password} secureTextEntry={true} placeholder="Password" /><TextInput style={styles.input} onChangeText={text => this.setState({ repassword: text })} value={this.state.repassword} secureTextEntry={true} placeholder="Repeat Password" /><Button onPress={this.Register} title="Submit" color="#841584" /><Button onPress={() => { this.props.navigation.navigate("Login"); }} title="Go back" color="#841584" /></View> ); }}const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: "#fff", alignItems: "center", justifyContent: "center" }, input: { height: 40, width: 300, borderColor: "gray", borderWidth: 1 }});
how can I fix this issue ?