[TIMOB-10280] iOS: View: Hiding a view do not shifts all the views below, up on the screen.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-01-24T09:27:11.000+0000 |
Affected Version/s | Release 2.1.1 |
Fix Version/s | Release 3.0.2, Release 3.1.0, 2013 Sprint 01 Core, 2013 Sprint 01 |
Components | iOS |
Labels | core, module_views, qe-ios070112, qe-testadded, regression |
Reporter | Shyam Bhadauria |
Assignee | Max Stepanov |
Created | 2012-08-01T02:34:47.000+0000 |
Updated | 2013-02-20T21:12:00.000+0000 |
Description
This is a regression. It works fine on 2.1.0.
Steps to reproduce
1. Use the app below
var win = Ti.UI.createWindow({backgroundColor:'black'});
var scrollView = Ti.UI.createScrollView({
layout:'vertical',
contentHeight:'auto',
top:0,bottom:0,left:0,right:0
});
win.add(scrollView);
win.open();
var len = 2;
for(var i = 0; i < len; i++){
scrollView.add(
Ti.UI.createView({
top:5,
left:20,
right:20,
backgroundColor:'white',
height:80
})
);
}
var magicView = Ti.UI.createView({
top:5,
left:30,
right:30,
backgroundColor:'red',
height:100
});
var viewThatWillGetPushedToTheTop = Ti.UI.createView({
top:5,
left:30,
right:30,
backgroundColor:'green',
height:100
});
scrollView.add(magicView);
scrollView.add(viewThatWillGetPushedToTheTop);
for(var i = 0; i < len; i++){
scrollView.add(
Ti.UI.createView({
top:5,
left:20,
right:20,
backgroundColor:'white',
height:80
})
)
}
scrollView.add(Ti.UI.createView({backgroundColor:'blue',height:100,top:10}))
setTimeout(function(){
magicView.hide();
viewThatWillGetPushedToTheTop.top -= magicView.height
},4000);
2) Run the app on iOS simulator
Expected result:
1) Should see a simple window with a scrollView. In the scrollView there are two white views, a red view, a green view, two more white views, and a blue one. After a 4 second timer, the red view is removed and the green view along with all the below white and blue views are pushed up. When this happens, the blue one (which is 100px height) should not cut off at the middle.
Actual result:
1) A simple window with a scrollView is displayed. In the scrollView there are two white views, a red view, a green view, two more white views, and a blue one. After a 4 second timer, the red view is removed and the green view is pushed up. When this happens, the blue one (which is 100px height) is not cut off at the middle. But the white views (which are below green view) and the blue view are not moved up after removal to red view.
On further investigation, found that this issue is not reproducible every time. It occurs at random. Most of the time,it works as expected.I encountered it on the first run of the app and then only a couple of times in next 20 runs.
Possibly a race condition on layout.
This seems like vertical layout issue , where relayout is not getting triggered properly when the middle view is changing its layout values. Reassigning this ticket to the core team.
I can't reproduce this in either 3_0_X or master. Might have gotten fixed with other scroll view fixes. Does occur on the 2_1_X branch though
@Vishal, i have an idea i'm trying to verify
Proposed PR https://github.com/appcelerator/titanium_mobile/pull/3667
Tested with: SDK:3.1.0.v20130114171802 Studio:3.0.1.201212181159 Device: iPad2(v 5.1), iPhone3GS(v 5.0.1), iPhone5(v 6.0), iPhone4s(v 5.1)
Reopening to add comments Backport Task TIMOB-12317 Backport PR https://github.com/appcelerator/titanium_mobile/pull/3749
Reopening to update labels