Search code examples
pebble-watchpebble-sdk

How to make a Card scrollable but still use up and down longClick in Pebble.js?


I'm trying to use the 'up' and 'down' buttons for 'longClick' in a scrollable Card. First, I created the Card and set scrollable to true

var main = new UI.Card({
  title: '',
  subtitle: '',
  body: '',
  scrollable: true
});

As stated in the pebble.js documentation: "When true, the up and down button will scroll the content of this Card" http://pebble.github.io/pebblejs/#window

But is there anyway to still use the up and down button in a longClick event such as:

main.on('longClick','down', function(){
  console.log('long click');      
});

I've tried testing it and making a Card scrollable basically sets up and down to only scroll.


Solution

  • The scroll in Pebble.js windows is Pebble OS's standard scroll. It is able to do a continuous scroll when the button is held down, so long clicks are also inaccessible.

    When it comes to displaying huge amounts of texts, having a second window similar to the Pebble's Notification modal window when a notification comes in should help. So if you need to display a huge amount of text, have a second card animate in that shows the large body of text. You can bind the second card's select button to hide the window for the user's convenience, even though back will already back the user out.

    I should update the documentation to also note that longClick up and down are also inaccessible when scrollable is enabled, thanks for pointing that out!