diff --git a/lib/KeyboardAccessoryView.js b/lib/KeyboardAccessoryView.js index 97cd803..dfb030e 100644 --- a/lib/KeyboardAccessoryView.js +++ b/lib/KeyboardAccessoryView.js @@ -46,6 +46,7 @@ class KeyboardAccessoryView extends Component { this.state = { keyboardHeight: 0, accessoryHeight: 50, + visibleAccessoryHeight: 50, isKeyboardVisible: false, } @@ -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, }); } @@ -88,6 +90,7 @@ class KeyboardAccessoryView extends Component { this.setState({ isKeyboardVisible: true, keyboardHeight: keyboardEvent.endCoordinates.height, + accessoryHeight: this.state.visibleAccessoryHeight, }) } @@ -103,6 +106,7 @@ class KeyboardAccessoryView extends Component { this.setState({ isKeyboardVisible: false, keyboardHeight: 0, + accessoryHeight: this.props.alwaysVisible ? this.state.visibleAccessoryHeight : 0, }) }