xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.63k stars 1.88k forks source link

[Bug] Xamarin.Forms.Visual.Material Android bug - all fields get updated with the same value from the last input on the page after switching tabs #14324

Open stevenmanuel opened 3 years ago

stevenmanuel commented 3 years ago

Description

On Android, all Material fields (such as Entry) get updated with the same value from the last field on the page after switching tabs https://docs.microsoft.com/en-us/answers/questions/421594/xamarinformsvisualmaterial-android-bug-all-fields.html

Steps to Reproduce

  1. Create a Xamarin Forms solution with Shell - this will generate ItemsPage and ItemDetailPage automatically, and two tabs (Browse and About)
  2. Introduce at least two data-bound Entry elements on ItemDetailPage with Visual="Material"
  3. Run it in Android emulator
  4. When the app is loaded, select one item from the list page (ItemsPage). This will display the detail page with the Entry elements populated with existing values.
  5. Switch to the About tab, and then switch back to the Browse tab
  6. Now all the Entry values have changed to the same value as the last entry on the page

`

<Label Text="Description:" FontSize="Medium" />
<Entry Text="{Binding Description}" Visual="Material" />

 <StackLayout>
     <Label Text="Date &amp; Time" FontSize="Default" />
     <StackLayout Orientation="Horizontal">
         <DatePicker        
             Format="dd/MM/yyyy"                                     
             HorizontalOptions="FillAndExpand"
             Visual="Material"/>
         <TimePicker                                            
             Format="HH:mm"
             HorizontalOptions="FillAndExpand"
             Visual="Material"/>
     </StackLayout>
 </StackLayout>

 <Label Text="Text:" FontSize="Medium" />
 <Entry Text="{Binding Text}" Visual="Material" />

`

Expected Behavior

Field values should not be changed after switching tabs

Actual Behavior

Field values are changed after switching tabs

Basic Information

Screenshots

image image

Workaround

Remove Material visual

stevenmanuel commented 3 years ago

Also reported in https://github.com/xamarin/Xamarin.Forms/issues/14185