mirror of
https://github.com/zhigang1992/nativewind.git
synced 2026-06-15 02:09:06 +08:00
Merge branch 'main' into next
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
## [1.0.4](https://github.com/marklawlor/tailwindcss-react-native/compare/v1.0.3...v1.0.4) (2022-05-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* rendering nested child styled components ([a69f600](https://github.com/marklawlor/tailwindcss-react-native/commit/a69f600787dc7ff080f7539f4dfc4b8be3b770dc))
|
||||
|
||||
## [1.0.3](https://github.com/marklawlor/tailwindcss-react-native/compare/v1.0.2...v1.0.3) (2022-05-07)
|
||||
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ import { createElement, FunctionComponent, ComponentClass } from "react";
|
||||
import { ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
|
||||
import { useTailwind } from "./use-tailwind";
|
||||
|
||||
const isStyled = Symbol("styled");
|
||||
|
||||
type StyledProps<P> = P & {
|
||||
className?: string;
|
||||
tw?: string;
|
||||
@@ -36,25 +34,17 @@ export function styled<P>(
|
||||
}`;
|
||||
}
|
||||
|
||||
Styled[isStyled] = true;
|
||||
|
||||
return Styled;
|
||||
}
|
||||
|
||||
type StyledComponentProps<P> = StyledProps<P> & {
|
||||
component: Component<P> & {
|
||||
[isStyled]?: boolean;
|
||||
};
|
||||
component: Component<P>;
|
||||
};
|
||||
|
||||
export function StyledComponent<P>({
|
||||
component,
|
||||
...options
|
||||
}: StyledComponentProps<P>) {
|
||||
if (component[isStyled]) {
|
||||
return component;
|
||||
}
|
||||
|
||||
return styled<P>(component)(options as P);
|
||||
const Component = styled<P>(component);
|
||||
return <Component {...(options as P)} />;
|
||||
}
|
||||
StyledComponent[isStyled] = true;
|
||||
Reference in New Issue
Block a user