react-native-receive-sharing-intent icon indicating copy to clipboard operation
react-native-receive-sharing-intent copied to clipboard

Sharing export chat from whatsapp got this Error: Invalid file type

Open maftuh-lab opened this issue 3 years ago • 4 comments

Hi, thank you for this great library. It's stright forward and very easy to use.

This library works well on my app. Any other file or text recieved perfectly. But when im trying to export whatsapp chat to my app, the app can listen to the event and nothing crashed. But the code return

Error: Invalid file type.
    at Object.promiseMethodWrapper [as getFileNames] (index.bundle?platfor…e&minify=false:2242)
    at Function.ReceiveSharingIntentModule.getFileNames (index.bundle?platfor…&minify=false:98923)
    at index.bundle?platfor…&minify=false:98906
    at index.bundle?platfor…&minify=false:43147
    at RCTDeviceEventEmitter.emit (index.bundle?platfor…e&minify=false:3537)
    at MessageQueue.__callFunction (index.bundle?platfor…e&minify=false:2765)
    at index.bundle?platfor…e&minify=false:2497
    at MessageQueue.__guard (index.bundle?platfor…e&minify=false:2719)
    at MessageQueue.callFunctionReturnFlushedQueue (index.bundle?platfor…e&minify=false:2496)
    at RNDebuggerWorker.js:2

To be more clear, below are the scenario ezgif com-gif-maker

  • Platform : Android
  • "react": "16.13.1"
  • "react-native": "0.63.3",
  • "react-native-receive-sharing-intent": "^1.0.4"

maftuh-lab avatar Oct 02 '20 03:10 maftuh-lab

+1

duylinhdang1998 avatar Oct 07 '20 08:10 duylinhdang1998

+1

MshHooman avatar Dec 23 '20 12:12 MshHooman

Figured out that whatsapp exports array of files instead of single file. This library is great, but may be not covered all specific needs.

Using react-native-share-menu i can catch whatsapp export. Of course you need explicitly accept multiple file types in AndroidManifest.xml. Something like this

<intent-filter>
        <action android:name="android.intent.action.SEND"/>
        <action android:name="android.intent.action.SEND_MULTIPLE"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <!-- <data android:mimeType="image/*"/> -->
        <!-- <data android:mimeType="video/*"/> -->
        <data android:mimeType="text/*" />
        <!-- <data android:mimeType="*/*" /> -->
</intent-filter>

PetengDedet avatar Dec 24 '20 01:12 PetengDedet

hello, I spent many hours trying to make it work on iOS and nothing, until I got it to work, I read that it was a problem with the group.name, simply I opened the file "ShareViewController.swift", search and replace all values that said "group.\(this.hostAppBundleIdentifier)" and I set them manual "group.com.myappidname" and that solved the problem and no longer gives more error [Error: file type is Invalid] iOS

luigbren avatar Dec 16 '21 02:12 luigbren