Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

How do i know that the Instagram button has been selected?

$
0
0

How do i know when the application has been clicked? I'm using 'Share' from React Native. 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
    }
}

See image here


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>