achorein / expo-share-intent

🚀 Simple share intent in an Expo Native Module
MIT License
172 stars 15 forks source link

lib is not forwarding shared intent to my app #76

Closed geetee24 closed 2 months ago

geetee24 commented 3 months ago

Need example of useEffect() that can trigger when an incoming share intent arrives in my app.

Not working:

expoShareIntent[scheme] from expoConfig: com.aaa.bbb.ccc DEBUG useShareIntent[mount] com.aaa.bbb.ccc {"debug": true, "onResetShareIntent": [Function onResetShareIntent]} DEBUG useShareIntent[refresh] null DEBUG useShareIntent[to-background] reset intent DEBUG expoShareIntent[scheme] from expoConfig: com.aaa.bbb.ccc DEBUG expoShareIntent[scheme] from expoConfig: com.aaa.bbb.ccc DEBUG useShareIntent[mount] com.aaa.bbb.ccc {"debug": true, "onResetShareIntent": [Function onResetShareIntent]} DEBUG useShareIntent[refresh] com.aaa.bbb.cccProtocol://dataUrl=ShareKey#text DEBUG expoShareIntent[scheme] from expoConfig: com.aaa.bbb.ccc DEBUG useShareIntent[active] refresh intent DEBUG useShareIntent[refresh] com.aaa.bbb.cccProtocol://dataUrl=ShareKey#text DEBUG expoShareIntent[scheme] from expoConfig: com.aaa.bbb.ccc DEBUG useShareIntent[to-background] reset intent DEBUG expoShareIntent[scheme] from expoConfig: com.aaa.bbb.ccc DEBUG useShareIntent[active] refresh intent DEBUG useShareIntent[refresh] com.aaa.bbb.cccProtocol://dataUrl=ShareKey#text DEBUG expoShareIntent[scheme] from expoConfig: com.aaa.bbb.ccc

code that is not showing incoming share text:

React.useEffect ( () => { // loop forever

     if ( shareIntent.text ) {
         Alert ( 'text', shareIntent.text );
     }

     if ( shareIntent.webUrl ) {
         Alert ( 'weburl', shareIntent.webUrl );
     }

     if ( shareIntent.files ) {
         Alert ( 'files', JSON.stringify( shareIntent.files ) );
     }

 }, [hasShareIntent] );

 React.useEffect ( () => {
     // loop forever

     if ( shareIntent.text ) {
         Alert ( 'text', shareIntent.text );
     }

     if ( shareIntent.webUrl ) {
         Alert ( 'weburl', shareIntent.webUrl );
     }

     if ( shareIntent.files ) {
         Alert ( 'files', JSON.stringify( shareIntent.files ) );
     }

 }, [shareIntent] );

dont know why the console logs appear when I share text into the app but the app CAN NOT get the actual shared content.

achorein commented 3 months ago

your scheme is misconfigured, you received on deep link for com.aaa.bbb.cccProtocol:// instead of com.aaa.bbb.ccc://, do you have multi-scheme in your app.json ?

you can try to override scheme in your app :

    useShareIntent({
      scheme: "com.aaa.bbb.cccProtocol",
    });
achorein commented 3 months ago

if you changed your app.json don't forget to clean your expo prebuild : expo prebuild --no-install --clean

geetee24 commented 3 months ago

i have a expo.scheme AND a

"infoPlist": { "CFBundleURLTypes": [ { "CFBundleURLSchemes": [ "com.aaa.bbb.ccc" ]

Why do i need both?

I need an example for multiple providers BUT not react native navigation please.

On Tue, Jun 25, 2024 at 1:41 AM Anselme Chorein @.***> wrote:

your scheme is misconfigured, you received on deep link for com.aaa.bbb.cccProtocol:// instead of com.aaa.bbb.ccc://, do you have multi-scheme in your app.json ?

you can try to override scheme in your app :

useShareIntent({
  scheme: "com.aaa.bbb.cccProtocol",
});

— Reply to this email directly, view it on GitHub https://github.com/achorein/expo-share-intent/issues/76#issuecomment-2188320621, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABS6UT7FBG2JSZHOI43TJC3ZJEULBAVCNFSM6AAAAABJ2WJLQ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBYGMZDANRSGE . You are receiving this because you authored the thread.Message ID: @.***>

geetee24 commented 3 months ago

what does this command do?

On Tue, Jun 25, 2024 at 2:00 AM Anselme Chorein @.***> wrote:

if you changed your app.json don't forget to clean your expo prebuild : expo prebuild --no-install --clean

— Reply to this email directly, view it on GitHub https://github.com/achorein/expo-share-intent/issues/76#issuecomment-2188357392, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABS6UTZRI47JDOYP3CBA3HDZJEWQ7AVCNFSM6AAAAABJ2WJLQ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBYGM2TOMZZGI . You are receiving this because you authored the thread.Message ID: @.***>

geetee24 commented 3 months ago

i got the code to work. However when I share say text from an app into my app - i see a FLASH of a dialog box that auto disappears before my app comes up with the shared text.

This flash dialog box is not my code. It appears to be your code? Is it? How make it not flash up? See attached pic IMG004

achorein commented 3 months ago

This dialog box is needed by iOS, we cannot remove it (knowned as share extension view). The share intent auto-submit the dialog to forward the share intent to the app