仅在React Native中运行两次后,函数才返回参数

I am looking to implement this draggable list, everything works fine but my console log show nothing on first try only works second time I run the function, I'll need the order variable so I can update the database

<SortableListView
    removeClippedSubviews={false}
    style={{ flex: 1 }}
    data={data}
    order={order}
    onRowMoved={(e) => {
    order.splice(e.to, 0, order.splice(e.from, 1)[0])
    this.forceUpdate()
    this.updateList(order)
    }}
    renderRow={(row) => <RowComponent data={row} />}
/>

这是我的功能,我知道它是异步的,但不确定如何处理

  updateList = (neworder, e) => {
    console.log('updated')
    console.log('order: ' + order)
    console.log('neworder: ' + neworder)
  }
评论