Skip to content

Commit

Permalink
fix: ts error due to react types forwardRef changes (#528)
Browse files Browse the repository at this point in the history
Co-authored-by: Aironas Kulvelis <aironaskulvelis@AKul-macbook.local>
  • Loading branch information
akuul and Aironas Kulvelis authored Sep 10, 2024
1 parent f99cb14 commit a2467c5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/SafeAreaContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,13 @@ export type WithSafeAreaInsetsProps = {
};

export function withSafeAreaInsets<T>(
WrappedComponent: React.ComponentType<T & WithSafeAreaInsetsProps>,
WrappedComponent: React.ComponentType<
(React.PropsWithoutRef<T> | T) & WithSafeAreaInsetsProps
>,
): React.ForwardRefExoticComponent<
React.PropsWithoutRef<T> & React.RefAttributes<unknown>
> {
return React.forwardRef((props: T, ref: React.Ref<unknown>) => {
return React.forwardRef<unknown, T>((props, ref) => {
const insets = useSafeAreaInsets();
return <WrappedComponent {...props} insets={insets} ref={ref} />;
});
Expand Down

0 comments on commit a2467c5

Please sign in to comment.