Share extension react native - expo

后端 未结 1 632
暗喜
暗喜 2021-01-13 22:26

I have created a react-native app using expo. Now I am looking for share-extension to the app to import CSV data from email attachment to my app.

I have tried npm pa

相关标签:
1条回答
  • 2021-01-13 23:10

    I'm afraid this is not possible with expo.

    First of all, are you looking for a way to create your own extension, or do you just want your app to be in the "open with list" that you have in the screenshot on the right? (Sharing and "open with" are two distinct things.)

    If you just want your app to be listed in the standard "open with list", you do not need to use github.com/alinz/react-native-share-extension since it serves a different purpose. To quote the repo:

    This is a helper module which brings react native as an engine to drive share extension for your app.

    So with the package you can use react native to create your own share extension

    To get your app into the "open with list", you need to go to target settings and change it according to the screenshot (example for MS word). Read more about it here. However, I'm afraid you won't be able to do this with expo without ejecting.

    How to get the url of the file in react-native? You need to make sure that libRCTLinking.a is in the Link Binary with Libraries in Xcode (it'll probably be there already). And then you can follow the docs and call Linking.getInitialURL to get the file url. Then it really depends on what you want to do with the file. If you need something complicated, you'll likely need to write native code. If you just want to upload the file to some server, then you can make use of blob support that was added to RN 0.54 in this commit. An example of how to use the blob support is here.

    0 讨论(0)
提交回复
热议问题