vkruglikov / react-telegram-web-app Goto Github PK
View Code? Open in Web Editor NEWReact components for Telegram Mini Apps
Home Page: https://www.npmjs.com/package/@vkruglikov/react-telegram-web-app
License: MIT License
React components for Telegram Mini Apps
Home Page: https://www.npmjs.com/package/@vkruglikov/react-telegram-web-app
License: MIT License
Hello, thank you for the greats work.
May I know are you planning to add SettingsButton which introduced by Bot Api 7.0 (https://core.telegram.org/bots/webapps#december-29-2023)
Package version: 2.1.4
React version: "^18.2.0"
<MainButton disabled text='Update' onClick={()=> update()} />
Button still looks like active, but doesn't accept clicks.
Button expected to look "disabled" (somehow grayed out, etc).
Hello
I have problem with useShowPopup() in a class
WARNING in [eslint]
src\components\Form.tsx
Line 61:26: React Hook "useShowPopup" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function react-hooks/rules-of-hooks
Hi, vkruglikov:)
I want to share a specific page inner my miniapp with friends. Could you tell me how to do it?
I would like to know if it's possible to access window.navigator in a telegram mini web app (twa)?
If not, what it the reason? Is there a chance to extend it? Will there be more web APIs in the twa? If I would want to make pull requests to extend that for telegram, where is the repo for that?
can you add a general hook (useWebApp for example) to get properties from window.Telegram.WebApp?
e.g platform, enableClosingConfirmation(), disableClosingConfirmation() etc...
Package version: 2.1.4
React version: 18.2.0
Telegram.WebApp version:
"use client"
import {
BackButton,
MainButton,
WebAppProvider,
} from "@vkruglikov/react-telegram-web-app";
export default function Page() {
return (
<WebAppProvider
options={{
smoothButtonsTransition: true,
}}
>
<h1>Hello, Quest Page!</h1>
<MainButton text="Continue with task" progress={true} />
<BackButton onClick={() => console.log("back")} />
</WebAppProvider>
);
}
pnpm dev && ngrok 3000
Link to code example:
Addition of expand() which is a method that expands the Web App to the maximum available height.
Do you plan to work on this?
So that this could be plugged in as the default behaviour for the user when the interact with the TWA
Exceptions throws when nextjs renders components on server and window.Telegram.WebApp is unavailable.
Code does not handle this situation:
react-telegram-web-app/src/useInitData.ts
Lines 60 to 64 in 7065c15
For example, this code (useShowPopup) works fine, because handles situation with temporarily unavailable window:
react-telegram-web-app/src/useShowPopup.ts
Lines 66 to 82 in 7065c15
I think we need do the same with useInitData. Or, simply, need to set undefined to initData and initDataUnsafe when window is unavailablle.
I can make PR if you accept
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.