maui-demos icon indicating copy to clipboard operation
maui-demos copied to clipboard

Issue with SfSignaturePad in iOS Unable to Sign When ScrollView is Active

Open Divyesh-Bhatt opened this issue 1 year ago • 1 comments

<ScrollView>
    <Grid RowDefinitions="Auto, Auto, *, Auto">
    <!--Other controls-->    

    <Border
        Grid.Row="2"
        Stroke="#D2D2D2"
        StrokeShape="RoundRectangle"
        StrokeThickness="{OnPlatform Default=0.5, iOS=1}">
                <sp:SfSignaturePad
                    x:Name="_sfSignaturePad"
                    BackgroundColor="White"
                    DrawCompleted="OnDrawCompleted"
                    MaximumStrokeThickness="{OnPlatform Android=5, iOS=6, WinUI=2.5}"
                    MinimumStrokeThickness="{OnPlatform Android=3, iOS=4, WinUI=1.5}"
                    StrokeColor="#000000" />
    </Border>

    <!--Other controls-->    

    </Grid>

</ScrollView>

Now when I'm rotating the Device in landscape mode the scroll will get active for page, that time when try to sign in SfSignaturePad in iOS its not working, because its considering it as scroll. This happens in portrait mode as well in iOS if page have enough content to make the scrollview scroll active.

So as a work around for this I have added trigger in scrollview like this:

<ScrollView.Triggers>
    <DataTrigger TargetType="ScrollView" Binding="{Binding Path=IsSignaturePadVisible}" Value="True">
        <Setter Property="Orientation" Value="Neither"/>
    </DataTrigger>
    <DataTrigger TargetType="ScrollView" Binding="{Binding Path=IsSignaturePadVisible}" Value="False">
        <Setter Property="Orientation" Value="Vertical"/>
    </DataTrigger>
</ScrollView.Triggers>

But this will not resolve the issue for landscape mode, because in that case the scroll will get disabled. If I remove the trigger logic than scrolling will work but will not able to draw signature in SfSignaturePad in iOS.

Here is the POC that reproduces the bug. signaturepad issue.zip

Run the app in the iOS and than rotate device in Landscape mode. Try to draw the signature, with vertical stroke and notice the bug.

Divyesh-Bhatt avatar Jun 21 '24 10:06 Divyesh-Bhatt

@SuthiYuvaraj do you have idea about this?

Divyesh-Bhatt avatar Jun 24 '24 06:06 Divyesh-Bhatt