diff --git a/lib/sectioned-multi-select.js b/lib/sectioned-multi-select.js
index 17c2046..c9f687e 100644
--- a/lib/sectioned-multi-select.js
+++ b/lib/sectioned-multi-select.js
@@ -16,10 +16,12 @@ import {
ActivityIndicator,
} from 'react-native'
import { isEqual } from 'lodash'
-import Icon from 'react-native-vector-icons/MaterialIcons'
+// import Icon from 'react-native-vector-icons/MaterialIcons'
import { RowItem } from './components'
import { callIfFunction } from './helpers'
+let Icon
+
const Touchable = Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity
const defaultStyles = {
@@ -176,6 +178,7 @@ class SectionedMultiSelect extends PureComponent {
disabled: PropTypes.bool,
selectedIconOnLeft: PropTypes.bool,
parentChipsRemoveChildren: PropTypes.bool,
+ iconRenderer: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
}
static defaultProps = {
@@ -238,7 +241,16 @@ class SectionedMultiSelect extends PureComponent {
constructor(props) {
super(props)
+ this.iconLoaded = false
+ if (props.iconRenderer) {
+ Icon = props.iconRenderer
+ this.iconLoaded = true
+ } else {
+ Icon = require('react-native-vector-icons/MaterialIcons').default
+ this.iconLoaded = true
+ }
+
this.state = {
selector: false,
searchTerm: '',
@@ -292,7 +304,6 @@ class SectionedMultiSelect extends PureComponent {
return toSplice
}
-
_getSelectLabel = () => {
const {
selectText,
@@ -422,7 +433,7 @@ class SectionedMultiSelect extends PureComponent {
subKey,
onSelectedItemsChange,
onSelectedItemObjectsChange,
- readOnlyHeadings
+ readOnlyHeadings,
} = this.props
let newItems = []
@@ -867,6 +878,7 @@ class SectionedMultiSelect extends PureComponent {
return (
-
+ {headerComponent && callIfFunction(headerComponent)}
+ {!hideSearch && (
+
+
+ {callIfFunction(searchIconComponent) || (
+
+ )}
+
+ this.setState({ searchTerm })}
+ placeholder={searchPlaceholderText}
+ autoFocus={autoFocus}
+ selectTextOnFocus
+ placeholderTextColor={colors.searchPlaceholderTextColor}
+ underlineColorAndroid="transparent"
+ style={[
+ {
+ flex: 1,
+ fontSize: 17,
+ paddingVertical: 8,
+ },
+ searchTextFont,
+ styles.searchTextInput,
+ ]}
+ />
+ {searchAdornment && searchAdornment(searchTerm)}
+
+ )}
+
+
- {headerComponent && callIfFunction(headerComponent)}
- {!hideSearch && (
-
-
- {callIfFunction(searchIconComponent) || (
-
- )}
+
+ {loading ? (
+ callIfFunction(loadingComponent)
+ ) : (
+
+ {!renderItems || (!renderItems.length && !searchTerm)
+ ? callIfFunction(noItemsComponent)
+ : null}
+ {items && renderItems && renderItems.length ? (
+
+ `${item[uniqueKey]}`}
+ ItemSeparatorComponent={this._renderSeparator}
+ ListFooterComponent={this._renderFooter}
+ renderItem={this._renderItemFlatList}
+ />
+
+ ) : searchTerm ? (
+ callIfFunction(noResultsComponent)
+ ) : null}
- this.setState({ searchTerm })}
- placeholder={searchPlaceholderText}
- autoFocus={autoFocus}
- selectTextOnFocus
- placeholderTextColor={colors.searchPlaceholderTextColor}
- underlineColorAndroid="transparent"
+ )}
+
+
+
+ {showCancelButton && (
+
+
- {searchAdornment && searchAdornment(searchTerm)}
-
+ >
+ {callIfFunction(cancelIconComponent) || (
+
+ )}
+
+
)}
-
-
-
- {loading ? (
- callIfFunction(loadingComponent)
- ) : (
-
- {!renderItems || (!renderItems.length && !searchTerm)
- ? callIfFunction(noItemsComponent)
- : null}
- {items && renderItems && renderItems.length ? (
-
- `${item[uniqueKey]}`}
- ItemSeparatorComponent={this._renderSeparator}
- ListFooterComponent={this._renderFooter}
- renderItem={this._renderItemFlatList}
- />
-
- ) : searchTerm ? (
- callIfFunction(noResultsComponent)
- ) : null}
-
- )}
-
-
-
- {showCancelButton && (
-
-
- {callIfFunction(cancelIconComponent) || (
-
- )}
-
-
- )}
- {!hideConfirm && (
-
+
-
-
- {confirmText}
-
-
-
- )}
-
- {stickyFooterComponent && callIfFunction(stickyFooterComponent)}
+ {confirmText}
+
+
+
+ )}
+ {stickyFooterComponent && callIfFunction(stickyFooterComponent)}
+
{chipsPosition === 'top' && this._renderChips()}
{chipsPosition === 'top' && this._customChipsRenderer()}
@@ -1117,7 +1128,7 @@ class SectionedMultiSelect extends PureComponent {
styles.selectToggle,
]}
>
- {this._getSelectLabel()}
+ {this._getSelectLabel()}
{callIfFunction(selectToggleIconComponent) || (