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
400 stars 79 forks source link

[Bug]: Cannot resolve symbol 'init' #295

Closed longqingzhao closed 2 months ago

longqingzhao commented 2 months ago

Telegram Application

Other

Describe the Bug

when I use init,it report Cannot resolve symbol 'init'

To Reproduce

import: import { init } from '@tma.js/sdk'; error: Cannot resolve symbol 'init'

Expected Behavior

can use init

heyqbnk commented 2 months ago

Hey! I have released a new major version of the package which now doesn't have this function.

I will add a related patch note in the next few days. Until then, take a look at the templates, which were updated according to the changes done in the new major version:

https://github.com/orgs/Telegram-Mini-Apps/repositories

longqingzhao commented 2 months ago

ok thank you

longqingzhao commented 2 months ago

I have saw some templates, But I want to expand sreen, I cannot find how to expand.

Amurmurmur commented 2 months ago

@longqingzhao use this:

import { postEvent } from '@tma.js/sdk';
postEvent('web_app_expand');
heyqbnk commented 2 months ago

In case, you would like to do it with components, use this code:

import { initViewport } from '@tma.js/sdk';

const viewport = await initViewport();
viewport.expand();
longqingzhao commented 2 months ago

ok thanks!

heyqbnk commented 1 month ago

Documentation related to this topic has just released. Check this out! https://docs.telegram-mini-apps.com/packages/tma-js-sdk-react