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

fix(android)(9_1_X): fix TabbedBar Click loop #11838

Merged
merged 1 commit into from
Jul 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class TiUITabbedBar extends TiUIView implements MenuItem.OnMenuItemClickL
private int style = AndroidModule.TABS_STYLE_DEFAULT;
private ArrayList<MenuItem> bottomNavigationMenuItems = new ArrayList<>();
private int bottomNavigationIndex = -1;
private boolean skipClickEvent = false;

/**
* Constructs a TiUIView object with the associated proxy.
Expand Down Expand Up @@ -251,6 +252,7 @@ public void setNewStyle(int newStyle)
// Recreate the native views from scratch in case the data set has been changed
public void setNewLabels()
{
skipClickEvent = true;
switch (((int) getProxy().getProperty(TiC.PROPERTY_STYLE))) {
case AndroidModule.TABS_STYLE_DEFAULT:
if (this.tabLayout != null) {
Expand All @@ -268,6 +270,7 @@ public void setNewLabels()
break;
}
parseDataSet();
skipClickEvent = false;
}

private void setSelectedIndex(Object value)
Expand Down Expand Up @@ -338,9 +341,11 @@ private void onTabIndexChangedTo(int index)
proxy.setProperty(TiC.PROPERTY_INDEX, index);

// Last, fire a "click" event.
KrollDict data = new KrollDict();
data.put(TiC.PROPERTY_INDEX, index);
proxy.fireEvent(TiC.EVENT_CLICK, data);
if (!skipClickEvent) {
KrollDict data = new KrollDict();
data.put(TiC.PROPERTY_INDEX, index);
proxy.fireEvent(TiC.EVENT_CLICK, data);
}
}
}

Expand Down