I'm using 'Share' from React Native. How do i know when the application has been clicked? I want to know as soon as a user clicks an app icon (e.g. Instagram) and then launch my own function, not the share page in instagram. How can i capture that the user has just clicked the app icon?
Right now if i click the app icon, it moves to the app's (e.g. Instagram's) share page, and when i dismiss it, then it tells me what my sharedAction
was (which is too late!). I don't want to have to enter the share page at all.
I need to know when i've selected the Instagram app icon, so i can launch my own function.
import { Share } from 'react-native'
shareImage = async() => {
const result = await Share.share(
{
message: 'Hello',
url: "www.image...."
},
)
.then(res => console.log(res))
if (result.action === Share.sharedAction) {
if (result.activityType) {
// shared with activity type of result.activityType
} else {
// shared
}
} else if (result.action === Share.dismissedAction) {
// dismissed
}
}