Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to control on:tap #343

Open
wvq opened this issue Jun 27, 2023 · 1 comment
Open

how to control on:tap #343

wvq opened this issue Jun 27, 2023 · 1 comment

Comments

@wvq
Copy link

wvq commented Jun 27, 2023

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.

@vallemar
Copy link

vallemar commented Jun 27, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants