[TIMOB-23771] iOS10: Support preview interactions
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Medium |
| Status | Closed |
| Resolution | Done |
| Resolution Date | 2018-02-13T09:02:16.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | iOS |
| Labels | ios10, peekandpop |
| Reporter | Hans Knöchel |
| Assignee | Vijay Singh |
| Created | 2016-08-14T22:15:17.000+0000 |
| Updated | 2018-08-06T17:34:50.000+0000 |
Description
*strong text*In iOS 10, developers can build their own peek-and-pop transitions by implementing the
[UIPreviewInteraction](https://developer.apple.com/reference/uikit/uipreviewinteraction) class. It provides delegates to handle the current process and lets the user decide whether or not the user should commit from peek to pop or not (nice rhyme).
We should create a module for this as this is iOS specific feature. APIs will be like as mentioned in below code -
[~hknoechel] Do you have anything to add here? Thanks!var TiPreviewInteraction = require('ti.previewinteraction'); var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); var previewInteraction = TiPreviewInteraction.createPreviewInteraction(); var view = Ti.UI.createView({ backgroundColor : 'blue', height: 200, width : 200, previewInteraction: previewInteraction }); previewInteraction.addEventListener('peek', function(e) { Ti.API.info(e.progress); Ti.API.info(e.ended); Ti.API.info(e.touchPoint.x); Ti.API.info(e.touchPoint.y); if (e.progress > .8) { previewInteraction.cancelInteraction(); } }); previewInteraction.addEventListener('pop', function(e) { Ti.API.info(e.progress); Ti.API.info(e.ended); Ti.API.info(e.touchPoint.x); Ti.API.info(e.touchPoint.y); }); previewInteraction.addEventListener('cancel', function(e) { Ti.API.info('Cancelled'); }); win.add(view); win.open();[~vijaysingh] As discussed, let's make it a TiViewProxy extension inside a module and go with that. I've updated the above PoC accordingly.
ti.previewinteraction module - https://github.com/vijaysingh-axway/ti.previewinteraction
Module released! https://github.com/appcelerator-modules/ti.previewinteraction Resolving ticket.
Closed as completed. If this is in error, please reopen.