@gluestack-ui/hooks
Version:
Provides hooks used in gluestack-ui
16 lines (14 loc) • 318 B
text/typescript
import { useState } from 'react';
import type { LayoutChangeEvent } from 'react-native';
export const useLayout = () => {
const [layout, setLayout] = useState({
width: 0,
height: 0,
});
return {
onLayout: (e: LayoutChangeEvent) => {
setLayout(e.nativeEvent.layout);
},
layout,
};
};