خرید بک لینک

Vote count: 0

in my React-native app I am trying to call another function within my listenForItems function, but keep getting the error this.populateArray is not a function. In 'this.populateArray(solutions)', this.populateArray is undefined. I do this in other classes and it's working, but for some reason it's not working here. Is there anything I'm missing?

populateArray: function(solutions) {
    var completed = [];
    var inProgress;

    for (var i = 0; i < solutions.length; i++ ) {
        if (solutions[i].completed == 0) {
            inProgress = solutions[i].id;
        }
        else {
            completed.push(solutions[i].id);
        }
    }
},  

listenForItems: function(cluesRef) {

    var solutions = [];
    userSolutionsRef.orderByChild('user_id').startAt(0).endAt(0).once('value', function(snap){
        var solution = snap.val();
        for (var i = 0; i < solution.length; i++) {
            if (solution[0].hunt_id == 0) {
                solutions.push(solution[0]);
            }
        }
        this.populateArray(solutions);
    });
},

asked 43 secs ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 28 ارديبهشت 1395 ساعت: 9:58

صفحه بندی