Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

Commit

Permalink
fix: correctly reset _isTabPress property
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Aug 18, 2019
1 parent b56de41 commit 80b7f1d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/bottom-tabs/src/utils/createTabNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ export default function createTabNavigator(TabView: React.ComponentType<*>) {
_handleTabPress = ({ route }) => {
this._isTabPress = true;

// After tab press, handleIndexChange will be called synchronously
// So we reset it in promise callback
Promise.resolve().then(() => (this._isTabPress = false));

const { descriptors } = this.props;
const descriptor = descriptors[route.key];
const { navigation, options } = descriptor;
Expand Down Expand Up @@ -152,14 +156,6 @@ export default function createTabNavigator(TabView: React.ComponentType<*>) {
this._jumpTo(this.props.navigation.state.routes[index].routeName);
};

_handleSwipeStart = () => {
this.setState({ isSwiping: true });
};

_handleSwipeEnd = () => {
this.setState({ isSwiping: false });
};

_jumpTo = routeName => {
const { navigation } = this.props;

Expand Down

0 comments on commit 80b7f1d

Please sign in to comment.