Xamarin.forms: Title goes empty with Fast Renderers in Android

Created on 30 Jul 2019  路  10Comments  路  Source: xamarin/Xamarin.Forms

I am using Xamarin Forms 4.1.0.618606 with Fast Renderer. I have created a custom control for my TitleView which contains Navigation Icon, Title and an option item. Please find below code.

<?xml version="1.0" encoding="UTF-8"?>
<Grid x:Class="MyProject.Controls.TitleBarView"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:cmds="clr-namespace:Mobi.Xam.Infrastructure;assembly=Mobi.Xam.Infrastructure"
    x:Name="NavigationbarView">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition />
        <ColumnDefinition Width="Auto" />
    </Grid.ColumnDefinitions>
    <!--  Page Title  -->
    <Label Grid.Column="0"
        Grid.ColumnSpan="3"
        FontFamily="{StaticResource MediumFontFamily}"
        FontSize="Large"
        HorizontalTextAlignment="Center"
        HorizontalOptions="CenterAndExpand"
        Text="{Binding Title}"
        TextColor="{StaticResource PrimaryTextColor}"
        VerticalTextAlignment="Center" />
    <!--  Back Arow Button  -->
    <ContentView Grid.Column="0"
        IsVisible="{Binding ShowBackButton, Source={x:Reference NavigationbarView}}">
        <ContentView.GestureRecognizers>
            <TapGestureRecognizer Tapped="BackArrow_Tapped" />
        </ContentView.GestureRecognizers>
        <Image HorizontalOptions="Start"
            Margin="0,0,15,0"
            Source="{Binding BackButtonIcon, Source={x:Reference NavigationbarView}}"
            VerticalOptions="Center" />
    </ContentView>
    <!--  Toolbar Item  -->
    <ContentView Grid.Column="2"
        IsVisible="{Binding ShowToolbarItem, Source={x:Reference NavigationbarView}}"
        HeightRequest="{StaticResource ButtonHeight}"
        WidthRequest="{StaticResource ButtonHeight}">
        <ContentView.GestureRecognizers>
            <TapGestureRecognizer Tapped="ToolbarItem_Tapped" />
        </ContentView.GestureRecognizers>
        <Image HorizontalOptions="End"
            Margin="{OnPlatform Android='15,0', iOS='15,0,0,0'}"
            Source="{Binding ToolbarIcon, Source={x:Reference NavigationbarView}}"
            VerticalOptions="Center" />
    </ContentView>
</Grid>

And in my content page I am setting the TitleBar like this

NavigationPage.TitleView="{customControls:TitleBarView}">

But my issue is while navigation; The title goes empty.

With legacy renderers everything work fine. But if I enable Fast Renderers flag it stops working.

Please help.

4.0.0 fastrenderers 3 regression in-progress high impact Android bug

Most helpful comment

@soooraj I don't have an estimate for you yet, but we do prioritize regressions. We will be addressing this soon. Thank you for your patience!

All 10 comments

@soooraj Can you please attach a small project that demonstrates this issue? Thanks!

@samhouts Please find the below link to sample code.

Link to Sample

Please find the repo steps.

In the above attached sample. I have 3 pages.

  1. The title is coming perfect when I launch to First Screen.
  2. Navigate to second page (Blog Page) by clicking any of the item. The title is missing
  3. Navigate to the third page by clinking the navigate button in the bottom of page. and Title is missing
  4. Click back button - Title comes for second page.

Observe the same with Legacy Renderers - Everything working fine.

I am facing this issue after the 4.0 > update. Previously it was working fine.

@samhouts
Any ETA for this?

@soooraj I don't have an estimate for you yet, but we do prioritize regressions. We will be addressing this soon. Thank you for your patience!

@samhouts Any Update On this issue..?

This is on the backlog. Given our current set of priorities, we expect to begin working on this in mid-November. Thank you for your patience!

@samhouts Please prioritise this, Only because of this issue I cannot make use of any of the new fast renderer features.

I've tried to reproduce in our own gallery app but failed. Added it on the fix-7019 branch and asked @jsuarezruiz to have a look if I missed anything with creating the repro.

It also seems to happen with the Label. If I change the Label in the TitleBarView to a Button it shows every time.

@jfversluis @jsuarezruiz Any Progress on this issue?

@soooraj I think I have a solution, will open a PR later today :)

Was this page helpful?
0 / 5 - 0 ratings