brentvatne / stargrave-0

preserving my stars for vanity. former home of react-native-modal
389 stars 65 forks source link

Modal position will not automatically pushed up when in keyboard input mode #35

Closed bright-sea closed 7 years ago

bright-sea commented 9 years ago

For example, we have some input field in Modal, when we focus on this field, a keyboard will popup and overlay the Modal. We can't see input field and this is bad.

Is it possible for Modal automatically scroll up to show the input field currently focused?

screen shot 2015-07-17 at 12 13 32 pm screen shot 2015-07-17 at 12 13 46 pm

grabbou commented 9 years ago

https://medium.com/man-moon/writing-modern-react-native-ui-e317ff956f02 I am using this approach and it works well :)

grabbou commented 9 years ago
handleModalClick() {
    if (this.props.isKeyboardOpened) {
      return this.refs.form.blur();
    }
    this.props.onClose(false);
  }

and pass it to onPressBackdrop. Clicking on the background will hide keyboard first instead of the whole modal.