EddyVerbruggen / Custom-URL-scheme

:link: Launch your Cordova/PhoneGap app by a Custom URL scheme like mycoolapp://
1.03k stars 367 forks source link

Integrating with reactJS #277

Open noobiept opened 6 years ago

noobiept commented 6 years ago

Hello, so I have a cordova application that is using reactjs, and want to setup a custom URL, but not sure how to proceed.

I tried setting the URL to the session storage, but I'm not getting any URL.

//index.js
function handleOpenURL(url) {
    sessionStorage.setItem("URL", url);
}

//App.js
render() {
        let url = sessionStorage.getItem("URL");
        return (
            <div>
                <h1>Home</h1>
                <p>URL: {url}</p>
            </div>
        );
}
RemeJuan commented 6 years ago

Messing with this myself now and 'url' is coming through as an event and not a URL

haveamission commented 5 years ago

Any luck with this? I am trying this as well, but every time I try to use handleOpenURL() in my index.html, my app is crashing

haveamission commented 5 years ago

It seems that I am getting a ton of messages relating to my URL, and then it crashes...

2019-08-01 11:51:00.550265-0400 domain[37554:5354467] Got memory pressure notification (non-critical) 2019-08-01 11:51:16.385042-0400 domain[37554:5354467] Got memory pressure notification (non-critical) 2019-08-01 11:51:29.919230-0400 domain[37554:5354787] [BoringSSL] nw_protocol_boringssl_error(1584) [C3.1:2][0x11de390f0] Lower protocol stack error: 53 2019-08-01 11:51:29.919459-0400 domain[37554:5354787] [BoringSSL] nw_protocol_boringssl_error(1584) [C10.1:2][0x11dd440b0] Lower protocol stack error: 53 2019-08-01 11:51:29.924886-0400 domain[37554:5354787] TIC Read Status [3:0x280090fc0]: 1:53 2019-08-01 11:51:29.925341-0400 domain[37554:5354787] TIC Read Status [3:0x280090fc0]: 1:53 2019-08-01 11:51:29.926140-0400 domain[37554:5354787] TIC Read Status [10:0x2800886c0]: 1:53 2019-08-01 11:51:29.926157-0400 domain[37554:5354787] TIC Read Status [10:0x2800886c0]: 1:53 2019-08-01 11:51:30.376922-0400 domain[37554:5354467] FB handle url using application:openURL:options: domain:// 2019-08-01 11:51:30.376987-0400 domain[37554:5354467] FB handle url using application:openURL:options: domain:// 2019-08-01 11:51:30.377026-0400 domain[37554:5354467] FB handle url using application:openURL:options: domain:// 2019-08-01 11:51:30.377063-0400 domain[37554:5354467] FB handle url using application:openURL:options: domain:// 2019-08-01 11:51:30.377101-0400 domain[37554:5354467] FB handle url using application:openURL:options: domain:// 2019-08-01 11:51:30.377136-0400 domain[37554:5354467] FB handle url using application:openURL:options: domain://