Remove "updating" indicator inside the room (#895)
This commit is contained in:
parent
48b53e852a
commit
b03f69c6f3
|
@ -66,14 +66,11 @@ Typing.propTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const HeaderTitle = React.memo(({
|
const HeaderTitle = React.memo(({
|
||||||
title, scale, connecting, isFetching
|
title, scale, connecting
|
||||||
}) => {
|
}) => {
|
||||||
if (connecting) {
|
if (connecting) {
|
||||||
title = I18n.t('Connecting');
|
title = I18n.t('Connecting');
|
||||||
}
|
}
|
||||||
if (isFetching) {
|
|
||||||
title = I18n.t('Updating');
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<Text
|
<Text
|
||||||
style={[styles.title, { fontSize: TITLE_SIZE * scale }]}
|
style={[styles.title, { fontSize: TITLE_SIZE * scale }]}
|
||||||
|
@ -87,12 +84,11 @@ const HeaderTitle = React.memo(({
|
||||||
HeaderTitle.propTypes = {
|
HeaderTitle.propTypes = {
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
scale: PropTypes.number,
|
scale: PropTypes.number,
|
||||||
connecting: PropTypes.bool,
|
connecting: PropTypes.bool
|
||||||
isFetching: PropTypes.bool
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const Header = React.memo(({
|
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;
|
const portrait = height > width;
|
||||||
let scale = 1;
|
let scale = 1;
|
||||||
|
@ -126,7 +122,6 @@ const Header = React.memo(({
|
||||||
title={title}
|
title={title}
|
||||||
scale={scale}
|
scale={scale}
|
||||||
connecting={connecting}
|
connecting={connecting}
|
||||||
isFetching={isFetching}
|
|
||||||
/>
|
/>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>
|
</View>
|
||||||
|
@ -145,8 +140,7 @@ Header.propTypes = {
|
||||||
status: PropTypes.string,
|
status: PropTypes.string,
|
||||||
usersTyping: PropTypes.array,
|
usersTyping: PropTypes.array,
|
||||||
widthOffset: PropTypes.number,
|
widthOffset: PropTypes.number,
|
||||||
connecting: PropTypes.bool,
|
connecting: PropTypes.bool
|
||||||
isFetching: PropTypes.bool
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Header.defaultProps = {
|
Header.defaultProps = {
|
||||||
|
|
|
@ -42,7 +42,6 @@ export default class RoomHeaderView extends Component {
|
||||||
window: PropTypes.object,
|
window: PropTypes.object,
|
||||||
status: PropTypes.string,
|
status: PropTypes.string,
|
||||||
connecting: PropTypes.bool,
|
connecting: PropTypes.bool,
|
||||||
isFetching: PropTypes.bool,
|
|
||||||
widthOffset: PropTypes.number,
|
widthOffset: PropTypes.number,
|
||||||
isLoggedUser: PropTypes.bool,
|
isLoggedUser: PropTypes.bool,
|
||||||
userId: PropTypes.string
|
userId: PropTypes.string
|
||||||
|
@ -66,7 +65,7 @@ export default class RoomHeaderView extends Component {
|
||||||
shouldComponentUpdate(nextProps, nextState) {
|
shouldComponentUpdate(nextProps, nextState) {
|
||||||
const { usersTyping, user } = this.state;
|
const { usersTyping, user } = this.state;
|
||||||
const {
|
const {
|
||||||
type, title, status, window, connecting, isFetching
|
type, title, status, window, connecting
|
||||||
} = this.props;
|
} = this.props;
|
||||||
if (nextProps.type !== type) {
|
if (nextProps.type !== type) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -80,9 +79,6 @@ export default class RoomHeaderView extends Component {
|
||||||
if (nextProps.connecting !== connecting) {
|
if (nextProps.connecting !== connecting) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (nextProps.isFetching !== isFetching) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (nextProps.window.width !== window.width) {
|
if (nextProps.window.width !== window.width) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +114,7 @@ export default class RoomHeaderView extends Component {
|
||||||
render() {
|
render() {
|
||||||
const { usersTyping, user } = this.state;
|
const { usersTyping, user } = this.state;
|
||||||
const {
|
const {
|
||||||
window, title, type, prid, tmid, widthOffset, isLoggedUser, status: userStatus, connecting, isFetching
|
window, title, type, prid, tmid, widthOffset, isLoggedUser, status: userStatus, connecting
|
||||||
} = this.props;
|
} = this.props;
|
||||||
let status = 'offline';
|
let status = 'offline';
|
||||||
|
|
||||||
|
@ -142,7 +138,6 @@ export default class RoomHeaderView extends Component {
|
||||||
usersTyping={usersTyping}
|
usersTyping={usersTyping}
|
||||||
widthOffset={widthOffset}
|
widthOffset={widthOffset}
|
||||||
connecting={connecting}
|
connecting={connecting}
|
||||||
isFetching={isFetching}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ export default class RoomView extends LoggedView {
|
||||||
const title = navigation.getParam('name');
|
const title = navigation.getParam('name');
|
||||||
const t = navigation.getParam('t');
|
const t = navigation.getParam('t');
|
||||||
const tmid = navigation.getParam('tmid');
|
const tmid = navigation.getParam('tmid');
|
||||||
const isFetching = navigation.getParam('isFetching', false);
|
|
||||||
return {
|
return {
|
||||||
headerTitleContainerStyle: styles.headerTitleContainerStyle,
|
headerTitleContainerStyle: styles.headerTitleContainerStyle,
|
||||||
headerTitle: (
|
headerTitle: (
|
||||||
|
@ -77,7 +76,6 @@ export default class RoomView extends LoggedView {
|
||||||
title={title}
|
title={title}
|
||||||
type={t}
|
type={t}
|
||||||
widthOffset={tmid ? 95 : 130}
|
widthOffset={tmid ? 95 : 130}
|
||||||
isFetching={isFetching}
|
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
headerRight: <RightButtons rid={rid} tmid={tmid} t={t} navigation={navigation} />
|
headerRight: <RightButtons rid={rid} tmid={tmid} t={t} navigation={navigation} />
|
||||||
|
@ -332,15 +330,12 @@ export default class RoomView extends LoggedView {
|
||||||
|
|
||||||
getMessages = async() => {
|
getMessages = async() => {
|
||||||
const { room } = this.state;
|
const { room } = this.state;
|
||||||
const { navigation } = this.props;
|
|
||||||
try {
|
try {
|
||||||
navigation.setParams({ isFetching: true });
|
|
||||||
if (room.lastOpen) {
|
if (room.lastOpen) {
|
||||||
await RocketChat.loadMissedMessages(room);
|
await RocketChat.loadMissedMessages(room);
|
||||||
} else {
|
} else {
|
||||||
await RocketChat.loadMessagesForRoom(room);
|
await RocketChat.loadMessagesForRoom(room);
|
||||||
}
|
}
|
||||||
navigation.setParams({ isFetching: false });
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('TCL: getMessages -> e', e);
|
console.log('TCL: getMessages -> e', e);
|
||||||
|
|
Loading…
Reference in New Issue