How to use the react-native-firebase.apps function in react-native-firebase

To help you get started, we’ve selected a few react-native-firebase examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AOSSIE-Org / CarbonFootprint-Mobile / app / actions / firebase / Init.js View on Github external
return new Promise(function(resolve, reject) {
        if (!firebase.apps.length) {
            firebase.initializeApp(firebaseConfig);
        }
        const serverTime = firebase.database().getServerTime();
        console.log(serverTime, 'ServerTime');
        firebase.auth().onAuthStateChanged(function(user) {
            if (user) {
                user = user.toJSON();
                getUser(user.email)
                    .then(user => resolve(user))
                    .catch(error => reject());
            } else {
                reject();
            }
        });
    });
}