-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathShowMainButton.jsx
33 lines (29 loc) · 1.07 KB
/
ShowMainButton.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import React from 'react';
import TelegramDetailedButton from "../../kit/DetailedButton/TelegramDetailedButton";
import {useTelegram} from "../../../hooks/useTelegram";
/**
* MainButton.show() is a method to make the button visible.
*
* Note that opening the Mini App from the attachment menu hides the main button until the user interacts with the
* Mini App interface.
*
* @see https://core.telegram.org/bots/webapps#mainbutton
*/
const ShowMainButton = () => {
const {webApp, executeMethod} = useTelegram()
const onShow = () => {
executeMethod('MainButton.show', webApp.MainButton.show, true)
}
return (
<TelegramDetailedButton
buttontitle={'MainButton.show()'}
buttondescription={
'A method to make the button visible.' +
'Note that opening the Mini App from the attachment menu hides the main button until the user interacts with the Mini App interface.'
}
buttonlabel={'Execute'}
onButtomClick={onShow}
/>
);
};
export default ShowMainButton;