I'm new to react-native and trying to build a simple app with firebase as backend.
I have made a sign-up, login, logout and setting a mobilenumber. I'm trying to read the mobilenumber data realtime. The function to get the data is as follow:
_listenForMobileNumberChanges(userId, callback) {
let userMobilePath = "/user/" + userId + "/details";
firebase.database().ref(userMobilePath).on('value', (snapshot) => {
var mobile = "";
if (snapshot.val()) {
mobile = snapshot.val().mobile
}
callback(mobile)
});
}
In the render function I placed a ListView and called the function:
<ListView
dataSource={this.state.mobile}
renderRow={() => {this._listenForMobileNumberChanges(this.state.userId}}
/>
I know i'm missing the callback parameter in the Listview call, but I don't know what to add to the parameter, could anyone help?