Skip to content

Commit d8754b9

Browse files
committed
Don't require the onRef prop.
1 parent 00ea9b1 commit d8754b9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

VirtualKeyboard.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ class VirtualKeyboard extends Component {
3535
* Executed when the component is mounted to the screen.
3636
*/
3737
componentDidMount() {
38-
this.props.onRef(this);
38+
if(this.props.onRef) {
39+
this.props.onRef(this);
40+
}
3941
}
4042

4143
/**
@@ -44,7 +46,9 @@ class VirtualKeyboard extends Component {
4446
* Executed when the component is unmounted from the screen
4547
*/
4648
componentWillUnmount() {
47-
this.props.onRef(undefined);
49+
if(this.props.onRef) {
50+
this.props.onRef(undefined);
51+
}
4852
}
4953

5054
/**
@@ -292,7 +296,7 @@ class VirtualKeyboard extends Component {
292296
const stylePropType = PropTypes.oneOfType([PropTypes.number, PropTypes.object, PropTypes.array, PropTypes.bool]);
293297

294298
VirtualKeyboard.propTypes = {
295-
onRef: PropTypes.any.isRequired,
299+
onRef: PropTypes.any,
296300
onKeyDown: PropTypes.func,
297301
onChange: PropTypes.func,
298302
onCustomKey: PropTypes.func,

0 commit comments

Comments
 (0)