Skip to content

Commit

Permalink
Publish v1.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
yamankatby committed Dec 27, 2021
1 parent 21f2b86 commit e02258a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-native-material/core",
"version": "1.3.2",
"version": "1.3.3",
"description": "Modular and customizable Material Design UI components for React Native",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
8 changes: 5 additions & 3 deletions core/src/base/IconComponentContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { createContext, useContext } from "react";
import { Color, usePaletteColor } from "../hooks/use-palette-color";

export type IconComponent = React.ComponentType<IconProps>;

Expand All @@ -19,15 +20,16 @@ export interface IconProps {

size?: number;

color?: string;
color?: Color;

[key: string]: any;
}

export const Icon: React.FC<IconProps> = props => {
export const Icon: React.FC<IconProps> = ({ color = "on-background", ...rest }) => {
const IconComponent = useIconComponent();
if (!IconComponent) {
throw new Error("`IconComponent` is undefined. Seems like you forgot to wrap your component with `Provider`.");
}
return <IconComponent {...props} />;
const { main } = usePaletteColor(color);
return <IconComponent {...rest} color={main} />;
};

2 comments on commit e02258a

@vercel
Copy link

@vercel vercel bot commented on e02258a Dec 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on e02258a Dec 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.