Skip to content

Commit

Permalink
Merge pull request #8 from leonidasKap/keyboard-opacity
Browse files Browse the repository at this point in the history
Ensures that the keyboard accessory view does not obscure other UI elements when keyboard is hidden
  • Loading branch information
ardaogulcan authored Mar 14, 2018
2 parents 7a29bfc + 81ec95d commit ec7c03e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/KeyboardAccessoryView.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class KeyboardAccessoryView extends Component {
this.state = {
keyboardHeight: 0,
accessoryHeight: 50,
visibleAccessoryHeight: 50,
isKeyboardVisible: false,
}

Expand All @@ -68,7 +69,8 @@ class KeyboardAccessoryView extends Component {

handleChildrenLayout(layoutEvent) {
this.setState({
accessoryHeight: layoutEvent.nativeEvent.layout.height,
visibleAccessoryHeight: layoutEvent.nativeEvent.layout.height,
accessoryHeight: this.props.alwaysVisible ? layoutEvent.nativeEvent.layout.height : 0,
});
}

Expand All @@ -88,6 +90,7 @@ class KeyboardAccessoryView extends Component {
this.setState({
isKeyboardVisible: true,
keyboardHeight: keyboardEvent.endCoordinates.height,
accessoryHeight: this.state.visibleAccessoryHeight,
})
}

Expand All @@ -103,6 +106,7 @@ class KeyboardAccessoryView extends Component {
this.setState({
isKeyboardVisible: false,
keyboardHeight: 0,
accessoryHeight: this.props.alwaysVisible ? this.state.visibleAccessoryHeight : 0,
})
}

Expand Down

0 comments on commit ec7c03e

Please sign in to comment.