'Weird caching issue with react native webview only on iOS

This is only happening on IOS, on android I'm getting expected behavior.

I have this property on my web view from react-native-webview

        onNavigationStateChange={(e) => {
      if (e?.url.includes(TOKEN_QUERY_PARAM)) {
        let startIndex = e.url.indexOf(TOKEN_QUERY_PARAM);
        let token = e.url.substring(startIndex + TOKEN_QUERY_PARAM.length);
        authorize(token);
        }
       }}

As you can see, the webview will send me a link with a token that I can then send to my authorize function to get my user signed into the app. This works the first time the app is used but then begins caching the same call/response if you do it again. Its working as it should on android, but on ios the authorize function is returning the same information from the last time it was called.

Has anyone experienced anything like this? I tried setting all the different cache properties on the webview to be false and it still doesnt work. Any ideas??



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source