Skip to content
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

Set WebView's height to wrap content if its parent is ScrollingView #266

Merged
merged 3 commits into from
Mar 21, 2023

Conversation

mbarta
Copy link
Contributor

@mbarta mbarta commented Mar 21, 2023

The change to support proper nested scrolling of a WebView inside of a BottomSheet introduced in #261 unfortunately caused some side-effects to other full-height screens in some cases related to scrolling of nested content.

Therefore, this PR restores the default layout parameters of the shared WebView to MatchParent and only if the WebView's parent is ScrollingView, its height is set to WrapContent.

@mbarta mbarta requested review from jayohms and jhutarek March 21, 2023 17:18
@mbarta mbarta self-assigned this Mar 21, 2023
Comment on lines 37 to 42
webView.updateLayoutParams {
height = when (webViewContainer) {
is ScrollingView -> LayoutParams.WRAP_CONTENT
else -> LayoutParams.MATCH_PARENT
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work if you move this down to line 55? It feels safer to me to only update the layout params if we know that we're attaching the webView to a new parent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, makes sense. It does work inside of that block the same 👍

Copy link
Collaborator

@jayohms jayohms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@mbarta mbarta merged commit 08a7b7b into main Mar 21, 2023
@mbarta mbarta deleted the update_layout_params_based_on_parent branch March 21, 2023 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants