Reputation: 645
I'm using a SnackBar from React Native Paper that is displayed at the bottom of my app:
But I want to display this snackbar at the top of the screen. I tried to do it using styled components:
export const ConfirmSnack = styled(Snackbar)`
top: 0;
`;
But that does not do the trick, even when adding position: absolute;
I've read the docs but can't find anything on positioning the snackbar. How can I show this snackbar at the top of the screen?
Upvotes: 5
Views: 7480
Reputation: 151
Here's what worked for me.
<Snackbar wrapperStyle={{ top: 0 }} visible={true}>Casis added to basket</Snackbar>
wrapperStyle
Style for the wrapper of the snackbar
Here's expo link which would toggle the vertical alignment
Link to [documentation] of React Native Paper Snackbar (https://callstack.github.io/react-native-paper/snackbar.html#wrapperStyle)
Upvotes: 15