Telegram-Mini-Apps / telegram-apps

Made from scratch TypeScript packages, examples and documentation you will surely need to start developing on Telegram Mini Apps.
https://docs.telegram-mini-apps.com/
MIT License
720 stars 201 forks source link

[Bug]: backButton doesn't call callback on clicking #567

Closed wufd closed 1 day ago

wufd commented 2 days ago

Telegram Application

Telegram for iOS, Telegram for macOS

Describe the Bug

I'm only using @telegram-apps/sdk-react 2.0.9 <or 2.0.13> for developing mini app with Nextjs 15.0.2. no telegram-web-app.js

After mounting backButton and set callback for onClick event, tapping on the button does trigger the event but the callback isn't called

Devices tested: Iphone 14 plus & Telegram 11.4 - BUG Macbook m1max & Telegram 11.4.269392 AppStore- BUG

To Reproduce

Steps to reproduce the behavior:

  1. simple code:
    
    ...
    init()
    backButton.mount()

...

useEffect(() => { backButton.show.ifAvailable(); backButton.onClick.ifAvailable(()=>{ console.log("------ onPopRouter "); }); }, []);



3. Click back button on mini app
2. back_button_pressed event is triggered: [Telegram.WebView] < receiveEvent back_button_pressed null without clicked text

### Expected Behavior

callback should be called and log clicked once the back button is clicked
heyqbnk commented 1 day ago

back_button_pressed event is triggered: [Telegram.WebView] < receiveEvent back_button_pressed null without clicked text

You are using telegram-web-app.js. Don't do it along with the @telegram-apps/sdk-react