Fix Android sharing (#545)

zio/stable
Ollie Hsieh 2023-04-27 07:38:28 -07:00 committed by GitHub
parent 62b07f93fd
commit c8e51a7d48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import {isNative} from 'platform/detection'
import {isIOS, isAndroid} from 'platform/detection'
// import * as Sharing from 'expo-sharing'
import Clipboard from '@react-native-clipboard/clipboard'
import * as Toast from '../view/com/util/Toast'
@ -11,8 +11,10 @@ import {Share} from 'react-native'
* clipboard.
*/
export async function shareUrl(url: string) {
if (isNative) {
Share.share({url: url})
if (isAndroid) {
Share.share({message: url})
} else if (isIOS) {
Share.share({url})
} else {
// React Native Share is not supported by web. Web Share API
// has increasing but not full support, so default to clipboard