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

Wrong position calculation when modal is dropped down #231

Open
000xuandu opened this issue Nov 4, 2019 · 4 comments
Open

Wrong position calculation when modal is dropped down #231

000xuandu opened this issue Nov 4, 2019 · 4 comments

Comments

@000xuandu
Copy link

000xuandu commented Nov 4, 2019

I am using "react-native-modal-dropdown": "^ 0.7.0".

Currently, I encounter this problem on my android device (on IOS devices it does not happen), that is: When the modal is dropped down, the position between the "Select Topic" button and the modal is spaced apart.

�Code and error are posted in the image:
viber_image_2019-11-04_10-22-28
viber_image_2019-11-04_10-24-40

Expected: The position of this modal is right below the "Select Topic" button.

@ajonno Help me, pls

@000xuandu
Copy link
Author

I think the problem is here: https://github.com/sohobloo/react-native-modal-dropdown/blob/master/components/ModalDropdown.js#L217

Should be, frameStyle, dropdownStyle instead of dropdownStyle, frameStyle
Please guide me on how to fix the error. I hope you.

@GavinRay97
Copy link

GavinRay97 commented Dec 5, 2019

@000xuandu
I had this problem too. I think it may have been caused by one of the flex style props passed to the ModalDropdown container.

You can solve it by subtracting from the top style prop in the handler like this:

<ModalDropdown
  options={['option 1', 'option 2']}
  adjustFrame={style => {
    style.top = style.top - 15;
    return style;
  }}
/>

@Luanluu96
Copy link

Luanluu96 commented Feb 12, 2020

Android function measure will add the height of the status bar you can resolve it subtract it in the adjustFrame prop like this:

<ModalDropdown
  options={['option 1', 'option 2']}
  adjustFrame={style => {
    style.top =(Platform.OS === 'ios' ? style.top : style.top - StatusBar.currentHeight);
    return style;
  }}
/>

@tz211488
Copy link

Android function measure will add the height of the status bar you can resolve it subtract it in the adjustFrame prop like this:

<ModalDropdown
  options={['option 1', 'option 2']}
  adjustFrame={style => {
    style.top =(Platform.OS === 'ios' ? style.top : style.top - StatusBar.currentHeight);
    return style;
  }}
/>

you save my life, many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants