react-native-material-bottom-navigation
Advanced tools
Comparing version 0.5.2 to 0.5.3
@@ -68,2 +68,3 @@ /** | ||
this.layoutWillChange = false | ||
this.lastTabChangeDate = -1 | ||
this.dimensions = { width: -1, height: -1 } | ||
@@ -144,3 +145,2 @@ this.nextActiveTab = props.activeTab | ||
} | ||
render() { | ||
@@ -202,4 +202,19 @@ const { | ||
} | ||
_canChangeTabs() { | ||
//Ignore tab taps that are < .5 seconds apart | ||
const TAB_BLOCK_DELAY_SECONDS = .5; | ||
if (this.lastTabChangeDate < 0) { | ||
return true | ||
} | ||
return (new Date() - this.lastTabChangeDate) > TAB_BLOCK_DELAY_SECONDS * 1000 | ||
} | ||
_handleTabChange = ({ tabIndex, barBackgroundColor }) => { | ||
if (this.nextActiveTab === this.activeTab || !this._canChangeTabs()) { | ||
//Block repetitive or super fast tab switches. Fixes Issue #32. | ||
return; | ||
} else { | ||
this.lastTabChangeDate = new Date(); | ||
} | ||
const { x, y } = this.iconPositions[tabIndex] | ||
@@ -206,0 +221,0 @@ |
{ | ||
"name": "react-native-material-bottom-navigation", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "JS Implementation of the Material Design Guidelines' Bottom Navigation for react-native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46585
1019