delay context bar width/height access

This commit is contained in:
Peng Xiao
2022-07-25 14:03:17 +08:00
parent ac27e5e6f8
commit 6ed07eaef0

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(() => {