Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
fix: as forwarder issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Suraj authored and Suraj committed Sep 13, 2023
1 parent 5e117f3 commit 1c58fd1
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/react/src/AsForwarder.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
import React from 'react';
import Svg from 'react-native-svg';
import type { ViewProps } from 'react-native';

const AsForwarder = ({ as, children, ...props }: any) => {
export interface InterfaceAsForwardedProps extends ViewProps {
as?: any;
}

const AsForwarderTemp = ({
as,
children,
...props
}: any): React.ReactElement => {
const As: any = as;
return as ? <As {...props}>{children}</As> : <Svg {...props}>{children}</Svg>;
};
AsForwarder.displayName = '__AsForwarder__';
export { AsForwarder };
AsForwarderTemp.displayName = '__AsForwarder__';

export const AsForwarder =
AsForwarderTemp as React.ComponentType<InterfaceAsForwardedProps>;

0 comments on commit 1c58fd1

Please sign in to comment.