skip to Main Content

I’m developing a Telegram Mini App using Vite+React, and users are reporting unexpected scrolling and collapses when interacting with the app on touchscreen devices. These issues often occur when users are trying to tap or swipe within the app, leading to a poor user experience.

I’ve tried various solutions to prevent unnecessary scrolling, but the problem persists. How can I effectively prevent these unwanted behaviors and ensure a stable, responsive UI for all users on touchscreen devices?

i have this in my index.html code

<script src="https://telegram.org/js/telegram-web-app.js">
      window.Telegram.WebApp.ready()
      window.Telegram.WebApp.expand()
      window.Telegram.WebApp.disableVerticalSwipes()
</script>

2

Answers


  1. I would also add this window.Telegram.WebApp.isVerticalSwipesEnabled = false; before the ready() function.

    Login or Signup to reply.
  2. You can use the disableVerticalSwipes method to prevent unwanted vertical swipes and the enableVerticalSwipes method to enable them. These methods control the state of the isVerticalSwipesEnabled property in Telegram Mini Apps.

    According to the Telegram Web App documentation:

    If isVerticalSwipesEnabled is set to true, vertical swipes by the user will minimize the mini app.
    If set to false, the mini app will only be minimized when the user swipes the header.

    enter link description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search