n4kz / react-native-pages

Easy to use page view component
Other
376 stars 83 forks source link

keyboardDismissMode='on-drag' doesn't work #40

Closed j1mbl3s closed 4 years ago

j1mbl3s commented 4 years ago

We want to dismiss the keyboard when scrolling to another page. It seems that setting the keyboardDismissMode prop to 'on-drag', for the ScrollView, doesn't do anything. Using onScrollEnd prop is not what we want, because we allow other components to focus after using the scrollToPage(page) method - onScrollEnd={() => Keyboard.dismiss()} results in unwanted behavior. Edit: Using react-native 0.60.5

j1mbl3s commented 4 years ago

A simple solution that I can think of would be to allow hooks to the onScrollBeginDrag() method (and to other ScrollView props that are defined) by allowing the user to set their own onScrollBeginDrag prop and calling like so:

src/components/pages/index.js

  ...
  onScrollBeginDrag() {
    this.scrollState = 0;
    this.props.onScrollBeginDrag();
  }
  ...

This doesn't necessarily fix this problem but would allow users to potentially fix it themselves and add some nice functionality.

n4kz commented 4 years ago

Thanks for issue! Looks like keyboardDismissMode is not working on Android at all for this moment, as described in facebook/react-native#23364. I've added onScrollStart callback and released it in 0.9.0.

j1mbl3s commented 4 years ago

Didn't realize this was an issue with RN's ScrollView itself. Thanks!