/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v6.2.3
shared/util/debug.tsx
26 строк
704 B
chrisnojima
fix attachment layout issue (#25629)
14 апр 2023, 21:51
Не верифицирован
14 апр 2023, 21:51
4e68d2b
Код
Авторство
О чём код?
import * as React from 'react' export const useDebugLayout = __DEV__ ? (cb?: () => void) => { const sizeRef = React.useRef([0, 0]) return React.useCallback( (e: any) => { const height = e.nativeEvent.layout.height const width = e.nativeEvent.layout.width const [w, h] = sizeRef.current sizeRef.current = [width, height] if ((w && w !== width) || (h && h !== height)) { console.log('[DEBUG] useDebugLayout', { data: cb?.(), h, height, w, width, }) } }, [cb] ) } : () => { return undefined }