Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: upgrade to latest version on nativewind #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions components/ui/accordion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
withStyleContext,
useStyleContext,
} from "@gluestack-ui/nativewind-utils/withStyleContext";
import { withStyleContextAndStates } from "@gluestack-ui/nativewind-utils/withStyleContextAndStates";
import { H3 } from "@expo/html-elements";
import { cssInterop } from "nativewind";

Expand All @@ -30,6 +29,7 @@ const accordionStyle = tva({
},
},
});

const accordionItemStyle = tva({
base: "py-3 px-4",
parentVariants: {
Expand Down Expand Up @@ -92,6 +92,7 @@ type IPrimitiveIcon = {
as?: React.ElementType;
className?: string;
classNameColor?: string;
style?: any;
};

const PrimitiveIcon = React.forwardRef<
Expand All @@ -108,6 +109,7 @@ const PrimitiveIcon = React.forwardRef<
size,
stroke = "currentColor",
as: AsComp,
style,
...props
},
ref
Expand All @@ -132,18 +134,23 @@ const PrimitiveIcon = React.forwardRef<
}

if (AsComp) {
return <AsComp ref={ref} {...props} {...sizeProps} {...colorProps} />;
return (
<AsComp
ref={ref}
{...props}
style={style}
{...sizeProps}
{...colorProps}
/>
);
}
return (
<Svg ref={ref} height={height} width={width} {...colorProps} {...props} />
);
}
);

const Root =
Platform.OS === "web"
? withStyleContext(View, SCOPE)
: withStyleContextAndStates(View, SCOPE);
const Root = withStyleContext(View, SCOPE);

const Header = (
Platform.OS === "web" ? H3 : View
Expand All @@ -161,16 +168,6 @@ const UIAccordion = createAccordion({
Content: View,
});

cssInterop(UIAccordion, { className: "style" });
cssInterop(UIAccordion.Item, { className: "style" });
cssInterop(UIAccordion.Header, { className: "style" });
cssInterop(UIAccordion.Trigger, { className: "style" });
//@ts-ignore
cssInterop(UIAccordion.Icon, { className: "style" });
cssInterop(UIAccordion.TitleText, { className: "style" });
cssInterop(UIAccordion.Content, { className: "style" });
cssInterop(UIAccordion.ContentText, { className: "style" });
// @ts-ignore
cssInterop(UIAccordion.Icon, {
className: {
target: "style",
Expand Down
Loading