繁体   English   中英

scrollTo() 在 react-native-webview 中不起作用

[英]scrollTo() not working in react-native-webview

我目前有一个 webview 像这样:

<WebView source={{ uri: 'http://localhost:3000/view' }} />

在我的 webview 中,我有以下 javascript:

chatLineTemplate = document.querySelector('#chatLine');
clonedTemplate = chatLineTemplate.content.cloneNode(true;

element.prepend(clonedTemplate);

element.scrollTop = element.scrollHeight;

我也试过:

element.scrollTo(0, element.scrollHeight);

  • “元素”是一个 position 绝对可滚动 div。
  • 在本机反应中,如果我在 scrollTo 调用期间不在底部,它会起作用,但如果我在底部,它不会
  • 以下代码适用于我电脑上的常规 Web 浏览器

视频示例:

https://www.loom.com/share/54f6539761a84080adcc9607af7f46b0

有谁知道为什么这不起作用?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM