ajith-ab / react-native-receive-sharing-intent

A React Native plugin that enables React Native apps to receive sharing photos, videos, text, urls or any other file types from another app
MIT License
297 stars 108 forks source link

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

Open maftuh-lab opened 3 years ago

maftuh-lab commented 3 years ago

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

duylinhdang1998 commented 3 years ago

+1

MshHooman commented 3 years ago

+1

PetengDedet commented 3 years ago

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>
luigbren commented 2 years ago

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