I'm using react-native-firebase version "5.2.1". The .on() method only triggers for the first time the database is used. After that, nothing happens, neither it returns any error nor its updates while the value in the database is updated I tried both ways, manually changing the data or changing it with the .update() method. But in vain.

export const getUser = (phoneNumber) => {
    return (dispatch) => {
        firebase.database().ref(`/users/${phoneNumber}`).on('value', function 
        (snapshot) {
                type: 'USER_DATA',
                payload: snapshot.val()
                { allowMore: true }

The snapshot will return the values of fname, lname, phone number gender, city and isDoctor, by default isDoctor is set to false. I want that when a user registers himself as a doctor, the value of isDoctor in redux updates to true so that he cannot submit that form again.

0 Answers