react-native-clipboard / clipboard

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

hasString() always returns true even if clipboard is empty? #125

Closed barrymcgee closed 2 years ago

barrymcgee commented 2 years ago

Environment

System:
    OS: macOS 12.0.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 173.00 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.12.0 - ~/.nvm/versions/node/v16.12.0/bin/node
    Yarn: 1.22.10 - ~/src/github.com/Shopify/arrive-client/node_modules/.bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.12.0/bin/npm
    Watchman: 2021.11.15.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.2 - /Users/barrymcgee/.gem/ruby/2.6.1/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0
    Android SDK:
      API Levels: 29, 30
      Build Tools: 30.0.2
      System Images: android-30 | Google APIs Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.2 AI-202.7660.26.42.7486908
    Xcode: 13.1/13A1030d - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.8 - /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.66.2 => 0.66.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Platforms

Both

Versions

Description

When setting a conditional using await Clipboard.hasString(), I always get true returned regardless of whether my clipboard is empty or contains a string.

Note: To test an empty clipboard, I run pbcopy < /dev/null in my terminal.

rodperottoni commented 2 years ago

This is indeed a bug on the latest version.

barrymcgee commented 2 years ago

Closing as I can no longer replicate this bug.