React Native Webview returning ssl error: The certificate authority is not trusted - react-native

I'm facing this problem when trying to access a website without a certificate. Would anyone know of a solution for this? Or an alternative to react-native-webview.
my code is like this
<WebView source={{ uri: 'websitewithoutcertificate' }}/>
enter image description here
already looking for solutions on github of the lib, but I haven't found a solution yet

Related

How do I access failed redirects in react-native webview?

Im using the Plaid Link Webview with React Native. The Webview works fine. The issue is Plaid uses redirects to communicate changes. I can't figure out how to access those redirects. I get a warning from react-native-webview saying Cannot load url plaidlink://.... but I want to be able to read that URL. I've tried using onNavigationStateChange but that doesnt work either.
My co-workers suggested this code:
<WebView
source={{
uri: `https://cdn.plaid.com/link/v2/stable/link.html?isWebview=true&token=${linkToken}`,
}}
originWhitelist={['https://*', 'plaidlink://*']}
onShouldStartLoadWithRequest={handleNavigationStateChange}
/>
const handleNavigationStateChange = (event: any) => {
if (event.url.startsWith('plaidlink://')) {
console.log(event.url)
}
However, we'd also like to recommend using Plaid's official SDKs when possible, such as our React Native SDK, rather than reading directly from Plaidlink URLs, as those URLs could change in the future.

react-native-webview: mixedContentMode not working

I have a webview inside my app and it works well, both in ios and android, when I am using secure urls (https).
But one of the backend enviroments uses unsecure http protocol and it doesn't work on Android. I've already set android:usesCleartextTraffic="true" on main/AndroidManifest.xml and the website indeed opens, but it doesn't load correctly because it mix secure and unsecure requests inside it.
I've tried to add the prop mixedContentMode={'always'} but it didn't affected the behavior I am trying to avoid.
How can I fix it?
Try adding these props as well:
javaScriptEnabled={true}
domStorageEnabled={true}
startInLoadingState={true}
originWhitelist={['*']}

Why multiple WebView can't share the cache?

I have an app developed with react-native. The react-native-webview and react-navigation plugins are used.
When I opened an interface that contained a webview and then jumped to another interface that contained a webview, I found that they could not share the cache. The static files referenced by the previous page were loaded again on the next page.
But if I redirect the url of the webpage in the same webview, the cache works and everything is normal.
react-native-webview uses the default configuration, and the cache-control for static file requests is normal.
I don't know if the webview performance under android is like this, or is it another problem?
<WebView
ref={this.webview}
source={{uri: url}}
mixedContentMode="compatibility"
useWebKit={true}
allowsInlineMediaPlayback={true}
allowsFullscreenVideo={true}
onNavigationStateChange={this._onNavigationStateChange}
onLoadStart={this._onLoadStart}
onLoadEnd={this._onLoadEnd}
onMessage={this.invoke.listener}
/>
Set sharedCookiesEnabled={true}

React Native not working with wild card SSL

I have react native app when i try call API from normal SSL (direct domain) my app working perfect, but when I change to call API from domain using wildcard SSL is not working. Any idea to solve this issue ?

How to access loaded images in React Native?

I am trying to share an image using Expo Sharing but it throws an error,
[Error: Only local file URLs are supported (expected scheme to be 'file', got 'https']
This https URI is my S3 bucket's, and that's how I fetch uploaded media. I use <Image /> to display this media, and I want to implement functionality that allows me to share these images out of my app.
When I use <Image />, these images are cached/stored/loaded somewhere, and I'm wondering how can I find access them? I've tried doing
<Image onLoad={() => console.log(e)}
But that doesn't tell me anything other than what the original source URI was.