How do I make this snackbar take up all the width it needs to while staying absolute at…
- User
How do I make this snackbar take up all the width it needs to while staying absolute at the bottom <Snackbar duration={1000} onIconPress={() => { addMessage('') }} icon='close' style={{ position: 'absolute', bottom: 0, flex: 1 }} visible={element.length > 0} onDismiss={() => addMessage('')}>. Giving it width: 100% just makes it take up 100% of the screen's total width
- Assistant
To make the Snackbar take up all the width it needs while remaining absolutely positioned at the bottom, you should avoid setting a fixed width, such as
width: 100%. Instead, you can usealignSelfandleft,right, ormarginHorizontalproperties to ensure the Snackbar only takes up the necessary width. Below is an approach using inline styles with and horizontal margin to keep it centered: