diff --git a/app/containers/Loading.js b/app/containers/Loading.js index 656e476af..76ca8a3f2 100644 --- a/app/containers/Loading.js +++ b/app/containers/Loading.js @@ -1,15 +1,16 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - StyleSheet, View, Modal, Animated + StyleSheet, Modal, Animated, View } from 'react-native'; +import { withTheme } from '../theme'; +import { themes } from '../constants/colors'; const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', - justifyContent: 'center', - backgroundColor: 'rgba(0, 0, 0, 0.25)' + justifyContent: 'center' }, image: { width: 100, @@ -18,9 +19,10 @@ const styles = StyleSheet.create({ } }); -export default class Loading extends React.PureComponent { +class Loading extends React.PureComponent { static propTypes = { - visible: PropTypes.bool.isRequired + visible: PropTypes.bool, + theme: PropTypes.string } state = { @@ -36,7 +38,7 @@ export default class Loading extends React.PureComponent { opacity, { toValue: 1, - duration: 1000, + duration: 200, useNativeDriver: true } ); @@ -91,23 +93,39 @@ export default class Loading extends React.PureComponent { render() { const { opacity, scale } = this.state; - const { visible } = this.props; + const { visible, theme } = this.props; const scaleAnimation = scale.interpolate({ inputRange: [0, 0.5, 1], outputRange: [1, 1.1, 1] }); + + const opacityAnimation = opacity.interpolate({ + inputRange: [0, 1], + outputRange: [0, themes[theme].backdropOpacity], + extrapolate: 'clamp' + }); + return ( {}} > - + + { - const { permissions } = this.state; - return (permissions[PERMISSION_ARCHIVE] || permissions[PERMISSION_UNARCHIVE]); - }; - renderSystemMessages = () => { const { systemMessages, enableSysMes } = this.state; const { theme } = this.props; @@ -691,11 +686,11 @@ class RoomInfoEditView extends React.Component { style={[ styles.buttonInverted, styles.buttonContainer_inverted, - !this.hasArchivePermission() && sharedStyles.opacity5, + archived ? !permissions[PERMISSION_UNARCHIVE] && sharedStyles.opacity5 : !permissions[PERMISSION_ARCHIVE] && sharedStyles.opacity5, { flex: 1, marginLeft: 10, borderColor: dangerColor } ]} onPress={this.toggleArchive} - disabled={!this.hasArchivePermission()} + disabled={archived ? !permissions[PERMISSION_UNARCHIVE] : !permissions[PERMISSION_ARCHIVE]} testID={archived ? 'room-info-edit-view-unarchive' : 'room-info-edit-view-archive'} >