Closed z0al closed 3 years ago
@z0a Thanks a lot for your report! I guess I'm missing a major detail: on which platform this issue is raised? Also, please provide the version of the operating system affected. It would also be helpful to have the webpage concerned by this issue. My first guess would be that would happen when the loaded page is "blank", and thus some variables in the DOM are null. But better investigate with more evidence. Thanks!
I guess I'm missing a major detail: on which platform this issue is raised? Also, please provide the version of the operating system affected
Pixel 4 XL (API 30) simulator (On Ubuntu 20.04) - Android 11.0
My first guess would be that would happen when the loaded page is "blank"
That's actually correct. I load the HTML string from a local SQLite DB when the screen is mounted. Loading from SQLite is quite fast but I guess sometimes it takes long enough for the Page to be first loaded "blank" because of the way it's called:
<WebView source={{html: data?.content || '' }} />
What if I instead pass a string with an empty body. Does it also count as "blank"?
<html>
<head></head>
<body></body>
</html>
Ofc, I could also conditionally render the WebView when the data is not ready but I would rather have the WebView
already mounted and ready to speed the overall process.
@z0al I would try the empty body snippet when data is empty, because some features rely on the assumption that there is a body. I guess that I could fix those scripts to avoid such nuisance! Please try this, and if indeed the error disappear, I will amend those scripts.
Unfortunately, that doesn't seem to be the case.
I tried always setting the source HTML to ''
and that didn't trigger any error no matter how many times I try. Setting the HTML source to always be <html><head></head><body></body></head>
has the same effect too.
I now think the errors only appear on a few specific HTML strings (again, randomly). I will try to investigate this more later to come up with a minimal reproducible example.
@z0al Thanks for your feedback. Yes, once I can reproduce the issue easily, I'll be able to investigate efficiently!
@z0al Do you think could try out the new release 2.3.0 and tell me if the issue still occurs?
I can confirm that I don't see these errors anymore. Thank you @jsamr
Warning
[Webshell]: Web script from feature "org.formidable-webview/webshell.handle-html-dimensions" raised an error: Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element'
still randomly occurs on version ^2.5.0
Description
Everything is working as expected but I still get these errors/warnings and I'm not sure if I can do something about them. Especially since they happen randomly.
Environment
Example
I literally copy-pasted the example from Autoheight WebView
Show code anyway
```javascript import makeWebshell, { HandleHashChangeFeature, HandleHTMLDimensionsFeature, useAutoheight } from '@formidable-webview/webshell'; import type { HashChangeEvent } from '@formidable-webview/webshell'; import React, { useCallback, useRef, useState } from 'react'; import { LayoutChangeEvent, ScrollView, StyleSheet, View } from 'react-native'; import WebView from 'react-native-webview'; const Webshell = makeWebshell( WebView, new HandleHTMLDimensionsFeature(), new HandleHashChangeFeature({ shouldResetHashOnEvent: true }), new shell.ForceElementSizeFeature({ target: 'body', heightValue: 'auto', widthValue: 'auto', }), new shell.ForceResponsiveViewportFeature({ maxScale: 1, }) ); export const AutoheightWebViewInScrollView = ( webshellProps ) => { const scrollViewRef = useRefI'm loading a static HTML string but I don't think posting the actual string would be of any value since the issue happens randomly with different strings.
P.S. Thank you so much for this awesome library!