Skip to content

Commit

Permalink
Merge pull request Expensify#26584 from allroundexperts/fix-26579
Browse files Browse the repository at this point in the history
fix: do not reset the state if same tab is clicked
  • Loading branch information
Hayata Suenaga authored Sep 3, 2023
2 parents e088539 + 3e441a5 commit d0b2772
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/TabSelector/TabSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,17 @@ function TabSelector({state, navigation, onTabPress, position}) {
const isFocused = index === state.index;

const onPress = () => {
if (isFocused) {
return;
}

const event = navigation.emit({
type: 'tabPress',
target: route.key,
canPreventDefault: true,
});

if (!isFocused && !event.defaultPrevented) {
if (!event.defaultPrevented) {
// The `merge: true` option makes sure that the params inside the tab screen are preserved
navigation.navigate({name: route.name, merge: true});
}
Expand Down

0 comments on commit d0b2772

Please sign in to comment.