[TIMOB-28443] iOS: ScrollView setZoomScale()/setContentOffset() methods crash as of 10.0.0
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2021-05-10T19:32:28.000+0000 |
| Affected Version/s | Release 10.0.0 |
| Fix Version/s | Release 10.0.0 |
| Components | iOS |
| Labels | ScrollView, contentOffset, ios, regression, zoom |
| Reporter | Hans Knöchel |
| Assignee | Joshua Quick |
| Created | 2021-05-07T20:27:35.000+0000 |
| Updated | 2021-05-10T19:32:28.000+0000 |
Description
See the following test case:
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
var scrollView = Ti.UI.createScrollView({
contentWidth: 'auto',
contentHeight: 'auto',
top: 0,
bottom: 0,
backgroundColor: 'black',
showVerticalScrollIndicator: false,
showHorizontalScrollIndicator: false,
maxZoomScale: 3,
minZoomScale: 1,
zoomScale: 1,
disableBounce: true
});
var content = Ti.UI.createImageView({ image: Ti.UI.createView({ width: 100, height: 100, backgroundColor: 'red', zoomScale: 1 }).toImage() });
scrollView.addEventListener('doubletap', () => {
console.warn('Zoom!')
scrollView.setZoomScale((scrollView.zoomScale === 1) ? 2 : 1, {
animated: true
});
});
scrollView.add(content);
win.add(scrollView);
win.open();
Works fine on SDK 9.3.2, throws an error and does not work on SDK 10:
[ERROR] /app.js:23
[ERROR] scrollView.setZoomScale(scrollView.zoomScale === 1 ? 2 : 1, {
[ERROR] ^
[ERROR] TypeError: scrollView.setZoomScale is not a function. (In 'scrollView.setZoomScale(scrollView.zoomScale === 1 ? 2 : 1, {
[ERROR] animated: true })', 'scrollView.setZoomScale' is undefined)
The
ScrollView.setContentOffset()method is busted too. This looks like a negative consequence of our remove of getter/setter methods. I'll need to double check how we keptWebView.setHtml()support on iOS and do the same onScrollView.PR (master): https://github.com/appcelerator/titanium_mobile/pull/12788
merged to master and 10_0_X