How to debounce multiple clickable buttons

user3095495

At present I am debouncing using the lodash library like so...

<Button
  onPress={_.debounce(
        () => {
               navigation.goBack()
              },
              500,
              {
                leading: true,
                trailing: false,
               }
   )}
   title="Back"
/>

Which works as expecte when I just click on one link, but if I click on two clickable areas like so... (see below gif) the following happens...

issue

Mikhail Shabrikov

Move definition of debounced function from "render" method, like this:

export default class YourClassName extends Component {
  constructor() {
    super();

    this.debouncedOnPressHandler = _.debounce(
      () => { navigation.goBack() },
      500,
      {
        leading: true,
        trailing: false,
      }
    )
  }

  render() {
    return (
      <div>
        <Button onPress={this.debouncedOnPressHandler} title="Back A" />
        <Button onPress={this.debouncedOnPressHandler} title="Back B" />
      </div>
    );
  }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to make my buttons not clickable

From Dev

How to make my buttons not clickable

From Dev

How can I enable two buttons clickable?

From Dev

How To make Buttons Clickable in ListView Header

From Dev

how to make a JTextArea have clickable buttons

From Dev

Software debounce for Android buttons

From Dev

Clickable H3 Buttons on Moble: How to Handle Accessibility

From Dev

How to create listview with buttons inside clickable list items in Jquery Mobile

From Dev

How to put queried data from database in dropdown and buttons clickable?

From Dev

Python Tkinter: How to combine keyboard prompts and clickable buttons adequately?

From Dev

Clickable buttons inside a node

From Dev

Buttons within a ListFragment not clickable

From Dev

Buttons Not Clickable in FireFox

From Dev

How to Validate Multiple radio buttons

From Dev

How to toggle multiple views with buttons

From Dev

How to rearrange multiple buttons on Android

From Dev

Share This buttons in Bootstrap Popover not clickable

From Dev

Make buttons in overlapping divs clickable

From Dev

Hardware buttons is not clickable in Android emulator

From Dev

(Batch) Is there a way to make clickable buttons?

From Dev

Android textviews and buttons clickable in ListView

From Dev

Make buttons overlapped by a div clickable

From Dev

Some Buttons are not clickable in Landscape mode

From Dev

Clickable div except for links and buttons

From Dev

Buttons in Cell not clickable IOS 9

From Dev

How to use multiple buttons for multiple threads in android?

From Dev

How to show multiple bootstrap modals on multiple buttons

From Dev

How to set multiple spans on a TextView's text (clickable and bold)

From Dev

How to handle multiple submit buttons when the number of buttons is variable?

Related Related

  1. 1

    How to make my buttons not clickable

  2. 2

    How to make my buttons not clickable

  3. 3

    How can I enable two buttons clickable?

  4. 4

    How To make Buttons Clickable in ListView Header

  5. 5

    how to make a JTextArea have clickable buttons

  6. 6

    Software debounce for Android buttons

  7. 7

    Clickable H3 Buttons on Moble: How to Handle Accessibility

  8. 8

    How to create listview with buttons inside clickable list items in Jquery Mobile

  9. 9

    How to put queried data from database in dropdown and buttons clickable?

  10. 10

    Python Tkinter: How to combine keyboard prompts and clickable buttons adequately?

  11. 11

    Clickable buttons inside a node

  12. 12

    Buttons within a ListFragment not clickable

  13. 13

    Buttons Not Clickable in FireFox

  14. 14

    How to Validate Multiple radio buttons

  15. 15

    How to toggle multiple views with buttons

  16. 16

    How to rearrange multiple buttons on Android

  17. 17

    Share This buttons in Bootstrap Popover not clickable

  18. 18

    Make buttons in overlapping divs clickable

  19. 19

    Hardware buttons is not clickable in Android emulator

  20. 20

    (Batch) Is there a way to make clickable buttons?

  21. 21

    Android textviews and buttons clickable in ListView

  22. 22

    Make buttons overlapped by a div clickable

  23. 23

    Some Buttons are not clickable in Landscape mode

  24. 24

    Clickable div except for links and buttons

  25. 25

    Buttons in Cell not clickable IOS 9

  26. 26

    How to use multiple buttons for multiple threads in android?

  27. 27

    How to show multiple bootstrap modals on multiple buttons

  28. 28

    How to set multiple spans on a TextView's text (clickable and bold)

  29. 29

    How to handle multiple submit buttons when the number of buttons is variable?

HotTag

Archive