My original code was working before upgrading to Expo SDK 37 and react-native-webview@8.1.1
:
const onShouldStartLoadWithRequest = ({ url }: WebViewNavigation): boolean => { const response = parseResponse(url); if (shouldProceed(response)) { proceed(response); return false; } return response;};parseResponse(url: string): Params | boolean { const uri = URL.parse(url); if (uri.protocol === "deeplinkprotocol:") { const query = queryString.parse(uri.search, { decode: false }); switch (uri.host) { case Event.connected: return { param: query.param, }; default: return false; } } return uri.protocol === this.http || uri.protocol === this.https;}
The redirection to the request url stopped working since onShouldStartLoadWithRequest
threw an error.