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

Function BannerExample

docs/src/components/BannerExample.tsx:56–142  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54};
55
56const BannerExample = () => {
57 const theme = useTheme();
58
59 const [isSwitchOn, setIsSwitchOn] = React.useState(false);
60 const [text, setText] = React.useState('');
61 const [checked, setChecked] = React.useState('first');
62
63 const onToggleSwitch = () => setIsSwitchOn(!isSwitchOn);
64
65 return (
66 <View
67 style={[
68 styles.container,
69 {
70 backgroundColor: theme.colors.surface,
71 borderColor: theme.colors.surfaceVariant,
72 },
73 ]}
74 >
75 <Stack spacing={16}>
76 <Stack direction="row" spacing={8} style={styles.row}>
77 <Button loading onPress={() => {}}>
78 Loading
79 </Button>
80 <Button mode="contained-tonal" icon="camera" onPress={() => {}}>
81 Icon
82 </Button>
83 <Button icon="camera" mode="contained" onPress={() => {}}>
84 Press me
85 </Button>
86 <FAB icon="plus" size="small" onPress={() => {}} />
87 <FAB icon="plus" size="medium" onPress={() => {}} />
88 <FAB icon="plus" size="large" onPress={() => {}} />
89 <Avatar.Text label="MD" />
90 <Avatar.Icon icon="folder" />
91 </Stack>
92 <ProgressBar indeterminate />
93 <Stack spacing={8}>
94 <Text variant="displayLarge">Display Large</Text>
95 <Text variant="displayMedium">Display Medium</Text>
96 <Text>
97 Lorem ipsum dolor, sit amet consectetur adipisicing elit. Est
98 tenetur neque laudantium, repellendus at excepturi quasi qui culpa.
99 Incidunt nesciunt unde perspiciatis atque rerum blanditiis sint
100 ratione, sequi totam temporibus.
101 </Text>
102 </Stack>
103 <Stack direction="row" spacing={8}>
104 <Switch value={!isSwitchOn} onValueChange={onToggleSwitch} />
105 <Switch value={isSwitchOn} onValueChange={onToggleSwitch} />
106 </Stack>
107
108 <Stack direction="row" spacing={8} style={styles.row}>
109 <TextInput
110 label="Email"
111 value={text}
112 onChangeText={(text) => setText(text)}
113 />

Callers

nothing calls this directly

Calls 1

useThemeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…