I'm trying when I interact with a switch the others go to false can anyone help? XML code:
<StackLayout dock="top" height="90%" width="100%" style="">
<StackLayout tap="{{ definicoesTap }}" >
<Label text=" Voltar" paddingLeft="15%" class="drawerItemText font-awesome" />
</StackLayout>
<StackLayout class="hr-light"></StackLayout>
<StackLayout orientation="horizontal" marginTop="20" marginLeft="20">
<Switch id="notOFF" checkedChange="{{ teste }}" checked="False"/>
<Label text="Desativar todas as notificações" style="color:#000;font-size:17" marginLeft="5" />
</StackLayout>
<StackLayout orientation="horizontal" marginTop="20" marginLeft="20">
<Switch id="notON" checkedChange="{{ teste }}" checked="False"/>
<Label text="Ativar todas as notificações" style="color:#000;font-size:17" marginLeft="5" />
</StackLayout>
<StackLayout orientation="horizontal" marginTop="20" marginLeft="20">
<Switch id="notSMS" checkedChange="{{ teste }}" checked="False"/>
<Label text="Ativar apenas mensagens" style="color:#000;font-size:17" marginLeft="5" />
</StackLayout>
<StackLayout marginTop="20">
<Button text="Confirmar" tap="{{ definicoesTap }}" class="btn btn-secundary m-t-20" />
</StackLayout>
</StackLayout>
I created a function that executes when I activate the switches, now i want when 1 is true the others would be false JavaScript Code:
viewModel.teste = (args) => {
var objeto = args.object;
if (objeto.checked == true) {
switch (objeto.id) {
case "notOFF":
console.log("Todas as notificações desligadas")
break
case "notON":
console.log("Todas as notificações ligadas")
break
case "notSMS":
console.log("Apenas as notificações das mensagens")
break
}
}
}