-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added docs and demo, describes work useScanQrPopup hook
- Loading branch information
Valentin Kruglikov
committed
Jan 24, 2023
1 parent
ad60ad8
commit cb6f944
Showing
8 changed files
with
166 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Button, Form, Typography } from 'antd'; | ||
import { | ||
useScanQrPopup, | ||
useShowPopup, | ||
} from '@vkruglikov/react-telegram-web-app'; | ||
|
||
const ScanQrPopupDemo = () => { | ||
const [showQrPopup, closeQrPopup] = useScanQrPopup(); | ||
const showPopup = useShowPopup(); | ||
|
||
return ( | ||
<> | ||
<Typography.Title level={3}>useScanQrPopup</Typography.Title> | ||
<Form | ||
labelCol={{ span: 6 }} | ||
name="basic" | ||
layout="horizontal" | ||
autoComplete="off" | ||
> | ||
<Form.Item> | ||
<Button | ||
block | ||
type="primary" | ||
htmlType="button" | ||
onClick={() => | ||
showQrPopup( | ||
{ | ||
text: 'Привет друг', | ||
}, | ||
text => { | ||
closeQrPopup(); | ||
showPopup({ | ||
message: text, | ||
}); | ||
}, | ||
) | ||
} | ||
> | ||
showScanQrPopup | ||
</Button> | ||
</Form.Item> | ||
</Form> | ||
</> | ||
); | ||
}; | ||
|
||
export default ScanQrPopupDemo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[@vkruglikov/react-telegram-web-app](../README.md) / ScanQrPopupParams | ||
|
||
# Interface: ScanQrPopupParams | ||
|
||
This object describes the native popup for scanning QR codes. | ||
You have to see original interface [telegram!ScanQrPopupParams](https://core.telegram.org/bots/webapps#scanqrpopupparams). | ||
|
||
## Table of contents | ||
|
||
### Properties | ||
|
||
- [text](ScanQrPopupParams.md#text) | ||
|
||
## Properties | ||
|
||
### text | ||
|
||
• **text**: `string` | ||
|
||
The text to be displayed under the 'Scan QR' heading, 0-64 characters. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters