From 13ceff348fd13de4c4fb31a58da44f209dba2142 Mon Sep 17 00:00:00 2001 From: thonguyen Date: Wed, 7 Feb 2018 13:39:08 +0700 Subject: [PATCH 1/3] fix bug: when height of dropdown list is auto --- components/ModalDropdown.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/ModalDropdown.js b/components/ModalDropdown.js index 0380adb..2223862 100644 --- a/components/ModalDropdown.js +++ b/components/ModalDropdown.js @@ -214,6 +214,11 @@ export default class ModalDropdown extends Component { const dropdownHeight = (this.props.dropdownStyle && StyleSheet.flatten(this.props.dropdownStyle).height) || StyleSheet.flatten(styles.dropdown).height; + if (dropdownHeight == "auto") { + let itemHeight = (this.props.style && StyleSheet.flatten(this.props.style).height) || + StyleSheet.flatten(styles.dropdown).height; + dropdownHeight = itemHeight * this.props.options.length; + } const bottomSpace = windowHeight - this._buttonFrame.y - this._buttonFrame.h; const rightSpace = windowWidth - this._buttonFrame.x; From a7320aec4671f98f95a46cbdc0a07f1c7f4de03d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20=C4=90=C3=ACnh=20Th=C6=A1?= Date: Wed, 7 Feb 2018 19:31:07 +0700 Subject: [PATCH 2/3] Update ModalDropdown.js --- components/ModalDropdown.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/ModalDropdown.js b/components/ModalDropdown.js index 2223862..986d12f 100644 --- a/components/ModalDropdown.js +++ b/components/ModalDropdown.js @@ -212,8 +212,7 @@ export default class ModalDropdown extends Component { const windowWidth = dimensions.width; const windowHeight = dimensions.height; - const dropdownHeight = (this.props.dropdownStyle && StyleSheet.flatten(this.props.dropdownStyle).height) || - StyleSheet.flatten(styles.dropdown).height; + const dropdownHeight = (this.props.dropdownStyle && StyleSheet.flatten(this.props.dropdownStyle).height); if (dropdownHeight == "auto") { let itemHeight = (this.props.style && StyleSheet.flatten(this.props.style).height) || StyleSheet.flatten(styles.dropdown).height; From e3d0fdf109769e02243d1da1b41013a52eef05ec Mon Sep 17 00:00:00 2001 From: thonguyen Date: Fri, 9 Feb 2018 09:21:51 +0700 Subject: [PATCH 3/3] update code --- components/ModalDropdown.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/ModalDropdown.js b/components/ModalDropdown.js index 986d12f..438f651 100644 --- a/components/ModalDropdown.js +++ b/components/ModalDropdown.js @@ -212,12 +212,12 @@ export default class ModalDropdown extends Component { const windowWidth = dimensions.width; const windowHeight = dimensions.height; - const dropdownHeight = (this.props.dropdownStyle && StyleSheet.flatten(this.props.dropdownStyle).height); - if (dropdownHeight == "auto") { - let itemHeight = (this.props.style && StyleSheet.flatten(this.props.style).height) || - StyleSheet.flatten(styles.dropdown).height; - dropdownHeight = itemHeight * this.props.options.length; - } + let dropdownHeight = (this.props.dropdownStyle && StyleSheet.flatten(this.props.dropdownStyle).height) || + StyleSheet.flatten(styles.dropdown).height; + if (dropdownHeight == "auto") { + let itemHeight = (this.props.style && StyleSheet.flatten(this.props.style).height); + dropdownHeight = itemHeight * this.props.options.length; + } const bottomSpace = windowHeight - this._buttonFrame.y - this._buttonFrame.h; const rightSpace = windowWidth - this._buttonFrame.x;