Questions and discussions about using the Shopify CLI and Shopify-built libraries.
Is this a known bug? It seems to last for 5 seconds regardless of what value you input. Thank you.
Solved! Go to the solution
This is an accepted solution.
I think I know why. Look like your app is a POS app. That means it is mainly used in Point of Sale app. Android, iOS, and Web treat duration differently. Web respects duration (which I told you in the thread). Android Toast message only has SHORT (roughly 2s) and LONG (roughly 4s). iOS hardcode 4s to match Android.
Henry | Social Care @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Hi @Filljoy
Can you share the code? The duration should work based on what the app sets. I just tested it again on prod.
Thanks,
Henry | Social Care @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Thanks @Henry_Tao. My code is just the standard app bridge toast code:
var Toast = actions.Toast;
var toastOptions = {
message: "Successfully added this item to the cart!"
duration: 10000
};
var toastSuccess = Toast.create(app, toastOptions);
toastSuccess.dispatch(Toast.Action.SHOW);
Here is the response from webview logging, it shows the duration being passed as a parameter but no matter what I change it to, it lasts 5 seconds. Thank you.
Optional Params: [{"group":"Toast","payload":{"id":"b0119af3-4cbf-40ec-2697-2ff2e7400a64","duration":10000,"message":"Successfully added this item to the cart!"},"type":"APP::TOAST::SHOW","version":"1.26.2","clientInterface":{"name":"@shopify/app-bridge","version":"1.26.2"},"source":{"apiKey":"{my api key}","shopOrigin":"{my dev store"}}]
I tested similar code. The toast keeps showing according to duration that I set. What's your appId? Is there anyway that I can test it on my store?
Henry | Social Care @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
This is an accepted solution.
I think I know why. Look like your app is a POS app. That means it is mainly used in Point of Sale app. Android, iOS, and Web treat duration differently. Web respects duration (which I told you in the thread). Android Toast message only has SHORT (roughly 2s) and LONG (roughly 4s). iOS hardcode 4s to match Android.
Henry | Social Care @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Thanks @Henry_Tao for the quick response. It would be great if they updated the documentation to mention that: https://shopify.dev/tools/app-bridge/actions/toast
I will create a ticket and forward to the team. Thanks for the feedback.
Henry | Social Care @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog