Revision 44fb2f32a75d3c7333c893fcfee6822cf25c0450 authored by Viraj-10 on 11 October 2022, 11:32:35 UTC, committed by Viraj-10 on 11 October 2022, 11:32:35 UTC
1 parent e2a05f1
Raw File
useLayout.tsx
import React from 'react';
import type { LayoutChangeEvent } from 'react-native';

export const useLayout = () => {
  const [layout, setLayout] = React.useState({
    width: 0,
    height: 0,
  });
  return {
    onLayout: (e: LayoutChangeEvent) => {
      setLayout(e.nativeEvent.layout);
    },
    layout,
  };
};
back to top