iOS datepicker error

109 views
Skip to first unread message

Emma Wedi

unread,
May 26, 2021, 4:56:56 AM5/26/21
to CodenameOne Discussions
Hello,
Am trying to implement ios datepicker(spinner) but it does not work but rather
displays a button on which you have to tap before the picker displays in the form of a modal.
Please any help on implementing ios native spinner datepicker
Thank you
Attached are images to demonstrate
WhatsApp Image 2021-05-25 at 15.40.26.jpeg
WhatsApp Image 2021-05-25 at 15.40.56.jpeg

Javier Anton

unread,
May 26, 2021, 12:46:22 PM5/26/21
to codenameone...@googlegroups.com
Hi,

This should work, I think
        Form hi = new Form("Test", new BorderLayout());
        Container center = new Container(BoxLayout.y());
        Picker startDateTimePicker = new Picker();
        startDateTimePicker.setType(Display.PICKER_TYPE_DATE_AND_TIME);
        startDateTimePicker.setDate(new Date());
        center.add(startDateTimePicker);
        hi.add(BorderLayout.CENTER, center);
        hi.show();

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/2b44c0b2-6667-4cb3-a13b-fa735cc64ec8n%40googlegroups.com.

Shai Almog

unread,
May 26, 2021, 9:56:27 PM5/26/21
to CodenameOne Discussions
We don't support showing the picker without the button first. It's an API we used to have but there are portability issues involved since picker acts very differently when running on different OSs.

Emma Wedi

unread,
May 27, 2021, 10:22:23 AM5/27/21
to codenameone...@googlegroups.com
When building with xcode 11.3, the datepicker works perfectly fine but when the build is done with 14.2 the datepicker malfunctions and apple needs builds to be done with 14 and above before it can be pushed to the appstore


You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/rSTsfSYS5kA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/8db11869-ecda-41c5-8fc2-bc4d6c0ba17fn%40googlegroups.com.

Shai Almog

unread,
May 28, 2021, 12:06:15 AM5/28/21
to CodenameOne Discussions
We changed the default on iOS to be the lightweight picker which should resolve this issue.

Emma Wedi

unread,
May 28, 2021, 7:03:15 AM5/28/21
to CodenameOne Discussions

Hello,
We are having issues implementing the lightweight picker and would like to 
implement native ios pickers in the application.
Could you please reconfigure your services to accept native ios pickers.
Thank you

Shai Almog

unread,
May 29, 2021, 12:57:13 AM5/29/21
to CodenameOne Discussions
Hi,
Native pickers break with every release of iOS. As a result we deprecated them on iOS. I'm not sure if we'll fix them.
Our picker has a calendar mode which might be more similar to what you're trying to achieve.

You can explicitly force native pickers to work by invoking the set default method on the picker but I would recommend against it.

bsystems limited

unread,
May 31, 2021, 3:58:51 AM5/31/21
to codenameone...@googlegroups.com
Hello Shai,
Thank you for the reply.
Implementing the codename one picker does not give us buttons to accept the value chosen.
Image reference below, How do we get the buttons to display 

WhatsApp Image 2021-05-31 at 07.56.44.jpeg

Steve Hannah

unread,
May 31, 2021, 8:29:59 AM5/31/21
to codenameone...@googlegroups.com
That's strange.  I've looked through the code and don't see any path that would result in the "Done" and "Cancel" buttons not appearing.  Does this problem only show up on device, or can you reproduce in the simulator.  If you can reproduce in the simulator, then take a look in the Component inspector and see if the buttons appear.  

image.png

Notice the "PickerButtonBar" container, and the "PIckerButton" buttons there.  

All I can think is that your theme is overriding the color, font or size of the PickerButton UIID (which extends Button).  Try explicitly setting the style on PickerButton to something that would stand out.





--
Steve Hannah
Software Developer
Codename One
Reply all
Reply to author
Forward
0 new messages