| 3 | import { useState } from "react"; |
| 4 | |
| 5 | export default function ChipsExample() { |
| 6 | const [filterChipSelected, setFilterChipSelected] = useState(false); |
| 7 | const [inputChipSelected, setInputChipSelected] = useState(false); |
| 8 | |
| 9 | return ( |
| 10 | <View style={styles.container}> |
| 11 | <Text style={styles.header}>Chip Example</Text> |
| 12 | <Chip |
| 13 | variant="assist" |
| 14 | labelText="Assist" |
| 15 | leadingIcon="person" |
| 16 | trailingIcon="close" |
| 17 | modifier={Modifier.border({ width: 1, color: "green" })} |
| 18 | /> |
| 19 | <Chip |
| 20 | variant="input" |
| 21 | modifier={Modifier.border({ width: 1, color: "green" })} |
| 22 | labelText="Input" |
| 23 | leadingIcon={inputChipSelected ? "check" : undefined} |
| 24 | selected={inputChipSelected} |
| 25 | onClick={() => { |
| 26 | setInputChipSelected(!inputChipSelected); |
| 27 | }} |
| 28 | /> |
| 29 | <Chip |
| 30 | variant="filter" |
| 31 | labelText="Filter" |
| 32 | trailingIcon="box" |
| 33 | selected={filterChipSelected} |
| 34 | onClick={() => { |
| 35 | setFilterChipSelected(!filterChipSelected); |
| 36 | }} |
| 37 | /> |
| 38 | <Chip variant="suggestion" labelText="Suggestion" /> |
| 39 | </View> |
| 40 | ); |
| 41 | } |
| 42 | |
| 43 | const styles = StyleSheet.create({ |
| 44 | container: { |