From 8dbf3fd9e10303753cbc38088efcb4f61e82f797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Karniej?= Date: Tue, 17 Jul 2018 00:51:26 +0200 Subject: [PATCH 1/2] Added new 2 props to modal dropdown, which will help working with the package --- components/ModalDropdown.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/components/ModalDropdown.js b/components/ModalDropdown.js index 4dc5342..dc1098e 100644 --- a/components/ModalDropdown.js +++ b/components/ModalDropdown.js @@ -1,5 +1,6 @@ /** * Created by sohobloo on 16/9/13. + * Forked by karniej on 17/07/2018 */ 'use strict'; @@ -49,6 +50,8 @@ export default class ModalDropdown extends Component { dropdownStyle: PropTypes.oneOfType([PropTypes.number, PropTypes.object, PropTypes.array]), dropdownTextStyle: PropTypes.oneOfType([PropTypes.number, PropTypes.object, PropTypes.array]), dropdownTextHighlightStyle: PropTypes.oneOfType([PropTypes.number, PropTypes.object, PropTypes.array]), + touchableHiglightunderlayColor: PropTypes.string, + listViewBorderRadius: PropTypes.number, adjustFrame: PropTypes.func, renderRow: PropTypes.func, @@ -68,7 +71,8 @@ export default class ModalDropdown extends Component { options: null, animated: true, showsVerticalScrollIndicator: true, - keyboardShouldPersistTaps: 'never' + keyboardShouldPersistTaps: 'never', + touchableHiglightunderlayColor: 'black' }; constructor(props) { @@ -281,10 +285,10 @@ export default class ModalDropdown extends Component { } _renderDropdown() { - const {scrollEnabled, renderSeparator, showsVerticalScrollIndicator, keyboardShouldPersistTaps} = this.props; + const {scrollEnabled, renderSeparator, showsVerticalScrollIndicator, keyboardShouldPersistTaps, listViewBorderRadius} = this.props; return ( { - const {renderRow, dropdownTextStyle, dropdownTextHighlightStyle, accessible} = this.props; + const {renderRow, dropdownTextStyle, dropdownTextHighlightStyle, accessible, touchableHiglightunderlayColor} = this.props; const {selectedIndex} = this.state; const key = `row_${rowID}`; const highlighted = rowID == selectedIndex; @@ -332,7 +336,7 @@ export default class ModalDropdown extends Component { switch (row.type.displayName) { case 'TouchableHighlight': { return ( - + {children} ); @@ -363,7 +367,7 @@ export default class ModalDropdown extends Component { } } return ( - + {row} ); From b50a0cae4e2680c66927a09135d081a87d74e65b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Karniej?= Date: Tue, 31 Jul 2018 08:29:02 +0200 Subject: [PATCH 2/2] Added 1 more props and removed spare one --- .gitignore | 1 + components/ModalDropdown.js | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index ac5644d..51a0713 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ # IDE .idea +.history node_modules npm-debug.log diff --git a/components/ModalDropdown.js b/components/ModalDropdown.js index dc1098e..e434aec 100644 --- a/components/ModalDropdown.js +++ b/components/ModalDropdown.js @@ -51,8 +51,9 @@ export default class ModalDropdown extends Component { dropdownTextStyle: PropTypes.oneOfType([PropTypes.number, PropTypes.object, PropTypes.array]), dropdownTextHighlightStyle: PropTypes.oneOfType([PropTypes.number, PropTypes.object, PropTypes.array]), touchableHiglightunderlayColor: PropTypes.string, - listViewBorderRadius: PropTypes.number, - + dropdownShadow: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), + activeOpacity: PropTypes.number, + multiSelectDropdown: PropTypes.bool, adjustFrame: PropTypes.func, renderRow: PropTypes.func, renderSeparator: PropTypes.func, @@ -72,7 +73,12 @@ export default class ModalDropdown extends Component { animated: true, showsVerticalScrollIndicator: true, keyboardShouldPersistTaps: 'never', - touchableHiglightunderlayColor: 'black' + dropdownShadow: { + shadowOpacity: 0.25, + shadowColor: 'black', + shadowRadius: 15, + shadowOffset: { width: 0, height: 20 } + } }; constructor(props) { @@ -167,7 +173,7 @@ export default class ModalDropdown extends Component { } _renderButton() { - const {disabled, accessible, children, textStyle} = this.props; + const {disabled, accessible, children, textStyle, activeOpacity} = this.props; const {buttonText} = this.state; return ( @@ -175,6 +181,7 @@ export default class ModalDropdown extends Component { disabled={disabled} accessible={accessible} onPress={this._onButtonPress} + activeOpacity={activeOpacity} > { children || @@ -201,7 +208,7 @@ export default class ModalDropdown extends Component { }; _renderModal() { - const {animated, accessible, dropdownStyle} = this.props; + const {animated, accessible, dropdownStyle, dropdownShadow} = this.props; const {showDropdown, loading} = this.state; if (showDropdown && this._buttonFrame) { const frameStyle = this._calcPosition(); @@ -217,7 +224,7 @@ export default class ModalDropdown extends Component { disabled={!showDropdown} onPress={this._onModalPress} > - + {loading ? this._renderLoading() : this._renderDropdown()} @@ -285,10 +292,9 @@ export default class ModalDropdown extends Component { } _renderDropdown() { - const {scrollEnabled, renderSeparator, showsVerticalScrollIndicator, keyboardShouldPersistTaps, listViewBorderRadius} = this.props; + const {scrollEnabled, renderSeparator, showsVerticalScrollIndicator, keyboardShouldPersistTaps} = this.props; return (