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

fix bug: when height of dropdown list is auto #132

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 2 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
8 changes: 6 additions & 2 deletions components/ModalDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link

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.

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;
Expand Down