react-native-material-bottom-navigation
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -140,3 +140,3 @@ /** | ||
} else { | ||
this.refs[`tab_${newTabIndex}`].setTabActive() | ||
this.refs[`tab_${newTabIndex}`].setTabActive({ forceAnimation: true }) | ||
} | ||
@@ -215,4 +215,7 @@ } | ||
_handleTabChange = ({ tabIndex, barBackgroundColor }) => { | ||
if (this.nextActiveTab === this.activeTab || !this._canChangeTabs()) { | ||
_handleTabChange = (args, opts) => { | ||
const { tabIndex, barBackgroundColor } = args | ||
const { updateActiveTab, forceAnimation = false } = opts | ||
if (!this._canChangeTabs() && !forceAnimation) { | ||
return | ||
@@ -229,3 +232,3 @@ } else { | ||
// (see componentWillReceiveProps) | ||
this.nextActiveTab = tabIndex | ||
if (updateActiveTab) this.nextActiveTab = tabIndex | ||
@@ -235,3 +238,5 @@ // Delegation to next tick will cause smoother animations | ||
// Call onTabChange Event Callback | ||
this.props.onTabChange(tabIndex, this.state.activeTab) | ||
if (updateActiveTab) { | ||
this.props.onTabChange(tabIndex, this.state.activeTab) | ||
} | ||
@@ -271,3 +276,3 @@ // Checks in general if component is still mounted. | ||
// Finally, update tab and set it active | ||
this.setState({ activeTab: tabIndex }) | ||
if (updateActiveTab) this.setState({ activeTab: tabIndex }) | ||
}) | ||
@@ -274,0 +279,0 @@ }) |
@@ -235,8 +235,9 @@ /** | ||
_handleTabPress = () => { | ||
this.props.onPress | ||
? this.props.onPress(this.props.tabIndex) | ||
: this.setTabActive() | ||
this.props.onPress && this.props.onPress(this.props.tabIndex) | ||
// if onPress is set, only run the (ripple) animation, don't set it active | ||
this.setTabActive({ updateActiveTab: !this.props.onPress }) | ||
} | ||
setTabActive = () => { | ||
setTabActive = ({ updateActiveTab = true, forceAnimation = false }) => { | ||
// Setting the tab active is job of the BottomNavigation Component, | ||
@@ -248,3 +249,3 @@ // so call it's function to handle that. | ||
iconRef: this.refs._bnic | ||
}) | ||
}, { updateActiveTab, forceAnimation }) | ||
} | ||
@@ -251,0 +252,0 @@ |
{ | ||
"name": "react-native-material-bottom-navigation", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"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
47502
1033