facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 907 forks source link

Photo Share not working #584

Open manujbahl opened 5 years ago

manujbahl commented 5 years ago

🐛 Bug Report

Photo Share works but caption ignored. I am trying to select an image from the user's photo gallery and share it on facebook. The photo appears in the share dialog without the message text

To Reproduce

  1. Try to share a local file from the gallery with a message.
    1. Image and message show up in email/message sharing but not on facebook sharing.
    2. Facebook sharing only shows image. ( no message)

Expected Behavior

Photo share option opens in FB app.

Code Example

Here is the code.

Selecting from the gallery ( using  ImagePicker - react-native-image-picker ) and send a local file url. That gives an error (Also tried base 64 string but that also fails.)
The photoUri is  
file:///var/mobile/Containers/Data/Application/2FEA283D-8097-4B51-97A6-9F18081E03AA/tmp/B50672CC-4733-4780-9F88-77BA5A3F8A39.jpg

ImagePicker.showImagePicker(options, (response) => {

                                    const photoUri = response.uri;
                                    const sharePhotoContent = {
                                        contentType: 'photo',
                                        caption: "Test Message",
                                        photos: [{ imageUrl: photoUri }],
                                    }

                                    ShareDialog.show(sharePhotoContent);


## Environment
React Native Environment Info:

    System:
      OS: macOS 10.14.4
      CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
      Memory: 1.23 GB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 8.3.0 - ~/.nvm/versions/node/v8.3.0/bin/node
      Yarn: 1.9.4 - /usr/local/bin/yarn
      npm: 5.3.0 - ~/.nvm/versions/node/v8.3.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 21, 22, 23, 24, 25, 26, 27, 28
        Build Tools: 23.0.0, 23.0.1, 23.0.3, 24.0.3, 25.0.0, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.1, 28.0.3
        System Images: android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-24 | Android TV Intel x86 Atom, android-24 | Android Wear ARM EABI v7a, android-24 | Android Wear Intel x86 Atom, android-24 | ARM 64 v8a, android-24 | ARM EABI v7a, android-24 | Intel x86 Atom, android-24 | Intel x86 Atom_64, android-24 | Google APIs ARM 64 v8a, android-24 | Google APIs ARM EABI v7a, android-24 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom_64, android-24 | Google Play Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.1 AI-173.4819257
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.5.0 => 16.5.0 
      react-native: 0.57.1 => 0.57.1 
    npmGlobalPackages:
      create-react-native-app: 2.0.2
      react-native-asset: 1.1.4
      react-native-cli: 2.0.1
manujbahl commented 5 years ago

Anyone ?

cporawat commented 5 years ago

Pre-filled caption is forbidden by Facebook platform policies (2.3), sot he caption must come from the user. See policy and SharePhoto