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

Weird appearance on IOS #66

Open
ederjbezerra opened this issue Sep 9, 2022 · 6 comments
Open

Weird appearance on IOS #66

ederjbezerra opened this issue Sep 9, 2022 · 6 comments
Labels
awaiting-author Awaiting a respose from the author bug Something isn't working ios

Comments

@ederjbezerra
Copy link

ederjbezerra commented Sep 9, 2022

I'm comparing Android and iOS(14.4.2 Iphone 8 plus) layout side by side, and here is how they look:

image

image

The funniest thing is that when I turn the phone to horizontal, it fix the problem, then when I turn back to vertical again, it keep the layout problem fixed! How can I solve this? I'm using the simplest code sample that I found on github docs:

<StackLayout>
        <xcViews:CalendarView
            x:Name="CalendarViewElement" 
         Days="{Binding Calendar.Days}"
        DaysOfWeek="{Binding Calendar.DayNamesOrder}"
        NavigatedDate="{Binding Calendar.NavigatedDate}"
         DayNameHorizontalSpacing="1"
        />
</StackLayout>

UPDATE

Simulating on iphone 13(ios 15)

At first moment:

Captura de Tela 2022-09-09 às 18 49 31

After turn to horizontal:

Captura de Tela 2022-09-09 às 18 49 41

Back again to vertical:

Captura de Tela 2022-09-09 às 18 49 57

@ME-MarvinE ME-MarvinE added bug Something isn't working ios labels Sep 9, 2022
@ME-MarvinE
Copy link
Owner

ME-MarvinE commented Sep 9, 2022

It looks like when the CollectionView containing the DaysOfWeek doesn't have enough space, it moves the items to the next row.

I think this is because the ItemsLayout in CalendarView line 73, is set to a GridItemsLayout with an Orientation of Vertical instead of Horizontal. The Span is equal to the amount of days in the week so it should never shrink to 3-day rows if there are 7 for example.

I'll look at this more closely in the next few days but if you are desperate, or want to try and fix the issue in the meantime, you can always set the DayNamesTemplate property of the CalendarView to a control template with your own view.

Do you know if this issue was present in earlier versions or was it introduced in 4.1.0?

@ME-MarvinE
Copy link
Owner

ME-MarvinE commented Dec 23, 2022

   Can you try using a CollectionView instead of a CalendarView and see if the issue still occurs?

<CollectionView ItemsSource="{Binding Calendar.Days}"> 

    <CollectionView.Resources> 
        <System:Boolean x:Key="TrueValue">True</System:Boolean> 
        <xct:IsNotNullOrEmptyConverter x:Key="IsNotNullOrEmptyConverter"/> 
    </CollectionView.Resources> 

    <CollectionView.ItemTemplate>
        <DataTemplate x:DataType="{x:Type xcInterfaces:ICalendarDay}"> 
            <ContentView> 
                <Frame 
                    Margin="2.5" 
                    Padding="0" 
                    CornerRadius="100" 
                    HasShadow="False"> 
                    <xc:DayView 
                        DateTime="{Binding DateTime}" 
                        IsCurrentMonth="{Binding IsCurrentMonth}" 
                        IsInvalid="{Binding IsInvalid}" 
                        IsSelected="{Binding IsSelected}" 
                        IsToday="{Binding IsToday}"/> 
                </Frame> 
            </ContentView> 
        </DataTemplate> 
    </CollectionView.ItemTemplate> 
  
    <CollectionView.ItemsLayout> 
        <GridItemsLayout Orientation="Vertical" Span="{Binding Calendar.DayNamesOrder.Count}"/> 
    </CollectionView.ItemsLayout> 
  
</CollectionView>

@ME-MarvinE ME-MarvinE added the awaiting-author Awaiting a respose from the author label Jan 6, 2023
@deejcoder
Copy link

I only get it when using a CarouselView for a swipable calendar. Regardless of using a CollectionView as suggested above, or the CalendarView, I observe the same behaviour. I'm also observing weird behaviour where the calendar keeps swiping across in UWP.

The SelectionPageExample works fine.

@ME-MarvinE
Copy link
Owner

ME-MarvinE commented Jan 24, 2023

The code is cross-platform so if it works properly on Android or in a console app then it should work properly on IOS; if you were able to reproduce it with just a CollectionView then it seems the bug is caused by the CollectionView.

@ME-MarvinE
Copy link
Owner

ME-MarvinE commented Jan 24, 2023

Last test would be to replace the DayView in the CollectionView's ItemTemplate with a Label to see if the issue is caused by the DayView.

<DataTemplate x:DataType="{x:Type xcInterfaces:ICalendarDay}"> 
    <ContentView> 
        <Frame 
            Margin="2.5" 
            Padding="0" 
            CornerRadius="100" 
            HasShadow="False"> 

            <Label Text="{Binding DateTime.Day}"/>

        </Frame> 
    </ContentView> 
</DataTemplate> 

@ME-MarvinE ME-MarvinE changed the title Weird appearance on iOS Weird appearance on IOS Mar 17, 2023
@ME-MarvinE
Copy link
Owner

ME-MarvinE commented May 12, 2023

May have been fixed by dotnet/maui#13137 if this is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author Awaiting a respose from the author bug Something isn't working ios
Projects
None yet
Development

No branches or pull requests

3 participants