export default function AccountScreen()

in sample/src/screens/AccountScreen.js [28:91]


export default function AccountScreen() {
  let user = getCognitoUser(true);
  const { attributes } = user;
  let firstName = useFormInput(attributes ? attributes.given_name : '');
  let lastName = useFormInput(attributes ? attributes.family_name : '');
  let phoneNumber = useFormInput(attributes ? attributes.phone_number : '');
  const email = useFormInput(attributes ? attributes.email : '');

  updateParticulars = async () => {
    const updatedAttributes = {
      given_name: firstName.value,
      family_name: lastName.value,
      phone_number: phoneNumber.value,
    };

    Analytics.record({
      name: 'updateParticulars',
      attributes: {
        email: email.value,
        ...updatedAttributes,
      },
    });

    console.log('Analytics', {
      name: 'updateParticulars',
      attributes: {
        email: email.value,
        ...updatedAttributes,
      },
    });

    let result = await Auth.updateUserAttributes(user, updatedAttributes)
      .catch((err) => {
        console.error(err);
        return err;
      })
      .then((res) => {
        return res;
      });
    Toast.show({
      text: `${result}!`,
      buttonText: 'Okay',
      position: 'top',
    });
    if (result === 'SUCCESS') {
      updateDatabaseUser(user.username, {
        ...attributes,
        ...updatedAttributes,
      });
    }
    return result;
  };

  return (
    <Container>
      <Header>
        <Left />
        <Body>
          <Title>
            <Text>Account</Text>
          </Title>
        </Body>
        <Right>
          <Button transparent onPress={() => updateParticulars()}>