xamarin / XamarinCommunityToolkit

The Xamarin Community Toolkit is a collection of Animations, Behaviors, Converters, and Effects for mobile development with Xamarin.Forms. It simplifies and demonstrates common developer tasks building iOS, Android, and UWP apps with Xamarin.Forms.
MIT License
1.59k stars 477 forks source link

[Bug] Error labels do not automatically update visibility when using IPA from App Store [Xamarin.Forms iOS app] #1540

Open lukasz25pl opened 2 years ago

lukasz25pl commented 2 years ago

Description

Steps to Reproduce

  1. Download the App from app store and install it manually through Visual Studio
  2. Start sign up process

Expected Behavior

Error labels are not visible, when user starts editing text field it will become visible if xct's TextValidationBehavior returns true. Works as expected if deployed via USB cable and Visual Studio.

Actual Behavior

Error labels are visible and they do not dynamically update if the app is installed through the app store link

Basic Information

AndreiMisiukevich commented 2 years ago

try to write you your App.cs constructor

new TextValidationBehavior();

It will help linker to preserve this behavior (if it is linker's issue)

pictos commented 2 years ago

@lukasz25pl how do you use the Behavior? Is it by XAML? Are you using a ResourceDictionary for that?

lukasz25pl commented 2 years ago

@lukasz25pl how do you use the Behavior? Is it by XAML? Are you using a ResourceDictionary for that?

Yes, sorry for the late response - got swamped at work.

Yes, I am using ResourceDictionary. ResourceDictionary changes the color of the entry while users enters, for example, their email, regex reads it, changes the entry color to red at first (in the entry) and then once it works with regex and validator validates it - it changes to green.

All works as intended when app is installed on any of my test devices through the USB, but when downloaded from app store it does not behave as intended.

lukasz25pl commented 2 years ago

try to write you your App.cs constructor

new TextValidationBehavior();

It will help linker to preserve this behavior (if it is linker's issue)

Hi! I'll be releasing an update, going to add this in App.cs, could you tell me if location matters for it or top of main App() method works?

AndreiMisiukevich commented 2 years ago

@lukasz25pl no, location doesn't matter

Even this will be fine somewhere in code (don't change it to if (false) !

  if (DateTime.Now.Ticks < 0)
      new TextValidationBehavior();
lukasz25pl commented 2 years ago

@lukasz25pl no, location doesn't matter

Even this will be fine somewhere in code (don't change it to if (false) !

  if (DateTime.Now.Ticks < 0)
      new TextValidationBehavior();

Alrighty going to give it a try and report back within a day or two!

lukasz25pl commented 2 years ago

@lukasz25pl no, location doesn't matter

Even this will be fine somewhere in code (don't change it to if (false) !

  if (DateTime.Now.Ticks < 0)
      new TextValidationBehavior();

Hi!

I followed your advice, unfortunately the problem persists. Labels are still visible even though binding in xamarin forms should have them off (that works in Debug mode). Linker behavior set to Link Framework SDKs. Any ideas or should I look into implementing a different package in my solution ASAP?

Quick update - funny enough, the color of the input changes from green to red as intended now. So the validator does bind dynamically (I think)

AndreiMisiukevich commented 2 years ago

@lukasz25pl can you build a small sample reproducing this issue? That's weird, it sounds like bindings don't work (what is unlikely).

Do you bind to the "IsNotValid" property? You also can try to bind to the "IsValid" property with using InvertedBoolConverter

lukasz25pl commented 2 years ago

@lukasz25pl can you build a small sample reproducing this issue? That's weird, it sounds like bindings don't work (what is unlikely).

Do you bind to the "IsNotValid" property? You also can try to bind to the "IsValid" property with using InvertedBoolConverter

@AndreiMisiukevich

so here's my label:

<Label Margin="24,0,24,0" HorizontalOptions="Start" HorizontalTextAlignment="Start" TextColor="#9b3737" FontSize="Micro" FontAttributes="None" IsVisible="{Binding IsNotValid, Source={x:Reference CaddieRate_Validator}}" Text="Enter a value between 1 and 1000 and use only up to two decimal places"/>

and for this validator the entry is constructed as: `<control:BorderlessEntry x:Name="entry_amountToPayout" BackgroundColor="#00FFFFFF" Margin="12,0,12,0" VerticalOptions="Fill" FontSize="Small" FontAttributes="Bold" TextColor="#000000" Keyboard="Numeric" Placeholder="00.00">

` Now all that works in any deployment through USB, unfortunately the behavior changes when app is downloaded form the app store. Let me know what you think
AndreiMisiukevich commented 2 years ago

@lukasz25pl that's so weird. Last idea. Can you set "Do not link" for release mode and test it... Because we don't have any check like "if release then work incorrectly" )

pictos commented 2 years ago

@lukasz25pl that's so weird. Last idea. Can you set "Do not link" for release mode and test it... Because we don't have any check like "if release then work incorrectly" )

Or in DEBUG mode set the linker to the same value that's used in the release.

@lukasz25pl Sorry but you snippet isn't that useful, like, how do you implement your BorderlessEntry? How are your ViewModels, and so on... Is very hard to guess what's going on there. Said that, if after the last try suggested by me and @AndreiMisiukevich doesn't give us a good idea about what's going on, could provide a small repro? That will help us to help you (:

Luiz-Franco commented 2 years ago

I'm also having the same issue. Only the version published on AppCenter behave incorrectly.

I tried enabling link locally and it still works as intended.

Next I'll try using IsValid with InvertedBoolConverter. As soon as the AppCenter version is available I'll be back with the result.

Luiz-Franco commented 2 years ago

I just tested the AppCenter version and its working as expected.

Perhaps the problem is with how IsNotValid is set inside the behavior.