Allow swipeEnabled be a function (#3378)

* Allow swipeEnabled be a function with state param
This commit is contained in:
Maxime Florent Fankam
2018-02-09 23:04:17 +01:00
parent 1f0c099e19
commit 0915c0572a

View File

@@ -140,11 +140,15 @@ class TabView extends React.PureComponent {
const tabBarVisible =
options.tabBarVisible == null ? true : options.tabBarVisible;
const swipeEnabled =
let swipeEnabled =
options.swipeEnabled == null
? this.props.swipeEnabled
: options.swipeEnabled;
if (typeof swipeEnabled === 'function') {
swipeEnabled = swipeEnabled(state);
}
if (tabBarComponent !== undefined && tabBarVisible) {
if (tabBarPosition === 'bottom') {
renderFooter = this._renderTabBar;