Skip to content

Commit c65b68c

Browse files
committed
fix: fix 'as' prop
1 parent b0fe638 commit c65b68c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/styled.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export function createStyled<Theme extends AnyTheme>() {
7676
(props: PropsWithChildren<ThemedProps & AnyStyleProps & AsComponentProps>, ref: React.ForwardedRef<unknown>) => {
7777
try {
7878
const theme = useContext(ThemeContext)
79-
const CastedComponent = (props.as ?? origin) as AnyComponent
8079
let propsForElement: ThemedProps = Object.assign({}, props, { theme, ref })
8180
let style: StyleProp<UnknownStyles> = fixedStyle
8281

@@ -94,6 +93,7 @@ export function createStyled<Theme extends AnyTheme>() {
9493
propsForElement.style = style
9594
propsForElement.theme = props.theme
9695

96+
const CastedComponent = (propsForElement.as ?? origin) as AnyComponent
9797
return createElement(CastedComponent, propsForElement)
9898
} catch (error: unknown) {
9999
injectReciverPathToStack(error, meta?.reciverFrames)

0 commit comments

Comments
 (0)