Skip to content

[webview_flutter] Support disabling overscroll #57090

Closed
flutter/packages
#8451

Description

@MagicalWater

Hi,
By default, WebView scrolling is enabled on iOS
But in some cases I want to disable it

like this

_webView.scrollView.alwaysBounceVertical = NO;
_webView.scrollView.bounces = NO;

can it add a paramter on WebView class to control?

Activity

  1. 0x1af2aec8f957 commented on May 13, 2020

    @0x1af2aec8f957
    ....
    onWebViewCreated: (WebViewController _controller){
                controller = _controller;
              },
    onPageFinished: (String url){
                  controller?.evaluateJavascript('document.body.style.overflow = \'hidden\';');
              },
    ....
  2. TahaTesser commented on May 13, 2020

    @TahaTesser
    Contributor

    Looks there is a PR for this #1977

    Trying above workaround freezed webview scrolling

  3. added
    P3Issues that are less important to the Flutter project
    on Jul 19, 2021
  4. Reprevise commented on Mar 13, 2023

    @Reprevise

    This would be good to add to android as well. Though I am looking to specifically disable overscrolling on both platforms, not disabling scroll altogether.

  5. changed the title [-]WebView disable bounce on iOS[/-] [+][webview_flutter] Support disabling overscroll[/+] on Mar 13, 2023
  6. stuartmorgan-g commented on Mar 13, 2023

    @stuartmorgan-g
    Contributor

    Retitling to be platform-generic. (It looks like the Android version is setOverScrollMode.)

    not disabling scroll altogether

    This issue was about disabling overscroll, not scroll, given the code shown in the original post. It looks like that was a typo in the feature request.

  7. MatejKandrac commented on May 3, 2023

    @MatejKandrac
  8. 4 remaining items

  9. omi-jrparreno commented on Mar 12, 2024

    @omi-jrparreno
  10. bparrishMines commented on Nov 20, 2024

    @bparrishMines
    Contributor

    Looking into the feature a little more. It looks like Android supports 3 modes:

    Valid over-scroll modes are OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS (allow over-scrolling only if the view content is larger than the container), or OVER_SCROLL_NEVER.

    And iOS can create similar behavior as each mode by setting a specific combination of:

    var bounces: Bool
    A Boolean value that controls whether the scroll view bounces past the edge of content and back again.
    var bouncesHorizontally: Bool
    A Boolean value that determines whether the scroll view bounces when it reaches the ends of its horizontal axis.
    var bouncesVertically: Bool
    A Boolean value that determines whether the scroll view bounces when it reaches the ends of its vertical axis.
    var alwaysBounceVertical: Bool
    A Boolean value that determines whether bouncing always occurs when vertical scrolling reaches the end of the content.
    var alwaysBounceHorizontal: Bool
    A Boolean value that determines whether bouncing always occurs when horizontal scrolling reaches the end of the content view.

    My idea would be to add a setOverScrollMode as the platform agnostic feature and if people want more specific axis control on iOS, it can be added as part of the iOS implementaiton.

  11. self-assigned this
    on Jan 9, 2025
  12. github-actions commented on May 2, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  13. locked as resolved and limited conversation to collaborators on May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityp: webviewThe WebView pluginpackageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions