MCPcopy Create free account
hub / github.com/callstack/react-native-paper / ChipExample

Function ChipExample

example/src/Examples/ChipExample.tsx:17–397  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15import ScreenWrapper from '../ScreenWrapper';
16
17const ChipExample = () => {
18 const [snackbarProperties, setSnackbarProperties] = React.useState({
19 visible: false,
20 text: '',
21 });
22 const { isV3 } = useExampleTheme();
23 const customColor = isV3 ? MD3Colors.error50 : MD2Colors.purple900;
24
25 return (
26 <>
27 <ScreenWrapper>
28 <List.Section title="Flat chip">
29 <View style={styles.row}>
30 <Chip selected onPress={() => {}} style={styles.chip}>
31 Simple
32 </Chip>
33 {isV3 && (
34 <>
35 <Chip
36 selected
37 showSelectedOverlay
38 onPress={() => {}}
39 style={styles.chip}
40 >
41 With selected overlay
42 </Chip>
43 <Chip elevated onPress={() => {}} style={styles.chip}>
44 Elevated
45 </Chip>
46 <Chip compact style={styles.chip} onPress={() => {}}>
47 Compact chip
48 </Chip>
49 </>
50 )}
51 <Chip
52 onPress={() => {}}
53 onClose={() =>
54 setSnackbarProperties({
55 visible: true,
56 text: 'Close button pressed',
57 })
58 }
59 style={styles.chip}
60 closeIconAccessibilityLabel="Close icon accessibility label"
61 >
62 Close button
63 </Chip>
64 <Chip
65 icon="heart"
66 onPress={() => {}}
67 onClose={() =>
68 setSnackbarProperties({
69 visible: true,
70 text: 'Heart icon close button pressed',
71 })
72 }
73 style={styles.chip}
74 >

Callers

nothing calls this directly

Calls 1

useExampleThemeFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…