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

Modal gets separated from field if there is a keyboard dismissed animation #73

Open
reddo opened this issue Feb 20, 2018 · 10 comments
Open

Comments

@reddo
Copy link

reddo commented Feb 20, 2018

If there is a TextInput focused with the keyboard visible, tapping on the dropdown dismisses the keyboard and the window scrolls, the modal gets separated from the dropdown.

See this screen recording:

dropdown_opt_er

Note that there's a few seconds pause in the video, just watch till the end.

@abartolo
Copy link

abartolo commented May 1, 2018

@reddo Thanks for the video. This is also happening to me. Any luck finding a workaround?

@reddo
Copy link
Author

reddo commented May 1, 2018

@abartolo nope, still an issue

@matteodanelli
Copy link

I have the same issue. Anyone solved?

@reddo reddo changed the title Modal gets separated from field if there is a keyboard dismissed aimation Modal gets separated from field if there is a keyboard dismissed animation May 11, 2018
@ryachza
Copy link

ryachza commented May 14, 2018

I patched this adding:

  componentWillMount()
  {
    const handler = (e) => { if(this.state.modal){ this.onPress(null) } }
    this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow',handler)
    this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide',handler)
  }

Seems to be working for me. I would probably like to see the position measurements separated from the animation and only trigger the former.

Full diff:
react-native-material-dropdown+0.11.1.patch.zip

matteodanelli added a commit to matteodanelli/react-native-material-dropdown that referenced this issue May 15, 2018
Bug: dropdown centered when keyboard is open.
@matteodanelli
Copy link

@ryachza Yes! It seems work. Pull request made ;)

@abartolo
Copy link

abartolo commented Jul 2, 2018

@n4kz Hi, any idea when the PR from @matteodanelli might get accepted?

@yasir-netlinks
Copy link

yasir-netlinks commented Jun 2, 2019

Hi there, any solution for this! Can we keep the keyboard open when clicked on dropdown rather than dismissing the keyboard ??

@damithg-dev
Copy link

hi is there any fixes regarding this, I have used the patch but not any luck,

@HadisSharif
Copy link

I have the same issue.

@FlorianMerkle
Copy link

@ryachza this works for me on iOS but not on android.
It seems that the 'keyboardDidHide' event fires too early on Android. Logging the x and y values measured in the onPress function shows the difference between the platforms.

Setting a timeout leads to equal values for iOS and Android (and the expected behavior):

const handler = (e) => { if(this.state.modal){ setTimeout(() => { this.onPress(null) }, 10); } }

Maybe someone can explain the difference in the keyboard event handlers in iOS and Android?

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

8 participants