thebergamo / react-native-fbsdk-next

MIT License
633 stars 165 forks source link

ShareDialog warning: Calling [RCTConvert UIImage:] on a background thread is not recommended #492

Closed hdsuperman closed 1 month ago

hdsuperman commented 2 months ago

🐛 Bug Report

Calling [RCTConvert UIImage:] on a background thread is not recommended

To Reproduce

press the button to call onShareToFacebook below.

Expected Behavior

Fix the warning

Code Example

  const onShareToFacebook = async () => {
    const cacheUrl = cached ?? (await getCacheUrl(url, type));
    if (!cacheUrl) return;
    const content: ShareContent = {
      contentType: 'photo',
      commonParameters: { hashtag: config.appName },
      photos: [{ imageUrl: cacheUrl, userGenerated: false }],
    };

    if (!(await ShareDialog.canShow(content))) {
      return;
    }
    ShareDialog.setMode('automatic');
    const { postId, isCancelled } = await ShareDialog.show(content);
    onClose();
  };

Environment

System:
  OS: macOS 14.2.1
  CPU: (10) arm64 Apple M1 Max
  Memory: 339.59 MB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.10.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.19
    path: /usr/local/bin/yarn
  npm:
    version: 10.2.3
    path: /usr/local/bin/npm
  Watchman:
    version: 2023.12.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 15.1/15C65
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /Users/haodongzheng/.sdkman/candidates/java/current/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.4
    wanted: 0.73.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
mikehardy commented 2 months ago

Hi there! If this is important for your use cases, we can merge any reasonable PR you propose to solve it Thanks

stale[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.