How to prevent TableView "flashing"

You must Login before you can answer or comment on any questions.

I have a TableView where each row contains three labels. Two labels are left justified while the third is right justified.

The problem is that when the rows are created, the right label appears briefly on the left and outside the table, which is a group style. It's very quick, but you can still see it. It then is shown in the correct position.

This causes a flash condition when the label disappears and reappears.

Here is how I am creating the right-justified label:

var timeIn = Ti.UI.createLabel({
            text:   checkInDateTime,
            font:{fontSize:24},
            right:10,
            height:  'auto',
            width:  'auto',
            textAlign:  'right'
        });
 
        row.add(timeIn);
Is there a way I can prevent this effect?

2 Answers

I think (but not sure) that you need to add your table to the view after you have populated it. At least I do that and I have not observed flashing on both iphone and android. Also, this helps to prevent new views from flashing, do this:

var newView = create view ...
mainWindow.add(newView);
setTimeout( function() { mainWindow.remove(oldView); }, 10);
instead of:
var newView = create view ...
mainWindow.remove(oldView);
mainWindow.add(newView);

— answered 2 years ago by Kevin Kiddy
answer permalink
1 Comment
  • Interesting. What I've learned is that the flashing happens when the table is reloaded. So when the app starts and rows loaded, no flash.

    So it sounds like I need to remove the table, populate it, then put the tableview back in.

    I'll give that a shot. Thanks.

    — commented 2 years ago by Jaime Fuhr

try to set a width to the label that flashes

Your Answer

Think you can help? Login to answer this question!