Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

React Native App not navigating after successful firebase auth

$
0
0

I am using expo to build my first react native app, so far been great and I am only frustrated with one issue:

My app is not redirecting to "profile" after successful login. Here is how I handle login/signup using firebase:

class Login extends React.Component {state = {    email: '',    password: ''}handleLogin = () => {    const { email, password } = this.state         Firebase.auth()        .signInWithEmailAndPassword(email, password)         .then(() => this.props.navigation.navigate('Profile'))        .catch(error => console.log(error))}render() {    return (<View style={styles.container}><Text style={styles.headerText}>traderank</Text><TextInput                style={styles.inputBox}                value={this.state.email}                onChangeText={email => this.setState({ email })}                placeholder='email'                autoCapitalize='none'            /><TextInput                style={styles.inputBox}                value={this.state.password}                onChangeText={password => this.setState({ password })}                placeholder='password'                secureTextEntry={true}            /><TouchableOpacity             style={styles.button}            onPress={this.handleLogin}><Text style={styles.buttonText}>login</Text></TouchableOpacity><Button             title="no account? sign up"             onPress={() => this.props.navigation.navigate('Signup')}/></View>    )}}

Signup is the same with this handleAuth function:

handleSignUp = () => {    const { email, password } = this.state    Firebase.auth()        .createUserWithEmailAndPassword(email, password)        .then(() => this.props.navigation.navigate('Profile'))        .catch(error => console.log(error))}

1)I know it is not a problem with my navigator, because I can go between login/signup by clicking buttons.

2)I know it is not a problem with firebase, because I can create a new user and see the user in the firebase console

3)I am getting this error when I click login:

Error: Failed to create storage directory.Error Domain=NSCocoaErrorDomain Code=4 "The file “RCTAsyncLocalStorage” doesn’t exist."

UserInfo={NSFilePath=/Users/me/Library/Developer/CoreSimulator/Devices/264989F0-2165-4E91-8EA3-48316590DE5A/data/Containers/Data/Application/A49D7AF5-C660-4292-9576-A986C3F97C38/Documents/ExponentExperienceData/%40anonymous%project-numbers/RCTAsyncLocalStorage, NSUnderlyingError=0x600000778180

{Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

It should redirect when I click Signup too, but when I create a new user I see this get logged in my terminal [User is being created when I click signup, I see user in firebase console]:

Failed to create storage directory.Error Domain=NSCocoaErrorDomain Code=4 "The file “RCTAsyncLocalStorage” doesn’t exist."

It seems to be an issue with RCTAsyncLocalStorage in both instances. Normally I can google the error and figure it out, but haven't found much on this. I am using react native expo ~39.0.2, running it on an iPhone 11 (13.7).

Thanks in advance


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>