装包:
npx expo install expo-clipboard
import * as Clipboard from 'expo-clipboard'
const handleCopy = async (text) => {
await Clipboard.setStringAsync(text)
Toast.show('复制成功', {
duration: 3000,
position: Toast.positions.CENTER,
})
}
参考链接:
https://docs.expo.dev/versions/latest/sdk/clipboard/
https://www.npmjs.com/package/expo-clipboard