Skip to content

Commit d6c7da5

Browse files
committed
chore(example-app): ✨ add customise suffix slot option in example app
1 parent 7fc2400 commit d6c7da5

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

example/src/modules/forms/SelectScreen.tsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState } from "react";
22
import {
33
Box,
4+
CaretDown,
45
Icon,
56
ItemData,
67
Radio,
@@ -10,6 +11,7 @@ import {
1011
SelectVariants,
1112
Slot,
1213
Switch,
14+
UpDownArrow,
1315
useTheme,
1416
} from "@adaptui/react-native-tailwind";
1517
import { BottomSheetModalProvider } from "@gorhom/bottom-sheet";
@@ -83,6 +85,8 @@ export const SelectScreen = () => {
8385
const [isSelectDisabled, setIsSelectDisabled] = useState<boolean>(false);
8486
const [hasPrefix, setHasPrefix] = useState<boolean>(false);
8587

88+
const [changeSuffix, setChangeSuffix] = useState(false);
89+
8690
return (
8791
<Box style={tailwind.style("flex-1 justify-center bg-white-900")}>
8892
<BottomSheetModalProvider>
@@ -95,6 +99,9 @@ export const SelectScreen = () => {
9599
options={options}
96100
placeholder="Select fruit"
97101
prefix={hasPrefix ? <Icon icon={<Slot />} /> : null}
102+
suffix={
103+
<Icon icon={changeSuffix ? <CaretDown /> : <UpDownArrow />} />
104+
}
98105
/>
99106
</Box>
100107
<Box
@@ -122,27 +129,39 @@ export const SelectScreen = () => {
122129
<Radio value="underline" label="underline" />
123130
<Radio value="ghost" label="ghost" />
124131
</RadioGroup>
125-
<Box style={tailwind.style("flex flex-row justify-center w-full")}>
132+
<Box
133+
style={tailwind.style(
134+
"flex flex-row justify-center flex-wrap w-full",
135+
)}
136+
>
126137
<Switch
127138
state={isSelectInvalid}
128139
onStateChange={value => setIsSelectInvalid(value)}
129140
size="md"
130141
label="Invalid"
142+
style={tailwind.style("mt-1")}
131143
/>
132144
<Switch
133145
state={isSelectDisabled}
134146
onStateChange={value => setIsSelectDisabled(value)}
135147
size="md"
136-
style={tailwind.style("ml-1")}
148+
style={tailwind.style("ml-1 mt-1")}
137149
label="Disabled"
138150
/>
139151
<Switch
140152
state={hasPrefix}
141153
onStateChange={value => setHasPrefix(value)}
142154
size="md"
143-
style={tailwind.style("ml-1")}
155+
style={tailwind.style("ml-1 mt-1")}
144156
label="Prefix"
145157
/>
158+
<Switch
159+
state={changeSuffix}
160+
onStateChange={value => setChangeSuffix(value)}
161+
size="md"
162+
style={tailwind.style("ml-1 mt-1")}
163+
label="Change suffix"
164+
/>
146165
</Box>
147166
</Box>
148167
</BottomSheetModalProvider>

0 commit comments

Comments
 (0)