0
measure()
の機能を使用していくつかの値を測定する必要があります。複数の「メジャー」オペレーションを同期して呼び出す
this.refContainerView.measure((x, y, width, height, pageX, pageY) => {
const containerViewHeight = height
this.refCommentList.measure((x, y, width, height, pageX, pageY) => {
const commentListOffset = pageY
const commentListHeight = height
// do something
})
})
をし、より多くの成分を測定するために必要であれば、それはコールバック地獄のようになります。
それは非同期操作ですので、私は書くことができます。
コードを同期して書くことは可能ですか? await
または他の助けを借り、例えば:
const contaierView = this.refContainerView.measure()
const commentList = this.refCommentList.measure()
// and then do something with
contaierView {x, y, width, height, pageX, pageY}
commentList {x, y, width, height, pageX, pageY}