[TIMOB-23477] iOS: ScrollableView with embedded ScrollView freezes after zooming the scrollview
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Resolved |
Resolution | Cannot Reproduce |
Resolution Date | 2017-01-19T14:17:12.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Tim Poulsen (ACV) |
Assignee | Hans Knöchel |
Created | 2016-06-03T19:52:25.000+0000 |
Updated | 2017-01-19T14:36:54.000+0000 |
Description
Seen on iOS only
We're attempting to replicate the photo-viewing experience of the native photos app. We use a ScrollableView, with embedded ScrollViews, each with an image so that the user can swipe between photos, then pinch-to-zoom on the photos. We reset the zoom scale to 1 if the user swipes to the next/previous photo.
However, we have found the ScrollableView freezes randomly. Using the sample code below, you can reproduce with the following steps:
Swipe forward a photo or two
Pinch to zoom in
Swipe back to the previous photos (aka, to the left)
Swipe forward / right
Not every time, but frequently the ScrollableView is now stuck. You can't swipe to the next or previous image in the set. The view bounces a bit, but won't scroll. No log output or errors are seen in the console. It's as if the ScrollableView no longer receives the swipe gesture. Zooming in then out "un-sticks" it, which is not reasonable to expect our users to discover.
If it doesn't freeze, repeat the steps above. It sometimes freezes if you swipe forward (to the right) after zooming a photo also.
var currentPage = 0,
deviceWidth = Ti.Platform.displayCaps.platformWidth;
var win = Titanium.UI.createWindow({
title: 'Tab 1',
backgroundColor: '#000',
navBarHidden: true,
fullscreen: true
});
var sav = Ti.UI.createScrollableView();
win.add(sav);
var photos = [
"https://s3.amazonaws.com/static-uat.acvauctions.com/vehicle_photos/AL1VP9Ng5N.jpg",
"https://s3.amazonaws.com/static-uat.acvauctions.com/vehicle_photos/4xdHX5gCpF.jpg",
"https://s3.amazonaws.com/static-uat.acvauctions.com/vehicle_photos/3T0ZeAED7m.jpg",
"https://s3.amazonaws.com/static-uat.acvauctions.com/vehicle_photos/D6imFFILV8.jpg",
"https://s3.amazonaws.com/static-uat.acvauctions.com/vehicle_photos/hn5Ia8Zvof.jpg",
"https://s3.amazonaws.com/static-uat.acvauctions.com/vehicle_photos/6BcuYSToU9.jpg",
"https://s3.amazonaws.com/static-uat.acvauctions.com/vehicle_photos/DpQlIzHfE1.jpg",
"https://s3.amazonaws.com/static-uat.acvauctions.com/vehicle_photos/l0TndCtDnf.jpg",
"https://s3.amazonaws.com/static-uat.acvauctions.com/vehicle_photos/tVq0HjMPBh.jpg",
"https://s3.amazonaws.com/static-uat.acvauctions.com/vehicle_photos/9CKlRimn_G.jpg",
"https://s3.amazonaws.com/static-uat.acvauctions.com/vehicle_photos/auekHpHf1Z.jpg"
];
photos.forEach(function (picURL) {
var zoomView = Ti.UI.createScrollView({
height: Ti.UI.FILL,
width: Ti.UI.FILL,
zoomScale: 1,
maxZoomScale: 5,
minZoomScale: 1,
contentHeight: Ti.UI.SIZE,
contentWidth: Ti.UI.SIZE,
top: 0,
left: 0,
disableBounce: false,
backgroundColor: 'black'
});
zoomView.add(Ti.UI.createImageView({
image: picURL,
width: deviceWidth,
height: deviceWidth,
left: 0
}));
sav.addView(zoomView);
});
function onScroll(event) {
if (!event || isNaN(event.currentPage)) {
console.log('no event / currentPage');
return;
}
currentPage = event.currentPage;
if (sav.views[currentPage - 1]) {
resetZoom(currentPage - 1);
}
if (sav.views[currentPage + 1]) {
resetZoom(currentPage + 1);
}
}
sav.addEventListener("scrollend", onScroll);
sav.addEventListener("doubletap", function () {
resetZoom(currentPage);
});
function resetZoom(pageNum) {
if (sav.views[pageNum].apiName === "Ti.UI.ScrollView" && sav.views[pageNum].zoomScale !== 1) {
sav.views[pageNum].zoomScale = 1;
}
}
win.open();
So the following code does work and does not crash:
Will check yours
Hi [~hansknoechel] Is this still an issue or is it resolved? Thx !
The test code from Hans above does not match the scenario I posted in the original ticket & example. It does _not_ resolve this ticket nor show that the issue is invalid.
Hey Tim, sorry for the delay. Just re-tested your example as well (using 5.4.0 and 6.0.0) and cannot reproduce it at all. Please see [this video](https://www.dropbox.com/s/u0fwxtd3nxl0sco/TIMOB-23477.mov?dl=0) for some visual interaction. I'd like ask you to recheck with the above SDK's and ensure that it's not something at your end. I will try to get the QE to test it as well, but currently it does not look like an SDK-issue. Thanks!
Hans, using the code posted above, I'm still able to reproduce. Using SDK 5.2.2.GA and 5.4.0.GA with Alloy 1.9.0 on an iPhone 5 running iOS 9.3.4. Steps are: cold launch app, swipe forward one pic, zoom in, don't zoom back out and swipe backward, swipe forward, try to swipe again but the app will be frozen. The app doesn't freeze every time, but does a lot of the times I've tested.
Hey Tim, can you provide the tiapp you use? (especially if you have
use-autolayout
and/orrun-on-main-thread
enabled.[~hansknoechel] we do not use either
use-autolayout
orrun-on-main-thread
. Is there a way to send you the tiapp securely? I don't want to release keys or guids that would compromise our app. Maybe something through the Axway support portal or PM me your email on TiSlack or something (I'm there as skypanther). ? Here's the ios section if it helps:Hi [~timpoulsen]: You can send tiapp to us over support portal. The current ticket is INC0379874. I will send you an email from our support portal and you can send the app then as attachment which i can share it with [~hansknoechel].
I tested with this environment: NPM Version: 2.15.9 Node Version: 4.5.0 Mac OS: 10.12.1 Appc CLI: 6.1.0 Appc CLI NPM: 4.2.8 Titanium SDK version: 6.0.1.GA Appcelerator Studio, build: 4.8.1.201612050850 Xcode 8.2 iOS Device: 10.0 I was not able to reproduce the issue with SDK 6.0.1 GA. I used the demo code provided in the description. When I zoomed in, I was able to scroll either left or right consistently. To see if I could reproduce it with an older build, I tried it with SDK 5.5.0 GA, and was able to reproduce the issue. When I zoomed in, ScrollView would get "stuck", and the only way to scroll to a different picture was to zoom back out. However, as I first stated, with the latest SDK 6.0.1 and CLI 6.1.0, I am not able to reproduce the issue.
Based on [~amukherjee]s finding, I'm resolving this ticket for now. Tim, please let me know if it still persists for you, then we may need to update our test-cases in revisit it again. Thanks everyone!
Thanks and sorry for the slow follow-up. We removed this feature from our app because of the bug. Users are pretty accustomed to the current functionality so I haven't made it a priority to add this back in. Other fish to fry, as the saying goes.