-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(snackbar): reimplement snackbar component
- Loading branch information
Artur Bien
committed
Jan 17, 2021
1 parent
8e66817
commit da690c8
Showing
3 changed files
with
252 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.