从自定义平面列表视图调用异步函数

Calling async function from custom flatlist view

我正在尝试在客户平面列表视图中调用异步函数,但在自定义平面列表视图中使用 await 导致出现错误:

async _customFlatlistView(item){
    promise = await SomeFunction(); 

    promise2 = await SomeOtherFunction();
}

await只能在async函数中使用

_customFlatlistView = async item => {
  promise = await SomeFunction()
  promise2 = await SomeOtherFunction()
}

await关键字只能用于在方法签名中添加async关键字:

    async _customFlatlistView(item){
        promise = await SomeFunction(); 

        promise2 = await SomeOtherFunction();
    }