'iOS picker appears behind the sheet

Oenter image description heren iOS devices and the simulator if a picker is selected from a sheet window the picker option appears behind the sheet.

Sheet sheet = new Sheet(null, "My Sheet");
sheet.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

Picker p_fromDate = new Picker();
p_fromDate.setType(PICKER_TYPE_DATE);

sheet.add(p_fromDate);

sheet.show();

I have also added this to github issues https://github.com/codenameone/CodenameOne/issues/3588

Is there a simple work around in the mean time? The virtual keyboard is not affected in this way by I'd prefer to keep the picker if possible.



Solution 1:[1]

TL;DR: I suggest reworking the UI to avoid prompting for input in a Sheet.

Unfortunately the Picker lightweight mode is a Dialog which is just displayed on top of the current Form. Sheet resides in a pane above the current Form and is a separate interaction altogether. They aren't compatible.

I don't think it's something we can change (at least not easily). Besides breaking compatibility (which is something we can workaround) the main problem is solving this.

A layered pane has order. So a Sheet is in one layer. That makes sense. In your case you want the Sheet below the Picker but if we create a Picker and then show a sheet on top of that this will be a problem. We have no flexible way we can use to manipulate that.

You only see this on iOS since Android native pickers are native widgets which are always on top of everything.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shai Almog