-
Notifications
You must be signed in to change notification settings - Fork 477
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
fix bug: when height of dropdown list is auto #132
base: master
Are you sure you want to change the base?
Conversation
components/ModalDropdown.js
Outdated
@@ -212,8 +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) || | |||
StyleSheet.flatten(styles.dropdown).height; | |||
const dropdownHeight = (this.props.dropdownStyle && StyleSheet.flatten(this.props.dropdownStyle).height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you change const
to let
? You changed the dropdownHeight
in the following lines.
@dinhtho Does it work on your side? I just tried your code, still not working as expected. - the dropdown menu not showing under status bar, but stretch quite tall. :( |
Sorry @maxhis , that is a my mistake when I edit my code, you can see my code updated and now it works perfectly |
Thanks @dinhtho . But unfortunately, still not working on my side. |
|
Tried it on both iOS and Android - still not working. :( |
please comment your code here |
Here is the code snippet. BTW, I'm using
|
@maxhis Your problem is here |
@dinhtho Actually, I modified the |
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly missing separator height in this way.
StyleSheet.flatten(this.props.style).height seems not the item height.
I think we should only think about |
@maxhis yes, I found my issue in my code when get
|
If you want to height of dropdown list as a auto height, you need set value for height of item on dropdown list, |
fix issue: #130
set height for dropdown list if dropdownStyle has height is auto.
New height based on height of dropdown button and quanlity of options in dropdown list.