I assume that you are using the React Native WebView component to render HTML and JavaScript. This component uses its own UIWebView and WebView components, so you can change the RN of WebView using the same procedures as for them. For example, in the case of iOS, you can do the following:
[[NSURLCache sharedURLCache] removeAllCachedResponses]; [[NSURLCache sharedURLCache] setDiskCapacity:0]; [[NSURLCache sharedURLCache] setMemoryCapacity:0];
You can put this code in your didFinishLaunchingWithOptions method AppDelegate.m . Based on this answer .
In the case of Android, you cannot access the cache if you do not have access to the WebView instance (as per this answer ), so you can create your own WebView using the RN WebView code in combination with the caching functionality. It is not as difficult as it may seem.
martinarroyo
source share