Skip to content

feat: add more components #101

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

Merged
merged 1 commit into from
Aug 19, 2025
Merged
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
27 changes: 27 additions & 0 deletions src/components/ActivityIndicator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {
ActivityIndicator as RNActivityIndicator,
type ActivityIndicatorProps,
} from "react-native";

import {
useCssElement,
type StyledConfiguration,
type StyledProps,
} from "../runtime";

const mapping = {
className: {
target: "style",
nativeStyleMapping: {
color: "color",
},
},
} satisfies StyledConfiguration<typeof RNActivityIndicator>;

export function ActivityIndicator(
props: StyledProps<ActivityIndicatorProps, typeof mapping>,
) {
return useCssElement(RNActivityIndicator, props, mapping);
}

export default ActivityIndicator;
22 changes: 22 additions & 0 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Button as RNButton, type ButtonProps } from "react-native";

import {
useCssElement,
type StyledConfiguration,
type StyledProps,
} from "../runtime";

const mapping = {
className: {
target: false,
nativeStyleMapping: {
color: "color",
},
},
} satisfies StyledConfiguration<typeof RNButton>;

export function Button(props: StyledProps<ButtonProps, typeof mapping>) {
return useCssElement(RNButton, props, mapping);
}

export default Button;
21 changes: 21 additions & 0 deletions src/components/FlatList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { FlatList as RNFlatList, type FlatListProps } from "react-native";

import {
useCssElement,
type StyledConfiguration,
type StyledProps,
} from "../runtime";

const mapping = {
columnWrapperStyle: "columnWrapperStyle",
listFooterComponentClassName: "ListFooterComponentStyle",
listHeaderComponentClassName: "ListHeaderComponentStyle",
} satisfies StyledConfiguration<typeof RNFlatList>;

export function FlatList<ItemT>(
props: StyledProps<FlatListProps<ItemT>, typeof mapping>,
) {
return useCssElement(RNFlatList, props, mapping);
}

export default FlatList;
17 changes: 17 additions & 0 deletions src/components/Image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Image as RNImage, type ImageProps } from "react-native";

import {
useCssElement,
type StyledConfiguration,
type StyledProps,
} from "../runtime";

const mapping = {
className: "style",
} satisfies StyledConfiguration<typeof RNImage>;

export function Image(props: StyledProps<ImageProps, typeof mapping>) {
return useCssElement(RNImage, props, mapping);
}

export default Image;
17 changes: 17 additions & 0 deletions src/components/TextInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { TextInput as RNTextInput, type TextInputProps } from "react-native";

import {
useCssElement,
type StyledConfiguration,
type StyledProps,
} from "../runtime";

const mapping = {
className: "style",
} satisfies StyledConfiguration<typeof RNTextInput>;

export function TextInput(props: StyledProps<TextInputProps, typeof mapping>) {
return useCssElement(RNTextInput, props, mapping);
}

export default TextInput;
5 changes: 5 additions & 0 deletions src/components/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export * from "react-native";

export { ActivityIndicator } from "./ActivityIndicator";
export { Button } from "./Button";
export { FlatList } from "./FlatList";
export { Image } from "./Image";
export { Text } from "./Text";
export { TextInput } from "./TextInput";
export { View } from "./View";
Loading