Remove "updating" indicator inside the room (#895)

This commit is contained in:
Diego Mello 2019-05-14 17:06:17 -03:00 committed by GitHub
parent 48b53e852a
commit b03f69c6f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 22 deletions

View File

@ -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 }]}
@ -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;
@ -126,7 +122,6 @@ const Header = React.memo(({
title={title}
scale={scale}
connecting={connecting}
isFetching={isFetching}
/>
</ScrollView>
</View>
@ -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 = {

View File

@ -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
@ -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;
@ -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;
}
@ -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';
@ -142,7 +138,6 @@ export default class RoomHeaderView extends Component {
usersTyping={usersTyping}
widthOffset={widthOffset}
connecting={connecting}
isFetching={isFetching}
/>
);
}

View File

@ -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: (
@ -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} />
@ -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);