UNPKG

next-twa

Version:
25 lines (24 loc) 837 B
import React, { PropsWithChildren } from 'react'; import { WebApp } from '../twa-types'; export type OnStartAppHandler = (startParams?: string) => ReturnType<any>; export type NextTWAProviderProps = PropsWithChildren & { onStartApp?: OnStartAppHandler; useBackButton?: boolean; }; export type UseNextTWAReturn = { /** * Telegram Web App */ app?: WebApp; /** * value returned onStartApp */ startAppValue?: any; /** * True when app is initialized and startAppValue is ready (If onStartApp is passed to NextTWAProviderProvider) */ isReady: boolean; }; export declare const webAppContext: React.Context<UseNextTWAReturn>; export declare const NextTWAProvider: ({ children, onStartApp, useBackButton, }: NextTWAProviderProps) => React.JSX.Element; export default NextTWAProvider;