react-native-clipboard / clipboard

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

useClipboard causes TypeError #84

Open jpav opened 3 years ago

jpav commented 3 years ago

Environment

Expo CLI 4.0.17 environment info: System: OS: macOS 10.15.7 Shell: 3.2.57 - /bin/bash Binaries: Node: 12.13.0 - /usr/local/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 6.14.5 - /usr/local/bin/npm IDEs: Xcode: /undefined - /usr/bin/xcodebuild npmPackages: expo: ~40.0.0 => 40.0.0 react: 16.13.1 => 16.13.1 react-dom: 16.13.1 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz => 0.63.2 react-native-web: ~0.13.12 => 0.13.18 Expo Workflow: managed

Platforms

MacOS web

Versions

Shown above

Description

Just using useClipboard() causes "TypeError: Cannot read property 'getString' of undefined". FWIW, I'm also using TypeScript.

Reproducible Demo

import React, { useEffect } from 'react';
import { Text } from 'react-native';
import { useClipboard } from '@react-native-community/clipboard';

export default function App(): JSX.Element {
  const [clipboardText, setClipboardText] = useClipboard();

  useEffect(() => {
    setClipboardText('hello world');
  }, []);

  return (
    <Text>{clipboardText}</Text>
  );
}
DiMaNacho commented 3 years ago

Same error here!