Problems with passing styles as props, tmp fixed for now
jonrh opened this issue · 0 comments
jonrh commented
The implementation by mmazzarolo did not work out of the box for me. I ran into some style related issue.
Error message:
View was rendered with explicitly set width/height but with a 0 flexBasis. (This might be fixed by changing flex: to flexGrow:) View: <RCTShadowView: 0x7f8c96d2e840; viewName: RCTWebView; reactTag: 6; frame: {{0, 0}, {nan, nan}}>
To work around this issue I wrap the WebView in another <View style={style}>
. It seems to work but may not be ideal. Here is the workaround:
<View style={style}>
<WebView
onLayout={this._reRenderWebView}
style={[styles.webView, style]}
source={html}
javaScriptEnabled={true}
domStorageEnabled={true}
scalesPageToFit={false}
scrollEnabled={false}
automaticallyAdjustContentInsets={false}
injectedJavaScript={this._createInjectedJavascript(configuration)}
{...otherProps}
/>
</View>