'Paste from clipboard not working with React Native on iOS simulator
As the title says, I'm working on an app that has an input text and when I tried pasting text I had on the clipboard, it wouldn't do anything, but it shows the new notification saying that "the text from clipboard was assessed".
After that, I installed @react-native-community/clipboard
and tried manually sending something to the clipboard:
Clipboard.setString('https://google.com');
const text = await Clipboard.getString();
console.log('clipboard', { text });
And it was always empty... but: If I switched to a different app, it would paste the URL I sent; and if I run the app on a device, it would work.
Now, a some info on the environment:
- Mac mini M1
- Xcode 12.5
- Simulator for iPhone 12 with iOS 14.5
- Node 14.16
- React Native 0.64.1
Stuff I already tried:
- Restarting the device.
- Resetting the device settings.
- Playing with the check for the pasteboard sync.
- Using the software keyboard.
- Switching the simulator device.
- Added the snippet on the root of the app (I thought it could be related to
@react-navigation/native
)
I don't know what else to test.
Solution 1:[1]
this is iOS Simulator issues with iOS >= 14 with M1. Try using iOS older than 14 and it should work.
Related issue that has deeper explanation: https://github.com/flutter/flutter/issues/74970#issuecomment-858170914
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Micha? Hernas |