Skip to content

Commit 70f14a4

Browse files
authored
CustomKeyboardView - remove unsafe methods (UNSAFE_componentWillReceiveProps) (#1160)
1 parent b22b880 commit 70f14a4

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

lib/components/Keyboard/KeyboardInput/CustomKeyboardView.android.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ export default class CustomKeyboardView extends CustomKeyboardViewBase {
1515
onItemSelected: PropTypes.func
1616
};
1717

18-
async UNSAFE_componentWillReceiveProps(nextProps) {
19-
const {component} = nextProps;
18+
async componentDidUpdate(prevProps) {
19+
const {component} = this.props;
2020

21-
if (this.props.component !== component && !component) {
21+
if (prevProps.component !== component && !component) {
2222
await TextInputKeyboardManager.reset();
2323
}
2424

25-
await super.UNSAFE_componentWillReceiveProps(nextProps);
25+
super.componentDidUpdate(prevProps);
2626
}
2727

2828
render() {

lib/components/Keyboard/KeyboardInput/CustomKeyboardView.ios.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ export default class CustomKeyboardView extends CustomKeyboardViewBase {
4747
super.componentWillUnmount();
4848
}
4949

50-
async UNSAFE_componentWillReceiveProps(nextProps) {
51-
const {inputRef: nextInputRef, component: nextComponent, initialProps: nextInitialProps, useSafeArea} = nextProps;
52-
const {component} = this.props;
50+
componentDidUpdate(prevProps) {
51+
const {inputRef: nextInputRef, component: nextComponent, initialProps: nextInitialProps, useSafeArea} = this.props;
52+
const {component} = prevProps;
5353

5454
if (nextInputRef && nextComponent !== component) {
5555
if (nextComponent) {
@@ -63,7 +63,7 @@ export default class CustomKeyboardView extends CustomKeyboardViewBase {
6363
}
6464
}
6565

66-
await super.UNSAFE_componentWillReceiveProps(nextProps);
66+
super.componentDidUpdate(prevProps);
6767
}
6868

6969
render() {

lib/components/Keyboard/KeyboardInput/CustomKeyboardViewBase.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export default class CustomKeyboardViewBase extends Component {
5151
}
5252
}
5353

54-
async UNSAFE_componentWillReceiveProps(nextProps) {
55-
const {onRequestShowKeyboard} = nextProps;
54+
componentDidUpdate(prevProps) {
55+
const {onRequestShowKeyboard} = this.props;
5656

5757
if (onRequestShowKeyboard && !this.registeredRequestShowKeyboard) {
5858
this.registeredRequestShowKeyboard = true;
@@ -61,7 +61,7 @@ export default class CustomKeyboardViewBase extends Component {
6161
});
6262
}
6363

64-
this.registerListener(this.props, nextProps);
64+
this.registerListener(prevProps, this.props);
6565
}
6666

6767
registerListener(props, nextProps) {

0 commit comments

Comments
 (0)