0

I've a following XAML which works in Android, but not in iOS:

<ScrollView HorizontalScrollBarVisibility="Never">
            <Grid RowDefinitions="Auto,*">
                <Label Text="{Binding subject}" Grid.Row="0"/>
                <WebView x:Name="WebView" Grid.Row="1">
                   <WebView.Source>
                      <HtmlWebViewSource Html="{Binding html}"/>
                   </WebView.Source>
            </WebView >
</ScrollView>

Looks like in iOS WebView is not auto sizing to it's contents, but does in Android. If I add HeightRequest to WebView in iOS to some big number then it scrolls fine.

So question is why WebView in Android is sized correctly, but not in iOS? Can this be fixed somehow?

Sample video in iOS:

enter image description here

Sample video in Android:

enter image description here

2
  • 1
    This is big problem for MAUI team from day one. I had crashes on scroll view and collection view, from bad measure logic, especially if there is some sort of image inside. I would advise you to run java script inside the webview, that will measure the content, and then resize the control, based on the value you got. Or fill your program with magic numbers, for example "Height = 1000". (I pick the second path.) Commented Jun 11 at 17:50
  • Thank you. I had it working perfectly in Xamarin using java script method, but for some reason same code doesn't work in Maui in iOS, "DidReceiveScriptMessage" never gets called, might need to revisit and try again. Commented Jun 12 at 5:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.