• I have created a layout using Layout Library and want to prompt the user to confirm something, after the user selection, the screen goes blank and I can't seem to re-render the app.

    function markHalftime(){
      isHalftime = true;
    
      E.showPrompt("Are you sure?", {
        title:"Confirmation",
        buttons: {"No":false, "Yes":true}
      }).then(function(result) {
        if (result) {
          // Code to execute if the user clicks "Yes"
          console.log(result);
        } else {
          // Code to execute if the user clicks "No" or closes the dialog
          // This is optional, depending on your application's logic
        }
        g.clear();
        Bangle.loadWidgets();
        Bangle.drawWidgets();
        layout.render();
      });
    }
    
    
  • Ahh - yes, E.showPrompt has to remove your layout's input handlers so they don't get called when you tap on the screen.

    To re-add them, I think it should be fine to just do layout.setUI();layout.render(); although I think if you're using 'lazy' rendering you might need a layout.forgetLazyState() before layout.render();

    Just FYI you only need to call Bangle.loadWidgets(); once at the start of your app - once they're loaded they don't need re-loading.

  • Hi Gordon, thanks for the great answer. It resolved my issue. I was lazy rendering so I had to call layout.setUI(); layout.forgetLazyState(); layout.render(); and everything is working fine.

    Thanks

  • Great! That that fixed it! I'll add a note to the docs too

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Bangle js 2 - after selecting yes or no from E.showPrompt, the screen stays blank.

Posted by Avatar for user158173 @user158173

Actions