[AC-6724] iOS 15: Glitch in headerview when creating ListView
GitHub Issue | n/a |
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | ios-15 |
Reporter | Jonas Funk Johannessen |
Assignee | Abir Mukherjee |
Created | 2021-10-13T08:55:37.000+0000 |
Updated | 2021-11-29T14:10:49.000+0000 |
Description
After updating to iOS 15 (without updating SDK), most of our headerViews in ListViews have started to have a "glitch", -when setting data- when creating listview. Have a look at attached video from our app as an example of this behaviour.
Attachments
[~jonasfunk] There was a behaviour change in iOS 15 around the padding of headers in ListViews that was accounted for in 10.1.0.GA (TIMOB-28524), your description states
without updating SDK
but the environment states 10.1.0.GA? Could you please confirm what SDK you are using and if possible provide a better exampleThanks for looking into this issue. To clarify: After updating to iOS 15, we began seeing this issue on our app in production build with 9.2.2.GA. We updated to 10.1.0.GA, to see if that issue was fixed. It wasn't.
By better example do you mean, you are not able to see the issue in the video, or do mean an example with code?
Ideally a code sample would be best
{noformat} const win = Ti.UI.createWindow(); const addListviewButton = Ti.UI.createButton({ title: 'Create listview', zIndex:1000, bottom:40, height:50, width:200, style:Ti.UI.iOS.SystemButtonStyle.BUTTON_STYLE_OPTION_NEUTRAL }); addListviewButton.addEventListener('click',function(){ win.add(createListView()); }); win.add(addListviewButton); win.open(); win.add(createListView()); function createListView(){ //Remove listview if already added if(win.children.length == 2) win.remove(win.children[1]); const headerView = Ti.UI.createView({ height:300, backgroundColor:'blue' }); const listView = Ti.UI.createListView({ headerView: headerView }); return listView; } {noformat}
I've attached another screen recording of running the above code sample on an iPhone 13 Pro / iOS 15, and clicking the 'Create listview' button 3 times. You can especially see the glitch described, when opening the window. It's like the header is moving down to the middle of the screen.
I should emphasise that this is only observable when running on device. Simulator is fine.
[~jonasfunk], is it only on a notched device like the 13 Pro or does it also occurs on non-notch devices?
I havn't got a non-notch device at hand, so I havn't tested that, but I might be able to ask someone to test it for me.
I have a non-notch iPhone 7 and it looks to be ok for me, so I'm wondering if that's the case. [~jquick] [~gmathews] [~amukherjee] any of you have a notch device?
I'm only able to test in the iOS simulator. I sometimes see a flicker using the attached example code. My guess from looking at the video is the
remove()
method is removing the view immediately from the screen (it's forcing a render) and the view you're adding is shown on the next rendered frame. Perhaps a better solution would be to switch to using thereplaceAt()
method? https://titaniumsdk.com/api/titanium/ui/view.html#replaceat How does the following code run for you?Note: An even better solution would be to re-use the existing
ListView
by replacing its header and list items. This would be the most efficient thing to do... and it might solve that flicker issue since it looks like theremove()
method is doing a blocking render like I said above.Thanks for chiming in Joshua. I've created a new screen recording with your modification. I agree that it is a better approach to {noformat} replace {noformat} than {noformat} remove {noformat} (got to remember to use that one more), but the result is more or less the same. I've attached a new video, and a screenshot of one of the frames where the issue is apparent. The header is centered for a single frame, causing the flicker. Going back to the issue in our app, which i've also attached a video of, I dont think reusing a single listview in tabs is a solution for us – either way, you will always see a flicker upon first creation.
Got my hands on a non-notch device (iPhone 8), and there is no flicker, so it must be a notch device thing.
I have tried adding top:0 to headerview in code, but that does not work. Not that this is the right solution, but I found that adding a top of 0 to
in
seems to solve the issue. Like this: