(ref)
| 1 | export function updateRefHeight(ref) { |
| 2 | ref.current.style.height = 'auto' |
| 3 | const computed = window.getComputedStyle(ref.current) |
| 4 | const height = |
| 5 | parseInt(computed.getPropertyValue('border-top-width'), 10) + |
| 6 | parseInt(computed.getPropertyValue('padding-top'), 10) + |
| 7 | ref.current.scrollHeight + |
| 8 | parseInt(computed.getPropertyValue('padding-bottom'), 10) + |
| 9 | parseInt(computed.getPropertyValue('border-bottom-width'), 10) |
| 10 | ref.current.style.height = `${height}px` |
| 11 | } |