0

I try out Svelte Native and I try to hide "tags" with booleans. I try this, which works in the normal Svelte framework like:

{#if po.id !== null || po.id !== undefined}
        <flexboxLayout flexWrap="wrap" class="v-a-c t-a-c" >
            <label text="first" width="70%" backgroundColor="#63c3d0" class="m6"></label>
            <label text="second" width="70%" backgroundColor="#63c3d0" class="m6"></label>
            <label text="third" width="70%" backgroundColor="#63c3d0" class="m6"></label>
        </flexboxLayout>
    {:else }
        <stackLayout flexWrap="wrap" class="v-a-c t-a-c">
            <textField  bind:text="{personName}" class="m6 new-person" ></textField>
            <button text="add new value" on:tap="{createNewPlayer}" />
        </stackLayout>
    {/if}

So why it doesn't work? What am I doing wrong?

Paolo
  • 20,112
  • 21
  • 72
  • 113
Shoxious
  • 11
  • 3
  • We need further details. Do you get an error in the console? Which tag is showing, the `IF` or the `ELSE`? Where is your `po` set? I also recommend to check for `po.id !== undefined` first! If it is undefiened, this will run into an error. The correct way would be `{#if po.id !== undefined && po.id !== null}` – miwin Jul 23 '22 at 14:53
  • i get no error in the console. `let po: person = new person() let id let newPerson: boolean = true onMount(async () => { id = getNumber("id") console.log(id) if (id !== null && id !== undefined) { newPlayer = false getPlayerOverviewData() } else { // show empty side and create new player newPerson = true } });` – Shoxious Jul 23 '22 at 14:58
  • here i initialize it – Shoxious Jul 23 '22 at 14:58

0 Answers0