-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
width is specified as the screen width by default #107
Comments
You can wrap a View to do this: <View
style={{ flex: 1, alignSelf: 'stretch' }}
onLayout={event => {
this.setState({ webviewWidth: event.nativeEvent.layout.width });
}}
>
<AutoHeightWebView
style={{ width: this.state.webviewWidth }} |
Sure I can do that. But that is pretty complex. If I want other react control to stretch the whole screen I don't have to do the logic you just mention. It would be great if the code could look for the other layout attribute than width before deciding to set its width to the screen width. |
@otusweb The only way to horizontally stretch a WebView is to set explicit width: react-native-webview/react-native-webview#27 |
@iou90 Good to know and thanks for considering this feature request! |
Unfortunately, I found the onLayout callback on NativeWebView of react-native-webview can not provide the width of its container like View does, may be they should put the onLayout callback to it's View wrapper. |
It just helped me |
It would be great if the component could just take the width of its container (could use the 'stretch' mode)
As of right now, I have to calculate the width manually otherwise the web view overflows the container.
The text was updated successfully, but these errors were encountered: