Skip to content

Commit 79dea75

Browse files
committed
chore(example-app): ⚡ add CheckboxGroup component screen with examples
1 parent 4379078 commit 79dea75

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

example/src/AppRoot.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
AvatarScreen,
77
BadgeScreen,
88
ButtonScreen,
9+
CheckboxGroupScreen,
910
CheckboxScreen,
1011
CircularProgressScreen,
1112
InputScreen,
@@ -23,7 +24,7 @@ const Drawer = createDrawerNavigator();
2324

2425
const AppRoot = () => {
2526
return (
26-
<Drawer.Navigator initialRouteName="InputScreen">
27+
<Drawer.Navigator initialRouteName="CheckboxGroupScreen">
2728
<Drawer.Screen
2829
options={{ title: "Avatar" }}
2930
name="AvatarScreen"
@@ -99,6 +100,11 @@ const AppRoot = () => {
99100
name="InputScreen"
100101
component={InputScreen}
101102
/>
103+
<Drawer.Screen
104+
options={{ title: "Checkbox Group" }}
105+
name="CheckboxGroupScreen"
106+
component={CheckboxGroupScreen}
107+
/>
102108
</Drawer.Navigator>
103109
);
104110
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from "react";
2+
import {
3+
Box,
4+
Checkbox,
5+
CheckboxGroup,
6+
Text,
7+
useTheme,
8+
} from "@adaptui/react-native-tailwind";
9+
10+
export const CheckboxGroupScreen = () => {
11+
const tailwind = useTheme();
12+
const [value, setValue] = React.useState<string[]>([]);
13+
return (
14+
<Box style={tailwind.style("flex-1 px-2 justify-center bg-white-900")}>
15+
<Text>Pick fruits to eat</Text>
16+
<CheckboxGroup value={value} onChange={setValue}>
17+
<Checkbox value="apple" label="Apple" />
18+
<Checkbox value="orange" label="Orange" />
19+
<Checkbox value="watermelon" label="Watermelon" />
20+
<Checkbox value="sapota" label="Sapota" />
21+
<Checkbox value="cherry" label="Cherry" />
22+
</CheckboxGroup>
23+
<Box style={tailwind.style("mt-2")}>
24+
<Text>Picked fruits</Text>
25+
{value.map((item, index) => {
26+
return (
27+
<Text style={tailwind.style("my-1")} key={index}>
28+
- {item}
29+
</Text>
30+
);
31+
})}
32+
</Box>
33+
</Box>
34+
);
35+
};

example/src/modules/forms/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from "./CheckboxGroupScreen";
12
export * from "./InputScreen";
23
export * from "./RadioScreen";
34
export * from "./SliderComponentScreen";

0 commit comments

Comments
 (0)