How to clear react native webview cookies?
Solved by using this: https://github.com/react-native-community/react-native-cookies
CookieManager.clearAll();
I used incognito mode as a turnaround and it worked perfect for me.
<WebView
incognito={true}
userAgent="Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko"
source={{
uri:
'your url',
}}
style={{ flex: 1 }}
/>
At the time I'm posting, CookieManager
has poor support for Expo, I had problems clearing cookies after changing a password.
In 2020, for those using Expo, this works:
const RCTNetworking = require('react-native/Libraries/Network/RCTNetworking')
RCTNetworking.clearCookies(() => { })