mirror of
https://github.com/zhigang1992/nativewind.git
synced 2026-06-13 01:18:18 +08:00
729 B
729 B
sidebar_position, title, sidebar_label
| sidebar_position | title | sidebar_label |
|---|---|---|
| 2 | styled | styled() |
styled is a Higher-Order Component which allows your component to accep the tw or className props. These props are compiled into StyleSheet objects and passed to your component via the style prop.
There is no difference between tw and className, but tw has priority.
import { Text } from "react-native";
import { styled } from "tailwindcss-react-native";
const StyledText = styled(Text);
export function MyComponent() {
return (
<>
<StyledText tw="font-bold">Hello world</StyledText>
<StyledText className="font-bold">Hello world</StyledText>
</>
);
}