diff --git a/package.json b/package.json index 8ca1e3f776..aaa1d83ad3 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "@mattermost/react-native-paste-input": "^0.6.4", "@miblanchard/react-native-slider": "^2.3.1", "@react-native-async-storage/async-storage": "1.21.0", - "@react-native-clipboard/clipboard": "^1.10.0", "@react-native-masked-view/masked-view": "0.3.0", "@react-native-menu/menu": "^0.8.0", "@react-native-picker/picker": "2.6.1", diff --git a/src/lib/sharing.ts b/src/lib/sharing.ts index b294d74649..2795732d5a 100644 --- a/src/lib/sharing.ts +++ b/src/lib/sharing.ts @@ -1,8 +1,8 @@ import {isIOS, isAndroid} from 'platform/detection' +import {Share} from 'react-native' +import {setStringAsync} from 'expo-clipboard' // import * as Sharing from 'expo-sharing' -import Clipboard from '@react-native-clipboard/clipboard' import * as Toast from '../view/com/util/Toast' -import {Share} from 'react-native' /** * This function shares a URL using the native Share API if available, or copies it to the clipboard @@ -18,7 +18,7 @@ export async function shareUrl(url: string) { } else { // React Native Share is not supported by web. Web Share API // has increasing but not full support, so default to clipboard - Clipboard.setString(url) + setStringAsync(url) Toast.show('Copied to clipboard') } } diff --git a/src/view/com/modals/AddAppPasswords.tsx b/src/view/com/modals/AddAppPasswords.tsx index a8913dd54c..4efcdd5779 100644 --- a/src/view/com/modals/AddAppPasswords.tsx +++ b/src/view/com/modals/AddAppPasswords.tsx @@ -9,7 +9,7 @@ import { FontAwesomeIcon, FontAwesomeIconStyle, } from '@fortawesome/react-native-fontawesome' -import Clipboard from '@react-native-clipboard/clipboard' +import {setStringAsync} from 'expo-clipboard' import * as Toast from '../util/Toast' import {logger} from '#/logger' import {Trans, msg} from '@lingui/macro' @@ -72,7 +72,7 @@ export function Component({}: {}) { const onCopy = React.useCallback(() => { if (appPassword) { - Clipboard.setString(appPassword) + setStringAsync(appPassword) Toast.show(_(msg`Copied to clipboard`)) setWasCopied(true) } diff --git a/src/view/com/modals/ChangeHandle.tsx b/src/view/com/modals/ChangeHandle.tsx index a43c30c29c..5b6831b48b 100644 --- a/src/view/com/modals/ChangeHandle.tsx +++ b/src/view/com/modals/ChangeHandle.tsx @@ -1,5 +1,5 @@ import React, {useState} from 'react' -import Clipboard from '@react-native-clipboard/clipboard' +import {setStringAsync} from 'expo-clipboard' import {ComAtprotoServerDescribeServer} from '@atproto/api' import * as Toast from '../util/Toast' import { @@ -321,9 +321,7 @@ function CustomHandleForm({ // events // = const onPressCopy = React.useCallback(() => { - Clipboard.setString( - isDNSForm ? `did=${currentAccount.did}` : currentAccount.did, - ) + setStringAsync(isDNSForm ? `did=${currentAccount.did}` : currentAccount.did) Toast.show('Copied to clipboard') }, [currentAccount, isDNSForm]) const onChangeHandle = React.useCallback( diff --git a/src/view/com/modals/InviteCodes.tsx b/src/view/com/modals/InviteCodes.tsx index c0318df015..4f3bc5ce01 100644 --- a/src/view/com/modals/InviteCodes.tsx +++ b/src/view/com/modals/InviteCodes.tsx @@ -10,7 +10,7 @@ import { FontAwesomeIcon, FontAwesomeIconStyle, } from '@fortawesome/react-native-fontawesome' -import Clipboard from '@react-native-clipboard/clipboard' +import {setStringAsync} from 'expo-clipboard' import {Text} from '../util/text/Text' import {Button} from '../util/forms/Button' import * as Toast from '../util/Toast' @@ -148,7 +148,7 @@ function InviteCode({ const uses = invite.uses const onPress = React.useCallback(() => { - Clipboard.setString(invite.code) + setStringAsync(invite.code) Toast.show(_(msg`Copied to clipboard`)) setInviteCopied(invite.code) }, [setInviteCopied, invite, _]) diff --git a/src/view/com/util/forms/PostDropdownBtn.tsx b/src/view/com/util/forms/PostDropdownBtn.tsx index 09850a7f54..6df5320001 100644 --- a/src/view/com/util/forms/PostDropdownBtn.tsx +++ b/src/view/com/util/forms/PostDropdownBtn.tsx @@ -1,6 +1,6 @@ import React, {memo} from 'react' import {StyleProp, View, ViewStyle} from 'react-native' -import Clipboard from '@react-native-clipboard/clipboard' +import {setStringAsync} from 'expo-clipboard' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {useNavigation} from '@react-navigation/native' import { @@ -139,7 +139,7 @@ let PostDropdownBtn = ({ const onCopyPostText = React.useCallback(() => { const str = richTextToString(richText, true) - Clipboard.setString(str) + setStringAsync(str) Toast.show(_(msg`Copied to clipboard`)) }, [_, richText]) diff --git a/src/view/screens/Settings/index.tsx b/src/view/screens/Settings/index.tsx index 00b507a997..438025ff60 100644 --- a/src/view/screens/Settings/index.tsx +++ b/src/view/screens/Settings/index.tsx @@ -24,7 +24,7 @@ import {useAccountSwitcher} from 'lib/hooks/useAccountSwitcher' import {useAnalytics} from 'lib/analytics/analytics' import {NavigationProp} from 'lib/routes/types' import {HandIcon, HashtagIcon} from 'lib/icons' -import Clipboard from '@react-native-clipboard/clipboard' +import {setStringAsync} from 'expo-clipboard' import {makeProfileLink} from 'lib/routes/links' import {RQKEY as RQKEY_PROFILE} from '#/state/queries/profile' import {useModalControls} from '#/state/modals' @@ -235,7 +235,7 @@ export function SettingsScreen({}: Props) { }, [onboardingDispatch, _]) const onPressBuildInfo = React.useCallback(() => { - Clipboard.setString( + setStringAsync( `Build version: ${AppInfo.appVersion}; Platform: ${Platform.OS}`, ) Toast.show(_(msg`Copied build version to clipboard`)) diff --git a/yarn.lock b/yarn.lock index 4b5b55b7e8..8c0584a84c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4682,11 +4682,6 @@ dependencies: merge-options "^3.0.4" -"@react-native-clipboard/clipboard@^1.10.0": - version "1.11.2" - resolved "https://registry.yarnpkg.com/@react-native-clipboard/clipboard/-/clipboard-1.11.2.tgz#e826d0336b34e67294aaffa6878308900bc7d197" - integrity sha512-bHyZVW62TuleiZsXNHS1Pv16fWc0fh8O9WvBzl4h2fykqZRW9a+Pv/RGTH56E3X2PqzHP38K5go8zmCZUoIsoQ== - "@react-native-community/cli-clean@12.3.0": version "12.3.0" resolved "https://registry.yarnpkg.com/@react-native-community/cli-clean/-/cli-clean-12.3.0.tgz#667b32daa58b4d11d5b5ab9eb0a2e216d500c90b"