Skip to content

Commit 8ac1002

Browse files
author
Mattia Panzeri
committed
fix(DefaultNotificationBody): Remove now deprecated 'componentWillReceiveProps' method
1 parent 17b3aff commit 8ac1002

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/default-notification-body/index.android.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class DefaultNotificationBody extends React.Component {
4444
this.onSwipe = this.onSwipe.bind(this);
4545
}
4646

47-
componentWillReceiveProps(nextProps) {
48-
if ((this.props.vibrate || nextProps.vibrate) && nextProps.isOpen && !this.props.isOpen) {
47+
componentDidUpdate(prevProps) {
48+
if ((prevProps.vibrate || this.props.vibrate) && this.props.isOpen && !prevProps.isOpen) {
4949
Vibration.vibrate();
5050
}
5151
}

src/default-notification-body/index.ios.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ class DefaultNotificationBody extends React.Component {
6565
this.onSwipe = this.onSwipe.bind(this);
6666
}
6767

68-
componentWillReceiveProps(nextProps) {
69-
if (nextProps.isOpen !== this.props.isOpen) {
70-
StatusBar.setHidden(nextProps.isOpen);
68+
componentDidUpdate(prevProps) {
69+
if (this.props.isOpen !== prevProps.isOpen) {
70+
StatusBar.setHidden(this.props.isOpen);
7171
}
7272

73-
if ((this.props.vibrate || nextProps.vibrate) && nextProps.isOpen && !this.props.isOpen) {
73+
if ((prevProps.vibrate || this.props.vibrate) && this.props.isOpen && !prevProps.isOpen) {
7474
Vibration.vibrate();
7575
}
7676
}

0 commit comments

Comments
 (0)