Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions app/views/RoomView/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,11 @@ Typing.propTypes = {
};

const HeaderTitle = React.memo(({
title, scale, connecting, isFetching
title, scale, connecting
}) => {
if (connecting) {
title = I18n.t('Connecting');
}
if (isFetching) {
title = I18n.t('Updating');
}
return (
<Text
style={[styles.title, { fontSize: TITLE_SIZE * scale }]}
Expand All @@ -87,12 +84,11 @@ const HeaderTitle = React.memo(({
HeaderTitle.propTypes = {
title: PropTypes.string,
scale: PropTypes.number,
connecting: PropTypes.bool,
isFetching: PropTypes.bool
connecting: PropTypes.bool
};

const Header = React.memo(({
title, type, status, usersTyping, width, height, prid, tmid, widthOffset, connecting, isFetching
title, type, status, usersTyping, width, height, prid, tmid, widthOffset, connecting
}) => {
const portrait = height > width;
let scale = 1;
Expand Down Expand Up @@ -126,7 +122,6 @@ const Header = React.memo(({
title={title}
scale={scale}
connecting={connecting}
isFetching={isFetching}
/>
</ScrollView>
</View>
Expand All @@ -145,8 +140,7 @@ Header.propTypes = {
status: PropTypes.string,
usersTyping: PropTypes.array,
widthOffset: PropTypes.number,
connecting: PropTypes.bool,
isFetching: PropTypes.bool
connecting: PropTypes.bool
};

Header.defaultProps = {
Expand Down
9 changes: 2 additions & 7 deletions app/views/RoomView/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export default class RoomHeaderView extends Component {
window: PropTypes.object,
status: PropTypes.string,
connecting: PropTypes.bool,
isFetching: PropTypes.bool,
widthOffset: PropTypes.number,
isLoggedUser: PropTypes.bool,
userId: PropTypes.string
Expand All @@ -66,7 +65,7 @@ export default class RoomHeaderView extends Component {
shouldComponentUpdate(nextProps, nextState) {
const { usersTyping, user } = this.state;
const {
type, title, status, window, connecting, isFetching
type, title, status, window, connecting
} = this.props;
if (nextProps.type !== type) {
return true;
Expand All @@ -80,9 +79,6 @@ export default class RoomHeaderView extends Component {
if (nextProps.connecting !== connecting) {
return true;
}
if (nextProps.isFetching !== isFetching) {
return true;
}
if (nextProps.window.width !== window.width) {
return true;
}
Expand Down Expand Up @@ -118,7 +114,7 @@ export default class RoomHeaderView extends Component {
render() {
const { usersTyping, user } = this.state;
const {
window, title, type, prid, tmid, widthOffset, isLoggedUser, status: userStatus, connecting, isFetching
window, title, type, prid, tmid, widthOffset, isLoggedUser, status: userStatus, connecting
} = this.props;
let status = 'offline';

Expand All @@ -142,7 +138,6 @@ export default class RoomHeaderView extends Component {
usersTyping={usersTyping}
widthOffset={widthOffset}
connecting={connecting}
isFetching={isFetching}
/>
);
}
Expand Down
5 changes: 0 additions & 5 deletions app/views/RoomView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export default class RoomView extends LoggedView {
const title = navigation.getParam('name');
const t = navigation.getParam('t');
const tmid = navigation.getParam('tmid');
const isFetching = navigation.getParam('isFetching', false);
return {
headerTitleContainerStyle: styles.headerTitleContainerStyle,
headerTitle: (
Expand All @@ -77,7 +76,6 @@ export default class RoomView extends LoggedView {
title={title}
type={t}
widthOffset={tmid ? 95 : 130}
isFetching={isFetching}
/>
),
headerRight: <RightButtons rid={rid} tmid={tmid} t={t} navigation={navigation} />
Expand Down Expand Up @@ -332,15 +330,12 @@ export default class RoomView extends LoggedView {

getMessages = async() => {
const { room } = this.state;
const { navigation } = this.props;
try {
navigation.setParams({ isFetching: true });
if (room.lastOpen) {
await RocketChat.loadMissedMessages(room);
} else {
await RocketChat.loadMessagesForRoom(room);
}
navigation.setParams({ isFetching: false });
return Promise.resolve();
} catch (e) {
console.log('TCL: getMessages -> e', e);
Expand Down