svelte-native icon indicating copy to clipboard operation
svelte-native copied to clipboard

how to control on:tap

Open wvq opened this issue 2 years ago • 1 comments

I want to control enable/disable on:tap, but:

<script>
let on = View.prototype.addEventListener

View.prototype.addEventListener = function (arg: string | GestureTypes, callback: (data: EventData) => void, thisArg?: any) {
  console.log(this, arg, callback)
  on.call(this, arg, callback, thisArg)
}
let disabled = true
$: handleTap = disabled ? undefined : () => { console.log('tapped') }
</script>

<flexboxLayout on:tap={handleTap}>

why handleTap is undefined, but still call addEventListener.

wvq avatar Jun 27 '23 11:06 wvq

@wvq alternatively you can use isUserInteractionEnabled https://stackoverflow.com/questions/41468742/nativescript-angular-2-disable-background-tap-events

vallemar avatar Jun 27 '23 12:06 vallemar