Skip to content

Commit 976c045

Browse files
committed
add select/remove all header button
1 parent 3614111 commit 976c045

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

exampleapp/App.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,29 @@ searchAdornment = (searchTerm) => {
473473
null
474474
)
475475
}
476+
SelectOrRemoveAll = () => (
477+
this.SectionedMultiSelect &&
478+
<TouchableOpacity
479+
style={{
480+
justifyContent: 'center',
481+
height: 44,
482+
borderWidth: 0,
483+
paddingHorizontal: 10,
484+
backgroundColor: 'darkgrey',
485+
alignItems: 'center',
486+
}}
487+
onPress={
488+
this.state.selectedItems.length
489+
? this.SectionedMultiSelect._removeAllItems
490+
: this.SectionedMultiSelect._selectAllItems
491+
}
492+
>
493+
<Text style={{ color: 'white', fontWeight: 'bold' }}>
494+
{this.state.selectedItems.length ? 'Remove' : 'Select'} all
495+
</Text>
496+
</TouchableOpacity>
497+
)
498+
476499
onToggleSelector = (toggled) => {
477500
console.log('selector is ', toggled ? 'open' : 'closed');
478501
}
@@ -512,13 +535,10 @@ searchAdornment = (searchTerm) => {
512535
displayKey="title"
513536
iconKey="icon"
514537
autoFocus
538+
modalWithTouchable
515539
// showCancelButton
516540
headerComponent={
517-
<View style={{ padding: 15, position: 'absolute', top: 0, right: 0, zIndex: 99 }}>
518-
<TouchableOpacity onPress={this.SectionedMultiSelect && this.SectionedMultiSelect._cancelSelection}>
519-
<Icon>cancel</Icon>
520-
</TouchableOpacity>
521-
</View>
541+
this.SelectOrRemoveAll
522542
}
523543
stickyFooterComponent={
524544
<View style={{ padding: 15, }}>

0 commit comments

Comments
 (0)