Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add caption selecttext when option is selected #107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions lib/sectioned-multi-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ const defaultStyles = {
},
selectedItem: {

},
selectTextCaption:{

},
viewSelector:{

},
}

Expand Down Expand Up @@ -210,7 +216,8 @@ class SectionedMultiSelect extends PureComponent {
chipsPosition: PropTypes.oneOf(['top', 'bottom']),
autoFocus: PropTypes.bool,
iconKey: PropTypes.string,
disabled: PropTypes.bool
disabled: PropTypes.bool,
showSelectTextCaption: PropTypes.bool
}

static defaultProps = {
Expand Down Expand Up @@ -254,7 +261,8 @@ class SectionedMultiSelect extends PureComponent {
noItemsComponent: noItems,
chipsPosition: 'bottom',
autoFocus: false,
disabled: false
disabled: false,
showSelectTextCaption: false
}

constructor(props) {
Expand Down Expand Up @@ -898,7 +906,9 @@ class SectionedMultiSelect extends PureComponent {
stickyFooterComponent,
chipsPosition,
autoFocus,
disabled
disabled,
selectText,
showSelectTextCaption
} = this.props

const {
Expand All @@ -911,7 +921,7 @@ class SectionedMultiSelect extends PureComponent {
const confirmFont = confirmFontFamily.fontFamily && confirmFontFamily
const searchTextFont = searchTextFontFamily.fontFamily && searchTextFontFamily
return (
<View>
<View style={styles.viewSelector}>
<Modal
supportedOrientations={modalSupportedOrientations}
animationType={modalAnimationType}
Expand Down Expand Up @@ -1080,6 +1090,13 @@ class SectionedMultiSelect extends PureComponent {
>
{this._getSelectLabel()}
</Text>
{(selectedItems.length === 1 && showSelectTextCaption) &&
<Text style={[{
fontSize: 12,
color: '#333'
}, styles.selectTextCaption]}>
{selectText}
</Text>}
{selectToggleIconComponent ?
selectToggleIconComponent
:
Expand Down