Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16418] iOS: Scrollableview forces a reload of webview every single time that a view is added

GitHub Issuen/a
TypeStory
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsiOS
LabelsSupportTeam
ReporterMauro Parra-Miranda
AssigneeUnknown
Created2014-02-07T00:31:26.000+0000
Updated2018-02-28T20:03:48.000+0000

Description

Problem Description

If you have webviews in your scrollableview, they will reload every time any other view is added to the scrollableview. Can we try not to reload the webviews already there?

Code Sample

var win = Ti.UI.createWindow({
	backgroundColor : 'white'
});

var scrollableview = Ti.UI.createScrollableView({
	top : 0,
	height : 300,
	cacheSize : 10,
	showPagingControl:true,
	backgroundColor:'white',
});

var webview = Ti.UI.createWebView({
	html : '<html><head></head><body><script>var now = Date.now(); document.body.innerHTML = now;</script></body></html>',
	top : 0,
	height : 300
});

webview.addEventListener('load', function() {
	alert('The webview is loaded!');
});

var b = Ti.UI.createButton({
	title : "add new view",
	top : 400
});
b.addEventListener("click", function() {
	scrollableview.addView(Ti.UI.createView({
		html : '<html><head></head><body bgcolor="white">hola!</body></html>',
		top : 0,
		height : 300
	}));
});

win.add(scrollableview);
scrollableview.addView(webview);
win.add(b);
win.open(); 

Steps to reproduce

1. Create a new mobile (classic) project. 2. Paste the testcase to app.js 3. Run in simulator iOS 4. Click on the button to add a second view. 5. You will get an alert that the webview reloaded.

Extra info

Q&A Link: http://developer.appcelerator.com/question/162289/is-it-possible-to-prevent-webviews-on-scrollableview-from-reloading-when-adding-new-views-to-the-scrollableview

Comments

No comments

JSON Source