Tyler S
Tyler S

Reputation: 136

Universal Links query string removed/lost while generating share link, IOS, ReactNative Share

Project workspace

Synopsis: I'm using universal links and query params to allow my users to share tickets. The Universal links are being stripped of all route params and query strings when the link is shared by the native sharing dialog. Using the COPY/PASTE function in the native sharing dialog always copies a complete link, which can be pasted anywhere and used successfully to open the app. The EMAIL option also works, opening Mail with the correct url string and autofilled as expected. The problem arrises when I try to share the link via iMessage. I'm running the project on an iPhone as a fully deployed Apple Testflight standalone app.

const ticketShare = (ticket: Ticket) => {
        const link = Linking.createURL("www.sample.com/share_ticket", { //Expo Linking library
            scheme: "https",
            queryParams: {
                ...ticket
            }
        }).replaceAll("%25", "%"); //double encoding problem I have yet to properly fix.
        console.log("link: ", link); //always the correct url here.

        Share.share({ url: link }); // request to open the native sharing dialog activity. ('url' for ios) 
    };

sharing dialog image. https://www.sketchappsources.com/resources/source-image/simple-share-actionsheet-ios-13-hugo.png

To make it more complicated, the share function does yield the correct url directly after a fresh install, but then never again. Console.logs always log the correct url.

I have tried react-native-share's library with the same results. (Wraps the same native bridge code?)

I have checked the react-native github page for issues related to this with no result. I have combed StackOverflow for a few days without results. Usually that means its something simple.. here's to hoping. Anyone out there run into this issue? Thanks!

Upvotes: 6

Views: 587

Answers (0)

Related Questions