react-native-clipboard / clipboard

React Native Clipboard API for both iOS and Android.
MIT License
689 stars 138 forks source link

Check clipboard / pasteboard type [iOS] #64

Open filiptronicek opened 4 years ago

filiptronicek commented 4 years ago

Describe the Feature

During WWDC 2020, Apple announced a feature in iOS 14, which alerts the user, if an app reads from the clipboard. This has caused a lot of problems and bad PR since, so I would suggest we implement the contains(pasteboard) API here.

It basically just checks the clipboard for a type of data, without that pesky notification.

9to5Mac article

Possible Implementations

The hardest thing about this would be the port, we could name the functions similarly.

E.g.:

Clipboard.hasURL() // => bool
Clipboard.hasText() // => bool

or

Clipboard.contains(String) // where String is one of the types

Related Issues

56

Edit:

Clipboard.hasString() has been implemented in #73 Clipboard.hasURL() has been implemented in #78

Waiting for

kevinchou723 commented 3 years ago

is there a way to make it detect a pattern? Something like Clipboard.hasPattern(\myPattern\)