Skip to content

Commit 0554af0

Browse files
committed
Calculate width param
1 parent 9fce9ba commit 0554af0

File tree

1 file changed

+6
-1
lines changed
  • web/src/main/java/com/google/accompanist/web

1 file changed

+6
-1
lines changed

web/src/main/java/com/google/accompanist/web/WebView.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,19 @@ fun WebView(
115115
// WebView changes it's layout strategy based on
116116
// it's layoutParams. We convert from Compose Modifier to
117117
// layout params here.
118+
val width =
119+
if (constraints.hasFixedWidth)
120+
LayoutParams.MATCH_PARENT
121+
else
122+
LayoutParams.WRAP_CONTENT
118123
val height =
119124
if (constraints.hasFixedHeight)
120125
LayoutParams.MATCH_PARENT
121126
else
122127
LayoutParams.WRAP_CONTENT
123128

124129
layoutParams = LayoutParams(
125-
LayoutParams.MATCH_PARENT,
130+
width,
126131
height
127132
)
128133

0 commit comments

Comments
 (0)