1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    28
    Vote Rating
    0
    Matt_d is on a distinguished road

      0  

    Default Unanswered: Button show/hide doesn't work until screen tap

    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?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,128
    Vote Rating
    453
    Answers
    3161
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    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.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    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 services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    28
    Vote Rating
    0
    Matt_d is on a distinguished road

      0  

    Default


    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?

  4. #4
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    28
    Vote Rating
    0
    Matt_d is on a distinguished road

      0  

    Default


    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!

  5. #5
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    28
    Vote Rating
    0
    Matt_d is on a distinguished road

      0  

    Default


    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)

    Code:
    this.getDictionaryEntryButton().show();
    and this is the code that works
    Code:
    var dict_button = document.getElementById('dictionaryEntryButton');
    dict_button.style.visibility = 'visible';

Tags for this Thread