svelte-native
svelte-native copied to clipboard
how to control on:tap
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 alternatively you can use isUserInteractionEnabled https://stackoverflow.com/questions/41468742/nativescript-angular-2-disable-background-tap-events