[TIMOB-27427] iOS 13: Natively presented modal windows are not dismissed properly
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2019-10-11T14:03:24.000+0000 |
| Affected Version/s | Release 8.2.0 |
| Fix Version/s | Release 8.2.1 |
| Components | iOS |
| Labels | engSchedule |
| Reporter | Hans Knöchel |
| Assignee | Vijay Singh |
| Created | 2019-09-30T07:31:58.000+0000 |
| Updated | 2020-10-05T08:37:00.000+0000 |
Description
When using iOS 13, native modal windows like the one from
Ti.Media.showCamera are not presented correctly, causing the underlaying view controller to not be dismissed correctly.
var win = Ti.UI.createWindow();
var btn = Ti.UI.createButton({ title: 'Show camera' });
btn.addEventListener('click', () => {
Ti.Media.requestCameraPermissions(event => {
Ti.Media.showCamera({
success: () => {},
error: () => {},
cancel: () => {},
});
});
});
win.add(btn);
win.open();
This should be handled it 8.2.1!
Better test case:
var window = Ti.UI.createWindow({ backgroundColor: 'green' }); var nav = Ti.UI.createNavigationWindow({ window }) var btn = Ti.UI.createButton({ title: 'Show camera' }); btn.addEventListener('click', () => { Ti.Media.requestCameraPermissions(event => { if (!event.success) return; Ti.Media.showCamera({ success: () => {}, error: () => {}, cancel: () => {}, }); }); }); window.add(btn); nav.open({ modal: true });[~hknoechel] 1. The first test case (mentioned in description) is working fine for me. 2. In second test case, as you are trying to open navigation window modally, default presentation style in iOS 13 will be page sheet. It looks when dismissing the camera controller it takes away the controller behind it. So better is use "forceModal" property. You can use "modalStyle" also if you want full screen. See updated example-
var window = Ti.UI.createWindow({ backgroundColor: 'green' }); var nav = Ti.UI.createNavigationWindow({ window }) var btn = Ti.UI.createButton({ title: 'Show camera' }); btn.addEventListener('click', () => { Ti.Media.requestCameraPermissions(event => { if (!event.success) return; Ti.Media.showCamera({ success: () => {}, error: () => {}, cancel: () => {}, }); }); }); window.add(btn); //nav.open({ modal: true, forceModal:true}); nav.open({ modal: true, forceModal:true, modalStyle: Titanium.UI.iOS.MODAL_PRESENTATION_FULLSCREEN});Sorry, but that's just the workaround to the breaking change. Please fix this properly in the SDK.
I'll check how it behaves if we open Camera on modally presented view controller in native iOS app.
PR(master) - https://github.com/appcelerator/titanium_mobile/pull/11256 PR(8_2_X) - https://github.com/appcelerator/titanium_mobile/pull/11257 Apart from test case mentioned in this ticket need to test following test cases from TIMOB-27169 1.
2.var window1 = Ti.UI.createWindow({ title: "Modal Window", backgroundColor: 'white' }); var win = Ti.UI.createNavigationWindow({ window: window1 }); var button1 = Ti.UI.createButton({ title: 'Open Window' }); window1.add(button1); win.open(); var window2 = Ti.UI.createWindow({ backgroundColor: 'blue' }); var button2 = Ti.UI.createButton({ title: 'Close Window' }); window2.add(button2); button1.addEventListener('click', function(e){ window2.open({ modal:true, forceModal: true, }); }); button2.addEventListener('click', function(e){ window2.close(); });var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); var btn = Ti.UI.createButton({ title: 'Trigger' }); var winClose = Ti.UI.createButton({ title: 'Close' }); btn.addEventListener('click', function() { var win2 = Ti.UI.createWindow({ backgroundColor: 'white' }); win2.addEventListener('close', () => { Ti.API.warn('CLOSED') }); var nav = Ti.UI.createNavigationWindow({ window: win2 }); nav.add(winClose); nav.addEventListener('open', () => { Ti.API.warn('OPENED') }); nav.open({ modal: true }) winClose.addEventListener('click', () => { nav.close() }); }); win.add(btn); win.open();FR passed. PR on master branch merged. Waiting for build to pass on 8_2_X branch.
This caused a regression where modal windows cannot be presented fullscreen anymore. See TIMOB-27453 for details.
Verified on latest build: 8.2.1.v20191010112656. Modal window dismissed correctly. Ticked closed. This ticked causes a regression, however, as indicated above.