Skip to content

Commit da690c8

Browse files
author
Artur Bien
committed
feat(snackbar): reimplement snackbar component
1 parent 8e66817 commit da690c8

File tree

3 files changed

+252
-120
lines changed

3 files changed

+252
-120
lines changed
Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
11
import React from 'react';
2-
import { Snackbar, Text, useTheme } from 'react95-native';
3-
4-
import Container from '../util/Container';
2+
import { StyleSheet, View } from 'react-native';
3+
import { Snackbar, Button, useTheme } from 'react95-native';
54

65
const SnackbarExample = () => {
6+
const [visible, setVisible] = React.useState<boolean>(true);
7+
78
const theme = useTheme();
89
return (
9-
<Container style={[{ backgroundColor: theme.materialDark }]}>
10-
<Container.Section title='Default:'>
11-
<Snackbar style={[{ height: 80 }]}>
12-
<Snackbar.Content>
13-
<Text>Display some information here.</Text>
14-
</Snackbar.Content>
15-
</Snackbar>
16-
</Container.Section>
17-
</Container>
10+
<View style={[styles.container, { backgroundColor: theme.materialDark }]}>
11+
<Button size='lg' onPress={() => setVisible(!visible)}>
12+
{visible ? 'Hide' : 'Show'}
13+
</Button>
14+
<Snackbar
15+
visible={visible}
16+
onDismiss={() => setVisible(false)}
17+
action={{
18+
label: 'Undo',
19+
onPress: () => {
20+
// Do something
21+
},
22+
}}
23+
duration={Snackbar.DURATION_MEDIUM}
24+
>
25+
Hi! I am Clippy, your office assistant.
26+
</Snackbar>
27+
</View>
1828
);
1929
};
2030

31+
const styles = StyleSheet.create({
32+
container: {
33+
flex: 1,
34+
alignItems: 'center',
35+
justifyContent: 'center',
36+
},
37+
});
38+
2139
export default SnackbarExample;

src/components/Snackbar/Snackbar.spec.tsx

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)