Skip to content

Commit 2176116

Browse files
committed
feat: add missing RN components
1 parent 03a4e35 commit 2176116

14 files changed

+207
-14
lines changed

src/components/ActivityIndicator.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import {
99
type StyledProps,
1010
} from "../runtime";
1111

12-
const mapping = {
12+
const mapping: StyledConfiguration<typeof RNActivityIndicator> = {
1313
className: {
1414
target: "style",
1515
nativeStyleMapping: {
1616
color: "color",
1717
},
1818
},
19-
} satisfies StyledConfiguration<typeof RNActivityIndicator>;
19+
};
2020

2121
export function ActivityIndicator(
2222
props: StyledProps<ActivityIndicatorProps, typeof mapping>,

src/components/Button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import {
66
type StyledProps,
77
} from "../runtime";
88

9-
const mapping = {
9+
const mapping: StyledConfiguration<typeof RNButton> = {
1010
className: {
1111
target: false,
1212
nativeStyleMapping: {
1313
color: "color",
1414
},
1515
},
16-
} satisfies StyledConfiguration<typeof RNButton>;
16+
};
1717

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

src/components/FlatList.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import {
66
type StyledProps,
77
} from "../runtime";
88

9-
const mapping = {
10-
columnWrapperStyle: "columnWrapperStyle",
11-
listFooterComponentClassName: "ListFooterComponentStyle",
12-
listHeaderComponentClassName: "ListHeaderComponentStyle",
13-
} satisfies StyledConfiguration<typeof RNFlatList>;
9+
const mapping: StyledConfiguration<typeof RNFlatList> = {
10+
ListFooterComponentClassName: "ListFooterComponentStyle",
11+
ListHeaderComponentClassName: "ListHeaderComponentStyle",
12+
columnWrapperClassName: "columnWrapperStyle",
13+
contentContainerClassName: "contentContainerStyle",
14+
};
1415

1516
export function FlatList<ItemT>(
1617
props: StyledProps<FlatListProps<ItemT>, typeof mapping>,

src/components/Image.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import {
66
type StyledProps,
77
} from "../runtime";
88

9-
const mapping = {
9+
const mapping: StyledConfiguration<typeof RNImage> = {
1010
className: "style",
11-
} satisfies StyledConfiguration<typeof RNImage>;
11+
};
1212

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

src/components/ImageBackground.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import {
2+
ImageBackground as RNImageBackground,
3+
type ImageBackgroundProps,
4+
} from "react-native";
5+
6+
import {
7+
useCssElement,
8+
type StyledConfiguration,
9+
type StyledProps,
10+
} from "../runtime";
11+
12+
const mapping: StyledConfiguration<typeof RNImageBackground> = {
13+
className: {
14+
target: "style",
15+
nativeStyleMapping: {
16+
backgroundColor: true,
17+
},
18+
},
19+
};
20+
21+
export function ImageBackground(
22+
props: StyledProps<ImageBackgroundProps, typeof mapping>,
23+
) {
24+
return useCssElement(RNImageBackground, props, mapping);
25+
}
26+
27+
export default ImageBackground;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {
2+
KeyboardAvoidingView as RNKeyboardAvoidingView,
3+
type KeyboardAvoidingViewProps,
4+
} from "react-native";
5+
6+
import {
7+
useCssElement,
8+
type StyledConfiguration,
9+
type StyledProps,
10+
} from "../runtime";
11+
12+
const mapping: StyledConfiguration<typeof RNKeyboardAvoidingView> = {
13+
className: {
14+
target: "style",
15+
},
16+
};
17+
18+
export function KeyboardAvoidingView(
19+
props: StyledProps<KeyboardAvoidingViewProps, typeof mapping>,
20+
) {
21+
return useCssElement(RNKeyboardAvoidingView, props, mapping);
22+
}
23+
24+
export default KeyboardAvoidingView;

src/components/Pressable.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Pressable as RNPressable, type PressableProps } from "react-native";
2+
3+
import {
4+
useCssElement,
5+
type StyledConfiguration,
6+
type StyledProps,
7+
} from "../runtime";
8+
9+
const mapping: StyledConfiguration<typeof RNPressable> = {
10+
className: "style",
11+
};
12+
13+
export function Pressable(props: StyledProps<PressableProps, typeof mapping>) {
14+
return useCssElement(RNPressable, props, mapping);
15+
}
16+
17+
export default Pressable;

src/components/ScrollView.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { ScrollView as RNScrollView, type ScrollViewProps } from "react-native";
2+
3+
import {
4+
useCssElement,
5+
type StyledConfiguration,
6+
type StyledProps,
7+
} from "../runtime";
8+
9+
const mapping: StyledConfiguration<typeof RNScrollView> = {
10+
className: "style",
11+
contentContainerClassName: "contentContainerStyle",
12+
};
13+
14+
export function ScrollView(
15+
props: StyledProps<ScrollViewProps, typeof mapping>,
16+
) {
17+
return useCssElement(RNScrollView, props, mapping);
18+
}
19+
20+
export default ScrollView;

src/components/TextInput.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ import {
66
type StyledProps,
77
} from "../runtime";
88

9-
const mapping = {
10-
className: "style",
11-
} satisfies StyledConfiguration<typeof RNTextInput>;
9+
const mapping: StyledConfiguration<typeof RNTextInput> = {
10+
className: {
11+
target: "style",
12+
nativeStyleMapping: {
13+
textAlign: true,
14+
},
15+
},
16+
};
1217

1318
export function TextInput(props: StyledProps<TextInputProps, typeof mapping>) {
1419
return useCssElement(RNTextInput, props, mapping);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import {
2+
TouchableHighlight as RNTouchableHighlight,
3+
type TouchableHighlightProps,
4+
} from "react-native";
5+
6+
import {
7+
useCssElement,
8+
type StyledConfiguration,
9+
type StyledProps,
10+
} from "../runtime";
11+
12+
const mapping: StyledConfiguration<typeof RNTouchableHighlight> = {
13+
className: "style",
14+
};
15+
16+
export function TouchableHighlight(
17+
props: StyledProps<TouchableHighlightProps, typeof mapping>,
18+
) {
19+
return useCssElement(RNTouchableHighlight, props, mapping);
20+
}
21+
22+
export default TouchableHighlight;

0 commit comments

Comments
 (0)