Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getString() never resolves #128

Closed
ghost opened this issue Jan 3, 2022 · 3 comments
Closed

getString() never resolves #128

ghost opened this issue Jan 3, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Jan 3, 2022

Environment

info Fetching system and libraries information...
System:
    OS: macOS 12.0.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 2.66 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
    Watchman: 2021.12.20.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 23, 26, 27, 28, 29, 30, 31
      Build Tools: 28.0.3, 29.0.0, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 32.0.0
      System Images: android-27 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-31 | Google APIs Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7583922
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_275 - /Users/xxx/.sdkman/candidates/java/current/bin/javac
    Python: 2.7.18 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: 6.1.0 => 6.1.0
    react: 17.0.2 => 17.0.2
    react-native: 0.65.1 => 0.65.1
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Platforms

both

Versions

Description

When I call await Clipboard.getString() the promise will not be resolved (ever)

This happens if your metro configuration is:

/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: true,
      },
    }),
  },
};

If you flip inlineRequires to false, then promise in this library starts working again. Because this is issue only with this package I believe there is some conflict, but for now I do not have deeper knowledge why is that, just reporting it here as it may help someone...

What is interesting though that this repository has the flag turned to true, I believe it will be issue just with "published / build" package.

There is similar issue opened in react-native repo: facebook/react-native#31558

Reproducible Demo

@ghost ghost added the bug Something isn't working label Jan 3, 2022
@cristianoccazinsp
Copy link
Contributor

inlineRequires: true works fine for me. I'm using RN 0.66.3 and clipboard 1.9.0

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: true,
      },
    }),
  },
};

@cam-eo
Copy link

cam-eo commented Jan 22, 2022

I've been using @react-native-clipboard/clipboard and it's been working great but suddenly I notice today that getString() is now returning empty. And I have not changed this code. Anyone know what is going on?

@chococrypto
Copy link

I had the same problem, I solved it by changing inlineRequires: true to inlineRequires: false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants