From ed7b6fa1003ae06d37446897b485621a5548ebe6 Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Mon, 2 Aug 2021 15:07:34 +0530 Subject: [PATCH 1/2] fix: timerow on language --- src/pages/home/report/ParticipantLocalTime.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ParticipantLocalTime.js b/src/pages/home/report/ParticipantLocalTime.js index 010edcf25ce2..34a04ef17a3e 100644 --- a/src/pages/home/report/ParticipantLocalTime.js +++ b/src/pages/home/report/ParticipantLocalTime.js @@ -1,4 +1,5 @@ import React from 'react'; +import _ from 'underscore'; import { View, } from 'react-native'; @@ -36,7 +37,7 @@ class ParticipantLocalTime extends React.Component { } shouldComponentUpdate(nextProps, nextState) { - return nextState.localTime !== this.state.localTime; + return !_.isEqual(nextProps, this.props) || nextState.localTime !== this.state.localTime; } componentWillUnmount() { From 6ffb1f892051e29a5ebda9ca5877f967b6149904 Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Mon, 2 Aug 2021 15:20:24 +0530 Subject: [PATCH 2/2] use PureComponent instead --- src/pages/home/report/ParticipantLocalTime.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/pages/home/report/ParticipantLocalTime.js b/src/pages/home/report/ParticipantLocalTime.js index 34a04ef17a3e..9e6b14eda91e 100644 --- a/src/pages/home/report/ParticipantLocalTime.js +++ b/src/pages/home/report/ParticipantLocalTime.js @@ -1,5 +1,4 @@ -import React from 'react'; -import _ from 'underscore'; +import React, {PureComponent} from 'react'; import { View, } from 'react-native'; @@ -19,7 +18,7 @@ const propTypes = { ...withLocalizePropTypes, }; -class ParticipantLocalTime extends React.Component { +class ParticipantLocalTime extends PureComponent { constructor(props) { super(props); this.getParticipantLocalTime = this.getParticipantLocalTime.bind(this); @@ -36,13 +35,8 @@ class ParticipantLocalTime extends React.Component { }, 1000)); } - shouldComponentUpdate(nextProps, nextState) { - return !_.isEqual(nextProps, this.props) || nextState.localTime !== this.state.localTime; - } - componentWillUnmount() { clearInterval(this.timer); - clearInterval(this.readyTimer); } getParticipantLocalTime() {