magicismight / react-native-root-toast

react native toast like component, pure javascript solution
MIT License
2.08k stars 403 forks source link

List Multiple Toast Messages #180

Open RonanMaguire opened 3 months ago

RonanMaguire commented 3 months ago

Is it possible to have multiple stack messages appear in a list?

i.e. The use case would be to connect and then log an api request so it would be good if there was an ability to do this. At the moment the toast messages just appear over each other. Is there a way to show something like:

[Request Sent] [Successfully connected]

at the top of the screen e.g the success message appears then the request sent message comes after and shuffles the former message down the screen?

sunnylqm commented 3 months ago

you can make a simple taskQueue like this

let taskQueue = Promise.resolve();

export function addToMsgQueue(newMsg) {
  taskQueue = taskQueue.then(async () => {
      await someAnimationIn();
      showToast(newMsg);
      await someAnimationOut();
  });
}