[TIMOB-6152] iPad: Toggle popover
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Won't Do |
Resolution Date | 2020-01-09T19:29:43.000+0000 |
Affected Version/s | Release 2.1.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | api |
Reporter | Sindre Sorhus |
Assignee | Ingo Muschenetz |
Created | 2011-10-30T08:16:39.000+0000 |
Updated | 2020-01-09T19:29:43.000+0000 |
Description
It would be nice if there was a way to toggle the Ti.UI.iPad.Popover.
The usual usecase is that you have a button that opens the popover. If the button is clicked while the popover is visible, nothing happens, but the expected action is that the visible popover is dismissed.
Testcase
The testcase shows that if you click the button while the popover is open, nothing happens. What I would like to do is to just switch out the ".show" method with ".toggle" and then it would work as intended.
Ti.UI.backgroundColor = '#fff';
var win = Ti.UI.createWindow();
var button = Ti.UI.createButton({
title: 'Open popover',
width: 150,
height: 40
})
var popover = Ti.UI.iPad.createPopover({
height: 300,
width: 300,
backgroundColor: '#fff'
});
button.addEventListener('click', function() {
popover.show({
view: button
});
});
win.leftNavButton = button;
win.open({
modal: true
});
This could be easily solved by having a method on the popover object called ".toggle()", that will show the popover if it's not visible, otherwise hide it.
There is a [simple way of doing this](http://stackoverflow.com/questions/2642405/dismissing-ipad-uipopovercontroller-when-barbuttonitem-is-pushed-while-its-open) on StackOverflow.
A nicely-constructed ticket, Sindre - thank you for the obvious thought you put into it.
This feature would be very useful, but still haven't seen any love. If someone could take a look at this ticket, that would be awesome.
bump
bump! This has been open for a really long time with no solution. This is a good ticket, with a testcase and link to a really simple fix. I find it annoying that you would just ignore this for so long.
bump
It has been decided that this issue should be closed as “Won’t do.” This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. Updating, or creating code may not reproduce the issue reported, or be a valid test case. If community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.