Skip to content

Commit

Permalink
feat(snackbar): reimplement snackbar component
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Bien committed Jan 17, 2021
1 parent 8e66817 commit da690c8
Show file tree
Hide file tree
Showing 3 changed files with 252 additions and 120 deletions.
42 changes: 30 additions & 12 deletions example/src/examples/SnackbarExample.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
import React from 'react';
import { Snackbar, Text, useTheme } from 'react95-native';

import Container from '../util/Container';
import { StyleSheet, View } from 'react-native';
import { Snackbar, Button, useTheme } from 'react95-native';

const SnackbarExample = () => {
const [visible, setVisible] = React.useState<boolean>(true);

const theme = useTheme();
return (
<Container style={[{ backgroundColor: theme.materialDark }]}>
<Container.Section title='Default:'>
<Snackbar style={[{ height: 80 }]}>
<Snackbar.Content>
<Text>Display some information here.</Text>
</Snackbar.Content>
</Snackbar>
</Container.Section>
</Container>
<View style={[styles.container, { backgroundColor: theme.materialDark }]}>
<Button size='lg' onPress={() => setVisible(!visible)}>
{visible ? 'Hide' : 'Show'}
</Button>
<Snackbar
visible={visible}
onDismiss={() => setVisible(false)}
action={{
label: 'Undo',
onPress: () => {
// Do something
},
}}
duration={Snackbar.DURATION_MEDIUM}
>
Hi! I am Clippy, your office assistant.
</Snackbar>
</View>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
});

export default SnackbarExample;
54 changes: 0 additions & 54 deletions src/components/Snackbar/Snackbar.spec.tsx

This file was deleted.

Loading

0 comments on commit da690c8

Please sign in to comment.