Skip to content

Commit

Permalink
Calculate width param
Browse files Browse the repository at this point in the history
  • Loading branch information
bentrengrove committed Nov 14, 2022
1 parent 9fce9ba commit 0554af0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web/src/main/java/com/google/accompanist/web/WebView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,19 @@ fun WebView(
// WebView changes it's layout strategy based on
// it's layoutParams. We convert from Compose Modifier to
// layout params here.
val width =
if (constraints.hasFixedWidth)
LayoutParams.MATCH_PARENT
else
LayoutParams.WRAP_CONTENT
val height =
if (constraints.hasFixedHeight)
LayoutParams.MATCH_PARENT
else
LayoutParams.WRAP_CONTENT

layoutParams = LayoutParams(
LayoutParams.MATCH_PARENT,
width,
height
)

Expand Down

0 comments on commit 0554af0

Please sign in to comment.