'AWS Datastore not saving users in the database on Android

I have a code that will save user in the database on my profile screen, but the code worked fine on iOS, but on android it throws a "Possible unhandled Promise Rejection" with "TypeError: Symbol.asyncIterator is not defined." Please how can solve the issue on Android so that it can save to database? I am working with React Native. Here is the code snippet:

import {Auth, DataStore} from 'aws-amplify';

const ProfileScreen = () => {

    const [name, setName] = useState('');
    const [bio, setBio] = useState('');
    const [gender, setGender] = useState();
    const [lookingfor, setLookingfor] = useState();

    const isValid = () => {
        return name && bio && gender && lookingfor;
    };

    const save = () => {
        if(!isValid()) {
            console.warn('Not valid');
            return;
        }

        const newUser = new User({
            name,
            bio,
            gender,
            lookingfor,
            image: 'https://notjustdev-dummy.s3.us-east-2.amazonaws.com/avatars/elon.png',
        });

        DataStore.save(newUser);

    };
    return ...


Solution 1:[1]

Accoding to the documentation, since save returns a promise instead of doing the opeartion itself, add await or subscribe with then to the save function;

await DataStore.save(newUser); 

or

DataStore.save(newUser).then(...);

Solution 2:[2]

I've been doing the same project. It worked for me when I did:

npm install @azure/core-asynciterator-polyfill

Then added:

import '@azure/core-asynciterator-polyfill'; 

at the very top of my imports in the page I was working on.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kemal Kaplan
Solution 2 Dharman