函数运行中的事件发射器回调

时间:2019-02-21 16:22:16

标签: react-native events eventemitter

我正在使用EventEmitter触发事件,并且无法在此事件中使用的类内运行方法。我在哪里做错了,如何解决这个问题?

    StaticBase.emitter.addListener('event', this._updateEvent);

_updateEvent(value) {
    if (value.length > 3) {
        this.setState({ keys: value });//---->ERROR function not found, etc .. errors
        this.UpdateList();
    }
}

UpdateList() {
    this.setState({ isLoading: true });
    console.log('POST------>>');
    axios.post('.........')
        .then(response => {
            this.setState({ newlist: response.data });
            this.setState({ isLoading: false });
        }).catch(ex => {
            console.log(ex);
            this.setState({ isLoading: false });
        });
}

0 个答案:

没有答案
相关问题