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 type 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 c6e5ab4 commit 2e028da
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 41 deletions.
63 changes: 29 additions & 34 deletions example/storybook/src/api/DescendantsStyles/ContextBasedStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,14 @@ import {
StyleSheet,
View,
} from 'react-native';
import {
AsForwarder,
createStyled,
styled1,
Theme,
} from '@gluestack-style/react';
import { AsForwarder, createStyled, styled } from '@gluestack-style/react';
import { Wrapper } from '../../components/Wrapper';
import { AddIcon, Box, Icon } from '@gluestack/design-system';
// import { AddIcon } from '@gluestack/design-system';
import { AlertCircle, Circle, Sun } from 'lucide-react-native';

import { AnimationResolver } from '@gluestack-style/animation-plugin';

const styled = createStyled([new AnimationResolver({})]);
const styleshet = StyleSheet.create({
style: {
padding: 12,
Expand All @@ -37,7 +31,6 @@ const Pressable = styled(
{
bg: '$red500',
p: '$2',

// 'bg': '$red600',
// 'w': 100,
// 'h': 100,
Expand Down Expand Up @@ -115,32 +108,34 @@ const Text = styled(
const StyledIcon = styled(
AsForwarder,
{
bg: '$red500',
variants: {
size: {
sm: {
width: 10,
height: 10,
// props: {
// size: 32,
// },
},
md: {
// props: {
// size: 32,
// },
width: '$4',
height: '$4',
},
lg: {
// props: {
// size: 32,
// },
width: '$6',
height: '$6',
},
},
},
bg: '$amber100',
bgColor: '$amber100',

// variants: {
// size: {
// sm: {
// width: 10,
// height: 10,
// // props: {
// // size: 32,
// // },
// },
// md: {
// // props: {
// // size: 32,
// // },
// width: '$4',
// height: '$4',
// },
// lg: {
// // props: {
// // size: 32,
// // },
// width: '$6',
// height: '$6',
// },
// },
// },
},
{
componentName: 'MyIcon',
Expand Down
11 changes: 4 additions & 7 deletions packages/react/src/AsForwarder.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import React from 'react';
import Svg from 'react-native-svg';
import type { ViewProps } from 'react-native';

export interface InterfaceAsForwardedProps extends ViewProps {
as?: any;
}
import type { RNProps } from './types';

const AsForwarderTemp = ({
as,
Expand All @@ -16,5 +12,6 @@ const AsForwarderTemp = ({
};
AsForwarderTemp.displayName = '__AsForwarder__';

export const AsForwarder =
AsForwarderTemp as React.ComponentType<InterfaceAsForwardedProps>;
export const AsForwarder = AsForwarderTemp as React.ComponentType<
RNProps & { as?: any }
>;

0 comments on commit 2e028da

Please sign in to comment.