在我的 iPhone 中的 telegram React/Next JS 应用程序中,长列表的元素在滚动时被意外剪切。
有时列表元素会被切割一半或从任何地方切割,在我看来这似乎是渲染问题,因为如果它从 CSS/JS 中隐藏,则完整元素将显示或隐藏。
有时会发生这种情况,有时又工作正常。我尝试了很多解决方法但无法正确修复。
下面的代码我用来防止应用程序在向下滚动时在电报中关闭。
html.iphone-device{
overflow: hidden ;
overscroll-behavior: none;
body{
height: 100dvh !important;
overscroll-behavior: none;
overflow: auto;
touch-action: initial !important;
position: relative;
scroll-behavior: unset;
}
}
如果它发生在所有界面,如网络、Android 和 iPhone,可能是由于
height: 100dvh
属性,因为你的列表似乎是从底部开始减少的。既然你说它偶尔会发生,你尝试将 padding-bottom
添加到列表中或检查 iphone 是否报告了类似的问题。