Skip to content

Commit

Permalink
icon in chip with passed size
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Filippini authored and jonno85 committed Jun 30, 2022
1 parent 8c00318 commit 33ed6a7
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 33 deletions.
4 changes: 2 additions & 2 deletions lib/components/ItemIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const ItemIcon = ({ iconRenderer: Icon, icon, iconKey, itemIconStyle }) => {
source={icon}
style={[
{
width: 32,
height: 32,
// width: 32,
// height: 32,
marginHorizontal: 10
},
itemIconStyle
Expand Down
68 changes: 37 additions & 31 deletions lib/sectioned-multi-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {
} from 'react-native'
import isEqual from 'lodash.isequal'
import memoize from 'memoize-one'
import { RowItem } from './components'
import { isEqual } from 'lodash'
import { RowItem, ItemIcon } from './components'
import { callIfFunction } from './helpers'

const Touchable =
Expand Down Expand Up @@ -392,7 +393,7 @@ class SectionedMultiSelect extends PureComponent {
else
return null
}

return (
<ItemIcon
iconRenderer={Icon}
Expand Down Expand Up @@ -935,7 +936,7 @@ class SectionedMultiSelect extends PureComponent {
} = this.props
const styles = this.getStyles(this.props.styles)
const colors = this.getColors(this.props.colors)

const { Icon, iconKey } = this.props
return selectedItems.map((singleSelectedItem) => {
const item = this._findItem(singleSelectedItem)

Expand Down Expand Up @@ -966,8 +967,13 @@ class SectionedMultiSelect extends PureComponent {
styles.chipContainer,
isParent && styles.parentChipContainer
]}
key={item[uniqueKey]}
>
key={item[uniqueKey]}>
<ItemIcon
iconRenderer={Icon}
iconKey={iconKey}
icon={item.icon}
style={styles.itemIconStyle}
/>
<Text
numberOfLines={1}
style={[
Expand Down Expand Up @@ -1084,8 +1090,8 @@ class SectionedMultiSelect extends PureComponent {
<View {...props} />
</Wrapper>
) : (
<View {...props} />
)
<View {...props} />
)
}

// _renderSubItemFlatList = ({ item }) => (
Expand Down Expand Up @@ -1222,30 +1228,30 @@ class SectionedMultiSelect extends PureComponent {
{loading ? (
callIfFunction(loadingComponent)
) : (
<View>
{!renderItems || (!renderItems.length && !searchTerm)
? callIfFunction(noItemsComponent)
: null}
{items && renderItems && renderItems.length ? (
<View>
<FlatList
keyboardShouldPersistTaps="always"
removeClippedSubviews
initialNumToRender={15}
data={renderItems}
extraData={selectedItems}
keyExtractor={(item) => `${item[uniqueKey]}`}
ItemSeparatorComponent={this._renderSeparator}
ListFooterComponent={this._renderFooter}
renderItem={this._renderItemFlatList}
{...itemsFlatListProps}
/>
</View>
) : searchTerm ? (
callIfFunction(noResultsComponent)
) : null}
</View>
)}
<View>
{!renderItems || (!renderItems.length && !searchTerm)
? callIfFunction(noItemsComponent)
: null}
{items && renderItems && renderItems.length ? (
<View>
<FlatList
keyboardShouldPersistTaps="always"
removeClippedSubviews
initialNumToRender={15}
data={renderItems}
extraData={selectedItems}
keyExtractor={(item) => `${item[uniqueKey]}`}
ItemSeparatorComponent={this._renderSeparator}
ListFooterComponent={this._renderFooter}
renderItem={this._renderItemFlatList}
{...itemsFlatListProps}
/>
</View>
) : searchTerm ? (
callIfFunction(noResultsComponent)
) : null}
</View>
)}
</View>
</View>
<View style={{ flexDirection: 'row' }}>
Expand Down

0 comments on commit 33ed6a7

Please sign in to comment.