Open anilchrishan opened 2 years ago
I faced the same issue that toasts sometimes dont update. I think the problem is inside the show function. https://github.com/arnnis/react-native-toast-notifications/blob/e0ed48e1098359d933c84c9c6dbaafe13810ea68/src/toast-container.tsx#L43-L68 The new toast will be set in the state inside the requestAnimationFrame method. But it is not used in the update method. Since requestAnimationFrame will only be called before the next repaint, the new toast is probably not in the state yet and those cannot be found and updated. https://github.com/arnnis/react-native-toast-notifications/blob/e0ed48e1098359d933c84c9c6dbaafe13810ea68/src/toast-container.tsx#L73-L83 I fixed it by wrapping the toast.update() inside the requestAnimationFrame method. For your example it should be:
requestAnimationFrame(() => {
toast.update(id, "Loading completed", {type: "success"});
});
The toast is now updated about 20ms later than without the method, but this is not noticeable.
I fixed it by wrapping the toast.update() inside the requestAnimationFrame method.
This worked for me too. But what's the problem?
let id = toast.show("Loading..."); toast.update(id, "Loading completed", {type: "success"});
toast.update function is not working.