xamarin/Xamarin.Forms

XF DatePicker not working properly while DatePicker and UIDatePicker added in same page in iOS platform

Open

#7,433 opened on Sep 7, 2019

 (5 comments) (0 reactions) (0 assignees)C# (1,926 forks)batch import
help wantedp/iOS 🍎t/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

I am working in custom control. I implemented DatePicker in Xamarin.Forms, in iOS renderer file I have used UIDatePicker. While my custom DatePicker and Xamarin.Forms DatePicker added in same XAML page XF DatePicker display and picker popup values are not same always.

I tried by reverting my changes in iOS renderer and issue does not occur if UIDatePicker not initialized.

So, I found that there is conflict while DatePicker and UIDatePicker added in same page.

Steps to Reproduce

I replicated the issue in a simple sample,

  1. Run the attached sample
  2. Note DatePicker and UIDatePicker in the same page
  3. Click XF DatePicker to open popup.
  4. Note Display value and popup value are not same
  5. Change date in popup and you can see DatePicker display different date in view.

Expected Behavior

DatePicker should act as normal while DatePicker and UIDatePicker are in same page.

Actual Behavior

When I click Xamarin.Forms DatePicker display value shows the given date and popup shows different date. If I select any other date in popup it doesn't update selected value to display. But my custom DatePicker working fine as expected.

Basic Information

  • Version with issue: XF 3.6.0.344
  • IDE: Visual Studio 2017
  • Platform Target Frameworks:
    • iOS: 11
  • Affected Devices: Tested in iPhone 8 and XS max

Screenshots

Note: DatePicker dispaly 9/7/2019(September 7,2019) and popup shows August 7,2018.

image

Reproduction Link

PickerRenderer.zip

Contributor guide