GithubHelp home page GithubHelp logo

前端页面通过JS滚动web的话,然后再次手势滑动,会有闪一下的效果,这个没考虑到 about hybridpagekit HOT 1 CLOSED

niuxianbin avatar niuxianbin commented on August 15, 2024
前端页面通过JS滚动web的话,然后再次手势滑动,会有闪一下的效果,这个没考虑到

from hybridpagekit.

Comments (1)

dequan1331 avatar dequan1331 commented on August 15, 2024

是的,这种场景暂时没有实现,因为从设计的出发点来说,作为混合的页面(WebView + 多种Native组件)是更偏向于Native的展示和交互,使用WebView除了基本的展示之外应该有较少的内部逻辑,即使有,也应该通过JS API的方式传递给Native来进行统一的处理,以满足Native测的协同交互。

具体的原因:整个的页面包括WebView和其他的component是联动的,所以当WebView内部滚动时,没有触发联动的逻辑,contentOffset没有更新,所以会闪动到之前的位置。

对于这个场景,业务测可以处理规避下:

  1. 如果是自己的页面,建议使用JSApi的方式回调到Native来处理,这样也能支持更复杂的交互逻辑。
  2. 如果不是自己的页面,可以监听webview的contentOffset,当JS执行滚动时,调用HybridPageKit中的函数使整个页面联动滚动,当然这种方式要区分下是JS触发的offset变化还是用户滑动页面触发。

也十分欢迎pull request完善相应的逻辑。

from hybridpagekit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.