From 162764290db8908ac32d796ce0b90d99e61d741b Mon Sep 17 00:00:00 2001 From: Sibo Jia Date: Wed, 9 Oct 2024 18:09:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E7=A7=BBToast=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E9=81=AE=E6=8C=A1=E6=92=AD=E6=94=BE=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=9B=BE=E6=A0=87=20(#603)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 上移Toast位置避免遮挡播放模式图标 * Update tools.ts * 添加更新日志 --------- Co-authored-by: momenta\sibo.jia Co-authored-by: lyswhut --- publish/changeLog.md | 2 +- src/utils/tools.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/publish/changeLog.md b/publish/changeLog.md index ad9a391..f506cdb 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -1,4 +1,4 @@ ### 优化 - 首次使用的提示窗口可以点击背景或者返回键关闭(#577) - +- 上移 Toast 位置避免遮挡播放模式图标(#603 @sibojia) diff --git a/src/utils/tools.ts b/src/utils/tools.ts index 964f4ca..4d90d8e 100644 --- a/src/utils/tools.ts +++ b/src/utils/tools.ts @@ -116,19 +116,23 @@ export const toast = (message: string, duration: 'long' | 'short' = 'short', pos break } let _position + let offset: number switch (position) { case 'top': _position = ToastAndroid.TOP + offset = 80 break case 'center': _position = ToastAndroid.CENTER + offset = 0 break case 'bottom': default: _position = ToastAndroid.BOTTOM + offset = 80 break } - ToastAndroid.showWithGravity(message, _duration, _position) + ToastAndroid.showWithGravityAndOffset(message, _duration, _position, 0, offset) } export const openUrl = async(url: string): Promise => Linking.canOpenURL(url).then(async() => Linking.openURL(url))