Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23771] iOS10: Support preview interactions

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionDone
Resolution Date2018-02-13T09:02:16.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsios10, peekandpop
ReporterHans Knöchel
AssigneeVijay Singh
Created2016-08-14T22:15:17.000+0000
Updated2018-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).

Comments

  1. Vijay Singh 2018-01-24

    We should create a module for this as this is iOS specific feature. APIs will be like as mentioned in below code -
       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();
       
       
    [~hknoechel] Do you have anything to add here? Thanks!
  2. Hans Knöchel 2018-01-29

    [~vijaysingh] As discussed, let's make it a TiViewProxy extension inside a module and go with that. I've updated the above PoC accordingly.
  3. Vijay Singh 2018-02-12

    ti.previewinteraction module - https://github.com/vijaysingh-axway/ti.previewinteraction
  4. Hans Knöchel 2018-02-13

    Module released! https://github.com/appcelerator-modules/ti.previewinteraction Resolving ticket.
  5. Eric Merriman 2018-08-06

    Closed as completed. If this is in error, please reopen.

JSON Source