diff --git a/README.md b/README.md index 6939e3d..4e349d9 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,7 @@ You can try it out with [example](example-expo) project. ## Props - `backgroundColor` _(string)_ - Color of keyboard accessory's background, defaults to `#f6f6f6`. +- `verticalOffset` _(number)_ - Adds a vertical offset, default is 0. ## License diff --git a/src/index.js b/src/index.js index b900013..6c60704 100644 --- a/src/index.js +++ b/src/index.js @@ -11,7 +11,8 @@ import { isIphoneX, getBottomSpace } from 'react-native-iphone-x-helper'; export default class KeyboardAccessory extends Component { static defaultProps = { - backgroundColor: '#f6f6f6' + backgroundColor: '#f6f6f6', + verticalOffset: 0, } constructor(props) { @@ -59,7 +60,10 @@ export default class KeyboardAccessory extends Component { render() { let { bottom } = this.state; - let { children, backgroundColor } = this.props; + let { children, backgroundColor, verticalOffset } = this.props; + if (bottom !== 0) { + bottom = bottom + verticalOffset; + } if (!children) { throw new Error('`children` Missing. You should wrap at least one component into .');