Skip to content

Commit 876f22d

Browse files
rk-for-zulipgnprice
authored andcommitted
connection-status banner: Remove animation
When disconnecting from a VPN on Android 9 and later, the connection state goes from 'vpn' to 'none' to 'wifi' very quickly. This can result in the online banner getting stuck in mid-animation, until some other event (e.g. the user scrolling) causes a redraw. Since the animation is nonessential here (and this is hopefully a rarely-seen UI component anyway), for now, just make it static. Effectively reverts 90f66db.
1 parent b25bca0 commit 876f22d

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/common/OfflineNotice.js

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* @flow strict-local */
22

33
import React, { PureComponent } from 'react';
4-
import { StyleSheet } from 'react-native';
4+
import { StyleSheet, View } from 'react-native';
55

66
import type { Dispatch } from '../types';
77
import { connect } from '../react-redux';
88
import { getSession } from '../selectors';
99
import Label from './Label';
1010

11-
import AnimatedComponent from '../animation/AnimatedComponent';
11+
const key = 'OfflineNotice';
1212

1313
const styles = StyleSheet.create({
1414
block: {
@@ -20,7 +20,9 @@ const styles = StyleSheet.create({
2020
text: {
2121
fontSize: 14,
2222
color: 'white',
23+
margin: 2,
2324
},
25+
none: { display: 'none' },
2426
});
2527

2628
type Props = {|
@@ -37,17 +39,14 @@ type Props = {|
3739
class OfflineNotice extends PureComponent<Props> {
3840
render() {
3941
const { isOnline } = this.props;
42+
if (isOnline) {
43+
return <View key={key} style={styles.none} />;
44+
}
45+
4046
return (
41-
<AnimatedComponent
42-
stylePropertyName="height"
43-
fullValue={30}
44-
useNativeDriver={false}
45-
visible={!isOnline}
46-
style={styles.block}
47-
delay={300}
48-
>
49-
{!isOnline && <Label style={styles.text} text="No Internet connection" />}
50-
</AnimatedComponent>
47+
<View key={key} style={styles.block}>
48+
<Label style={styles.text} text="No Internet connection" />
49+
</View>
5150
);
5251
}
5352
}

0 commit comments

Comments
 (0)