Toast not displayed correclty on mobile
Hello,
The toast component is not displayed correctly on my project when on mobile.
When using the browser, it works fine:
Nevertheless, as soon as I switch to mobile navigation, the toast is displayed just outside of frame:
Am I doing something wrong?
PS: Also, I'm using the Toaster component in my response, otherwise the toast never shows up. The documentation doesn't say this step is necessary, so maybe it's not up to date?
Thanks!
Have you tried using another browser? Sometimes old mobile browsers just sucks, also Safari does not support anything... i faced the same probleme with the handmade pop-over component on iphone for some reason it just dont work
@sebiwi I had the same issue. I moved the <Toaster /> component outside of my <main /> in the layout file and now it's working correctly.
Thanks! That worked like a charm!
Does anyone knows what the root cause of this issue is? Should it be documented?
这个问题我也发现了,浏览器在不同的宽度下效果有所区别。
大屏xl以上是没有问题的,md左右的情况是显示了一个边缘。小屏尤其是手机就看不到了,也看不到错误输出。
我们可以找一下引入的组件,尽可能的去找样式控制的部分。
可以看到ToastViewport部分,
这里有控制样式的内容,我们尝试修改可以看到在小屏下有作用。
"fixed bottom-0 z-[100] flex max-h-screen w-4/5 md:w-1/2 xl:w-1/4 flex-col-reverse p-4 right-0",
感觉是对sm的支持有问题,小屏情况并没有按sm:的有效执行。
我们尝试改一下这块的处理,如我提供的代码,效果如下:
小屏:
中屏:
大屏:
我目前只能在这里解决,具体为何原来的有问题需要深入组件实现的部分才清楚。目前按这种方式可以展示出来。如果那位大神发现更好的方式处理,可以告诉我。
Moving the Toaster above the sidebar and main did the magic.