0

I have a simple TabView with two tabs, each with one button in it, the touch event on the button shows some strange behaviour.

If I simply output the TabView directly all events work:

<GridLayout rows="*">
  <TabView row="0">
    <StackLayout *tabItem="{title: 'Tab 1'}">        
      <button background="red" (tap)="alert('Hello 1')"></button>  
    </StackLayout>
    <StackLayout *tabItem="{title: 'Tab 2'}">        
      <button background="red" (tap)="alert('Hello 2')"></button>  
    </StackLayout>
  </TabView>
</GridLayout>

Now when I show the TabView conditionally after the app fetches some data, I get some unexpected behaviour:

 <TabView *ngIf="VarSetAfterServerResponse">
  ....

The Tap event of the first button will only trigger once or twice, the last button will keep on working.

This is a simplified example. I am getting this throughout all tabs with more complicated content in it, none of the event listeners that are set from within the HTML work. EventListeners attached from TypeScript are not reliable as well, tried to set theses inside all the Angular LifeCycleEvents.

This is only a problem on iOS.

2
  • Can you show us how you have placed TabView within your template? Commented Jul 2, 2019 at 15:56
  • Sure, see edited post, it is inside a GridLayout, nothing else Commented Jul 3, 2019 at 7:01

1 Answer 1

0

It seems to be a bug with {N} Angular, you might want to report on Github. As a workaround you may use visibility on TabView.

<TabView [visibility]="VarSetAfterServerResponse ? 'visible' : 'hidden'">
  ....
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.