23 Nov 2012 5:16 PM #1
Unanswered: Button show/hide doesn't work until screen tap
I have developed my app for iOS and it works fine, but am now having to deal with various strange issues on Android.
I have a button in my navigation bar that I hide and show. The strange thing is, if I show the button eg. with this.getDictionaryEntryButton().show() it doesn't appear until I tap the screen. Same thing happens when I hide the button. It doesn't hide until I tap the screen.
I've also noticed the same problem in my list view. If I add a new item to the list, it doesn't appear until I tap the screen.
I'm using a Samsung Galaxy Tab 2 7.0"
Is there some sort of refresh or something I can use to force these components to appear?
26 Nov 2012 6:10 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
Sounds like the browser isn't repainting when it needs to. I can see this happening if the button is hidden when you try to show it but not when you try to hide it while it's already shown.
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services email@example.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
26 Nov 2012 6:01 PM #3
You're right about that - I have a carousel and I hide or show my 'edit' button in the naviagation bar depending on whether the card in the carousel currently being shown is editable or not. If I go straight to an editable card (from a list view), the button shows correctly without having to tap. And if I swipe to say the previous card that is not editable, the button is hidden correctly without having to tap. But if I then go back to the editable card, the button doesn't display until I tap the screen.
Is there any way to force the browser (the problem only occurs on Android so Chrome browser) to repaint correctly?
27 Nov 2012 3:29 PM #4
Strange, I've noticed that if I do a quick short swipe on the carousel (so that my finger doesn't go all the way to the edge of the screen) then the button shows/hides correctly!
29 Nov 2012 3:47 PM #5
The solution is to forget Sencha's references all together and use plain old Javacript (this is the latest in a series of ongoing issues I've had with Sencha References and Controls not working properly).
So this is the code I was using to show the button which didn't work (dictionaryEntryButton is a Ref to the button in the navigation bar with id = dictionaryEntryButton)
var dict_button = document.getElementById('dictionaryEntryButton'); dict_button.style.visibility = 'visible';