react-native-easy-toast icon indicating copy to clipboard operation
react-native-easy-toast copied to clipboard

Different toast position in a single component

Open vishgoel007 opened this issue 6 years ago • 1 comments

Currently in a component we can show toast only at a single position. What i wanted to do is show some toast at top and some at centre. Similarly for background color, we can't set different background colors for different toasts in a component.

vishgoel007 avatar Sep 23 '19 20:09 vishgoel007

You can create multiple Toasts in a component with different refs. So something like this.

<Toast ref={this.successToast} position="top" style={{ backgroundColor: 'green' }} />
<Toast ref={this.errorToast} position="center" style={{ backgroundColor: 'red' }} />

In the constructor you create refs (this.successToast = React.createRef()) for both of them and then call the ref that you want to show.

RogerKikkas avatar Oct 03 '19 07:10 RogerKikkas