react-native-material-dropdown icon indicating copy to clipboard operation
react-native-material-dropdown copied to clipboard

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

Open reddo opened this issue 6 years ago • 10 comments

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.

reddo avatar Feb 20 '18 15:02 reddo

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

abartolo avatar May 01 '18 18:05 abartolo

@abartolo nope, still an issue

reddo avatar May 01 '18 19:05 reddo

I have the same issue. Anyone solved?

matteodanelli avatar May 11 '18 09:05 matteodanelli

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

ryachza avatar May 14 '18 16:05 ryachza

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

matteodanelli avatar May 15 '18 18:05 matteodanelli

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

abartolo avatar Jul 02 '18 17:07 abartolo

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

yasir-netlinks avatar Jun 02 '19 07:06 yasir-netlinks

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

damithg-dev avatar Jul 05 '19 04:07 damithg-dev

I have the same issue.

HadisSharif avatar Oct 13 '19 05:10 HadisSharif

@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?

FlorianMerkle avatar Feb 04 '20 14:02 FlorianMerkle