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))