scazzy / react-native-webview-autoheight Goto Github PK
View Code? Open in Web Editor NEWWebView which sets it's height automatically with minimal efforts
WebView which sets it's height automatically with minimal efforts
<MyWebView
startInLoadingState={true}
source={{html: this.contentHtml(content)}}
/>
[Unhandled promise rejection: Error: Unable to open URL: ReactABI32_0_0-js-navigation://postMessage?195]
Stack trace:
node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:146:41 in createErrorFromErrorData
node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:95:55 in <unknown>
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:397:4 in __invokeCallback
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:127:28 in <unknown>
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:297:10 in __guard
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:126:17 in invokeCallbackAndReturnFlushedQueue
Not compatible with react-navigation?
I have a flat list, Which have multiple section list and each section have one webview which is loaded dynamically. The Height of the last loaded webView is applying to all the remaining webview. How to set the height of each webview dynamically?
If i am providing the source Html in the form of
<html id="htmlContent">
<p>
<span>{content} </span>
</p>
</html>
the Webview component is able to render the content with correct height.
but if the source Html is
<!DOCTYPE html>
<html id="htmlContent">
<p>
<span>{content} </span>
</p>
</html>
the Height is not calulated correctly and while rendered content is clipped in iOS only.
In addition, i m also using Katex to render the content to mathematical symbols.
So if I m not using <!DOCTYPE html>
then the rendering fraction lines are not rendered properly on both iOS and Android.
is there any fix for iOS webview which works fines even when the <!DOCTYPE html>
is used.
any need on this issue would be grateful.
Here's a website that doesn't render using this module: https://gist.github.com/juliangruber/945260af8d5ec48bf69d8fdb767066be
I've tried setting it both as html
or as uri
, with no difference. It only renders properly when before it another site has been loaded, so I'm assuming the initial view height has something to do with it.
Here is how it should look (in Safari):
Using this module I just get a blank page.
I want to open links externally,
so I was using
ref={(ref) => { this.webview = ref; }}
onNavigationStateChange={(event) => {
this.webview.stopLoading();
Linking.openURL(event.url);
}}
But .stopLoading() doesn't work, since real WebView component is nested in this one.
Can someone suggest something, so that I can open links externally?
It works fine before I upgrade my Chrome, but when I upgrade my Chrome to 70 postMessage not work and onMessage not call ,so I can not get content height , what should I do?
Same as the issue #2, when I use startInLoadingState
loader doesn't disappear !
RN : 0.39.0
react-native-webview-autoheight : 1.0.2 & 1.0.4
Android : 7.1 (emulator)
are u test on Android ? not work for me just show loading.
在android 在打开一个链接时,闪全屏的白屏
Hey, I like the way you handle this issue, but would like to know what license you're publishing it under?
Thanks!
Can you tell me how to enable horizontal scroll, since some of the html elements are cut in half
It works for the first load.
Then after changing html source, the height stay the same.
Used in ListView, first couple was ok, when list get longer, some views get extra white space at bottom.
App becomes slow in the screens where this library is added. What can be done to increase performance and decrease the load on the device?
<MyWebView ref={ r => { this.webView = r } } />
this.webView.reload(); - doesn't work
I'm new to react native. I like this webview. My html source contain image. The webview height is return when my html source image is completely loaded. Sometime if connection problem the webview is not return. So, I'm trying to use default height. It look ok. But the same problem when connection is a little slow the webview height is not change. How to slove this issue?
I am facing autoheight issue when I apply a huge CSS to my HTML content. For Example, when I append bootstrap CSS, the height calculation fails and only a height of approx 20px gets applied.
Below is the code :
<MyWebView width={responsiveWidth(65)} startInLoadingState={true} source={{html:CSS + htmlData, baseUrl: 'http://www.example.com'}} />
This code will work fine if my CSS is short.
Any help on this would be appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.