Skip to content

Commit

Permalink
Merge pull request #5 from summer88123/master
Browse files Browse the repository at this point in the history
Fix: when directBackWhenSingle is TRUE, can not cancel selected.
  • Loading branch information
shallot authored Feb 14, 2019
2 parents 06dac0c + 743d262 commit f360285
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/PickList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { SafeAreaView, LayoutAnimation, FlatList, SectionList, StyleSheet, View, DeviceEventEmitter } from 'react-native';
import { DeviceEventEmitter, FlatList, LayoutAnimation, SafeAreaView, SectionList, StyleSheet, View } from 'react-native';
import { HeaderButton } from 'react-navigation-header-buttons';
import HeaderBackButton from 'react-navigation-stack/dist/views/Header/HeaderBackButton';
import SearchBar from 'react-native-general-searchbar';
Expand Down Expand Up @@ -364,13 +364,17 @@ export default class extends React.PureComponent {
this._selectItem(treeNode);
} else {
if (treeNode.isFullSelect(this.isCascade)) {
if (this.props.directBackWhenSingle &&
if (this.props.directBackWhenSingle &&
!this.props.cancelableWhenDirectBack) {
this._clickOK();
} else {
treeNode.update(this.isCascade);
const selectedItems = [];
this.setState({selectedItems});
this.setState({selectedItems}, () => {
if (this.props.directBackWhenSingle) {
this._clickOK();
}
});
}
} else {
if (this.state.selectedItems.length > 0 &&
Expand Down

0 comments on commit f360285

Please sign in to comment.