How to track change in react native clipboard

In earlier versions it was possible to track clipboard changes, but now when updating packages, the ClipboardEvent in addClipboardListener is deprecated

Hi @gadzhimurad

Where do you see that it is deprecated?

If I look at the documentation I don’t see that.

EDIT: OK I think I know what you mean:

Screenshot of ClipboardEvent type

I believe that this means that the content field in the ClipboardEvent is deprecated. When your event listener fires, instead of fetching the data from content, you should call getStringAsync() to get the data.

1 Like

Yes, I did just that, and I start debugging on a device with android 10 and on android 6, and for some reason the code is supported on one of the devices, that is, when changing the clipboard everything works, but not on the other, although the minimum SDK is 46 android 5


The code above works on android 10, but on 6 it does not see the Clipboard event at all

It sounds like a possible bug. Maybe create an issue in the expo/expo repository on GitHub with the above details.

Also, you could see if @react-native-clipboard/clipboard - npm would work for you instead. No need to run “pod install”. It won’t work in Expo Go, but should work fine if you create a development build to use instead of Expo Go.

1 Like

I’ll try as you said, thanks for your time

1 Like