nstudio / nstudio/nativescript-plugins
@nstudio/nativescript-checkbox: Toggle is being called twice when binding the checked to an attribute.
Open
Nobody has claimed this yet.
solution posted
- Dominant language
- TypeScript
- Stars
- 55
- Forks
- 42
- Avg merge
- 49m
- Merged PRs (30d)
- 1
Description
If you make it this way:
<template>
<Page>
<StackLayout
orientation="vertical">
<check-box
v-for="(option, index) in options"
:key="index"
:text="option"
:checked="index == selected"
boxType="circle"
@tap="selectOption(index)"
@checkedChange="changed(index)"/>
</StackLayout>
</Page>
</template>
<script lang="coffee">
export default
data: () ->
{
options: [
"First"
"Second"
"Third"
"Fourth"
]
selected: null
}
methods:
selectOption: (index) ->
if this.selected == index
this.selected = null
else
this.selected = index
changed: (index) ->
console.log "changed #{index}"
</script>
and click on an already selected option, you became able to select another one.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with the Vue template and checkbox bindings shown in the issue, then trace the plugin's checked and checkedChange handling. Done means clicking an already selected option does not invoke the toggle behavior twice or unexpectedly select another option.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100