How can I share a file using react-native and expo on android without detaching? - react-native

I'm working on an app with Expo and would like the user be able to share a file (.vcf) with an application of their choice.
On iOS I have this working without issues using the default
Share.share({url: filetoshare})
However, the URL field only works for iOS. I read a suggestion to use
IntentLauncherAndroid.startActivityAsync('android.intent.action.SEND', {URI
: uri});
But this gives me the error:
No Activity Found To Handle Intent
Is there any way that I would be able to share a file without detaching on an android device?
If there is any additional information I could provide to make answering this question easier, please let me know. Thank you!

Related

How to troubleshoot an app after its installed

I just built and installed an android app using expo but upon launching it, the app crashes after the splash screen when it was working just fine when I using expo. I now wonder how am I to fix it when I can't even see where the problem lies.
Is there a way to find out what the problem is ? like some kind of debug=true option or anything else to figure out and fix the issue ?
You can use a 3rd party plugin that does just that like firebase or instabug, these are the 2 that I've used but I'm sure you can find a lot more.

VS Code live share react native?

Does anyone know how teamwork can be done in a live sharing vscode emulator and run as an emulator for everyone? I'm learning to see and My master is in another country
you can try VS Code Live Share extension pack. It maybe can help you.

How can I download configs and assets on first run in my react native application?

I'm trying to build a game using react native, and I need to have a loading screen in start of application to download latest app configs and assets such as images, fonts,... . I'm wondering how can I achieve that?
is there any library that can help me?
I read about "rn-fetch-blob" and "react-native-fs", are these the only ways? I don't want to get users permission for assets which are going to be used only in my application.
if you cloud please help me with your advice.
Thanks.
You can use remote database like FireBase (Firestore) to handle all your configurations, Paths ... etc
You can follow this tutorial to setup FireStore in your application
https://medium.com/react-native-training/firebase-sdk-with-firestore-for-react-native-apps-in-2018-aa89a67d6934
Hopefully this answers your question

Share extension react native - expo

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 package but that does not work for me(I was not able to build my project with that npm package in Xcode)
I think react-native or expo does not have any share API
In this picture, you can see how he got the option to import data into the app.
I understand that without share extension API, I think react-native and Expo both are useless because you can create the app but you don't expand it.
Looking for the solution or any other alternate solution.
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.

How to view realm db created by react-native in ios stimulator

I want to access realm database created by my ios app that I created using react-native. Its easier to use adb pull for android but for ios I am not getting much idea. There are some links like -
realm-file in ios app
to find app uuid for above link
So any help, how to view realm db for developing and debugging purpose for react-native developed ios app.
Thanks for the answer but additional (out of curiosity) Question - but how to find app uid which are installed by react native on ios simulator ??
While searching through the web, got the answer in docs:
console.log('realm db file path:', realm.path);
With the iOS emulator you can just find the path and open the Realm directly (which allows you to see the changes as they happen, great for debugging), on Android you will have to copy the file out to the regular file system.
It is all described in the docs for Realm Studio: https://docs.realm.io/platform/realm-studio/view-your-data#viewing-realms-from-emulators