Advance reactnative Unhandled error was caught from sUbmitForm() on register screen

This is my register screen

import React, { useState } from “react”;

import { StyleSheet } from “react-native”;

import * as Yup from “yup”;

import Screen from “…/comp/Screen”;

import usersApi from “…/api/users”;

import authApi from “…/api/auth”;

import useAuth from “…/auth/useAuth”;

import {

ErrorMessage,

AppForm,

AppFormField,

SubmitButton,

} from “…/comp/Form”;

import useApi from “…/hooks/useApi”;

import ActivityIndicator from “…/comp/ActivityIndicator”;

const validationSchema = Yup.object().shape({

name: Yup.string().required().label(“Name”),

email: Yup.string().required().email().label(“Email”),

password: Yup.string().required().min(4).label(“Password”),

});

function RegisterScreen() {

const registerApi = useApi(usersApi.register);

const loginApi = useApi(authApi.login);

const auth = useAuth();

const [error, setError] = useState();

const handleSubmit = async (userInfo) => {

const result = await registerApi.request(userInfo);

if (!result.ok) {

  if (result.data) setError(result.data.error);

  else {

    setError("An unexpected error occurred.");

    console.log(result);

  }

  return;

}

const { data: authToken } = await loginApi.request(

  userInfo.email,

  userInfo.password

);

auth.logIn(authToken);

};

return (

<>

  <ActivityIndicator visible={registerApi.loading || loginApi.loading} />

  <Screen style={styles.container}>

    <AppForm

      initialValues={{ name: "", email: "", password: "" }}

      onSubmit={handleSubmit}

      validationSchema={validationSchema}

    >

      <ErrorMessage error={error} visible={error} />

      <AppFormField

        autoCorrect={false}

        icon="account"

        name="name"

        placeholder="Name"

      />

      <AppFormField

        autoCapitalize="none"

        autoCorrect={false}

        icon="email"

        keyboardType="email-address"

        name="email"

        placeholder="Email"

        textContentType="emailAddress"

      />

      <AppFormField

        autoCapitalize="none"

        autoCorrect={false}

        icon="lock"

        name="password"

        placeholder="Password"

        secureTextEntry

        textContentType="password"

      />

      <SubmitButton title="Register" />

    </AppForm>

  </Screen>

</>

);

}

const styles = StyleSheet.create({

container: {

padding: 10,

},

});

export default RegisterScreen;

I looked through my code base and couldn’t find “getTokenget()” – that seems like an odd name for a function. Maybe you have a typo in one of the imported files?

Sorry I can’t help more. It has been months since I completed the course. Also, it is helpful to reference which course/module/lesson you’re on when you post a question because the code in the course changes as the course progresses. That will help forum participants provide assistance.

Thanks dpickut that exactly solved the problem.

the problem i am having right now is how to get the push token notification