diff --git a/components/DropDownMenu/DropDownMenu.js b/components/DropDownMenu/DropDownMenu.js index 1a2f22cc..a1b4c4e2 100644 --- a/components/DropDownMenu/DropDownMenu.js +++ b/components/DropDownMenu/DropDownMenu.js @@ -1,3 +1,4 @@ +import PropTypes from 'prop-types'; import React, { PureComponent } from 'react'; import _ from 'lodash'; @@ -17,9 +18,22 @@ class DropDownMenu extends PureComponent { * @see DropDownModal.propTypes */ static propTypes = { + /** + * Icon displayed on dropdown menu button + */ + iconName: PropTypes.string, + /** + * Whether the text should be displayed next to dropdown icon or not + */ + showSelectedOption: PropTypes.bool, ...dropDownMenuPropTypes, }; + static defaultProps = { + iconName: "drop-down", + showSelectedOption: true, + }; + constructor(props) { super(props); this.state = { @@ -51,14 +65,14 @@ class DropDownMenu extends PureComponent { } renderSelectedOption() { - const { style, titleProperty } = this.props; + const { iconName, showSelectedOption, style, titleProperty } = this.props; const selectedOption = this.getSelectedOption(); return selectedOption ? ( ) : null; diff --git a/components/DropDownMenu/DropDownModal.js b/components/DropDownMenu/DropDownModal.js index fa48a4bd..8ae8e186 100644 --- a/components/DropDownMenu/DropDownModal.js +++ b/components/DropDownMenu/DropDownModal.js @@ -245,13 +245,15 @@ class DropDownModal extends PureComponent { style, titleProperty, renderOption, + selectedOption, } = this.props; const optionItem = renderOption(option, titleProperty); + const selectedItem = selectedOption.id === option.id || false const onPress = () => this.selectOption(option); return ( - + {optionItem} ); diff --git a/package.json b/package.json index 40656efc..27d20e0f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@shoutem/ui", - "version": "4.0.0", + "version": "4.0.1", "description": "Styleable set of components for React Native applications", "dependencies": { "@shoutem/animation": "~0.12.4", diff --git a/theme.js b/theme.js index d1ebb821..ef342e7d 100644 --- a/theme.js +++ b/theme.js @@ -2006,6 +2006,18 @@ export default (variables = defaultThemeVariables) => ({ ...variables.subtitle, }, }, + selectedModalItem: { + 'shoutem.ui.Text': { + textAlign: 'center', + flex: 1, + width: window.width, + paddingHorizontal: 20, + paddingVertical: 23, + alignSelf: 'stretch', + ...variables.subtitle, + fontWeight: '500' + }, + }, visibleOptions: 8, },