Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"@react-native-aria/slider": "^0.2.5-alpha.1",
"@react-native-aria/tabs": "^0.2.7",
"@react-native-aria/utils": "^0.2.8",
"@react-native-clipboard/clipboard": "^1.14.1",
"@react-stately/checkbox": "3.0.3",
"@react-stately/collections": "3.3.0",
"@react-stately/combobox": "3.0.0-alpha.1",
Expand Down
7 changes: 4 additions & 3 deletions src/hooks/useClipboard.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import { Clipboard } from 'react-native';
// import { Clipboard } from 'react-native'; 'Clipboard' is deprecated.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe u should remove this comment, is unnecessary...

import Clipboard from '@react-native-clipboard/clipboard';

export function useClipboard() {
const [hasCopied, setHasCopied] = React.useState(false);
const [value, setValue] = React.useState<string>('');
const onCopy = async (copiedValue: string) => {
const onCopy = (copiedValue: string) => {
if (Clipboard) {
await Clipboard.setString(copiedValue);
Clipboard.setString(copiedValue);
}
setValue(copiedValue);
setHasCopied(true);
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2415,6 +2415,11 @@
"@react-aria/ssr" "^3.0.1"
"@react-aria/utils" "^3.3.0"

"@react-native-clipboard/clipboard@^1.14.1":
version "1.14.1"
resolved "https://registry.yarnpkg.com/@react-native-clipboard/clipboard/-/clipboard-1.14.1.tgz#835f82fc86881a0808a8405f2576617bb5383554"
integrity sha512-SM3el0A28SwoeJljVNhF217o0nI4E7RfalLmuRQcT1/7tGcxUjgFa3jyrEndYUct8/uxxK5EUNGUu1YEDqzxqw==

"@react-native-community/bob@^0.16.2":
version "0.16.2"
resolved "https://registry.yarnpkg.com/@react-native-community/bob/-/bob-0.16.2.tgz#9102b0160e70084fa1b75403a80dec332647c950"
Expand Down