delay context bar width/height access

pull/6345/head
Peng Xiao 2022-07-25 14:03:17 +08:00
parent ac27e5e6f8
commit 6ed07eaef0
1 changed files with 6 additions and 4 deletions

View File

@ -40,10 +40,12 @@ const _ContextBar: TLContextBarComponent<Shape> = ({ shapes, offsets }) => {
}, [])
React.useLayoutEffect(() => {
const elm = rContextBar.current
if (!elm) return
const { offsetWidth, offsetHeight } = elm
rSize.current = [offsetWidth, offsetHeight]
setTimeout(() => {
const elm = rContextBar.current
if (!elm) return
const { offsetWidth, offsetHeight } = elm
rSize.current = [offsetWidth, offsetHeight]
})
})
React.useLayoutEffect(() => {