Merge branch 'develop' into improvement.typescript-migration

# Conflicts:
#	app/containers/Loading.tsx
This commit is contained in:
AlexAlexandre 2021-08-16 20:57:40 -03:00
commit 1737756b43
3 changed files with 1589 additions and 2742 deletions

View File

@ -1,12 +1,13 @@
import React from 'react'; import React from 'react';
import { StyleSheet, View, Modal, Animated } from 'react-native'; import { StyleSheet, Modal, Animated , View } from 'react-native';
import { withTheme } from '../theme';
import { themes } from '../constants/colors';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center'
backgroundColor: 'rgba(0, 0, 0, 0.25)'
}, },
image: { image: {
width: 100, width: 100,
@ -17,9 +18,10 @@ const styles = StyleSheet.create({
interface ILoadingProps { interface ILoadingProps {
visible: boolean; visible: boolean;
theme: string;
} }
export default class Loading extends React.PureComponent<ILoadingProps, any> { class Loading extends React.PureComponent<ILoadingProps, any> {
state = { state = {
scale: new Animated.Value(1), scale: new Animated.Value(1),
@ -36,7 +38,7 @@ export default class Loading extends React.PureComponent<ILoadingProps, any> {
opacity, opacity,
{ {
toValue: 1, toValue: 1,
duration: 1000, duration: 200,
useNativeDriver: true useNativeDriver: true
} }
); );
@ -91,23 +93,40 @@ export default class Loading extends React.PureComponent<ILoadingProps, any> {
render() { render() {
const { opacity, scale } = this.state; const { opacity, scale } = this.state;
const { visible } = this.props; const { visible, theme } = this.props;
const scaleAnimation = scale.interpolate({ const scaleAnimation = scale.interpolate({
inputRange: [0, 0.5, 1], inputRange: [0, 0.5, 1],
outputRange: [1, 1.1, 1] outputRange: [1, 1.1, 1]
}); });
const opacityAnimation = opacity.interpolate({
inputRange: [0, 1],
outputRange: [0, themes[theme].backdropOpacity],
extrapolate: 'clamp'
});
return ( return (
<Modal <Modal
visible={visible} visible={visible}
transparent transparent
onRequestClose={() => {}} onRequestClose={() => {}}
> >
<View style={styles.container} testID='loading'> <View
style={styles.container}
testID='loading'
>
<Animated.View
style={[{
// @ts-ignore
...StyleSheet.absoluteFill,
backgroundColor: themes[theme].backdropColor,
opacity: opacityAnimation
}]}
/>
<Animated.Image <Animated.Image
source={require('../static/images/logo.png')} source={require('../static/images/logo.png')}
style={[styles.image, { style={[styles.image, {
opacity,
transform: [{ transform: [{
scale: scaleAnimation scale: scaleAnimation
}] }]
@ -118,3 +137,5 @@ export default class Loading extends React.PureComponent<ILoadingProps, any> {
); );
} }
} }
export default (withTheme(Loading));

View File

@ -415,11 +415,6 @@ class RoomInfoEditView extends React.Component {
return permissions[PERMISSION_DELETE_C]; return permissions[PERMISSION_DELETE_C];
} }
hasArchivePermission = () => {
const { permissions } = this.state;
return (permissions[PERMISSION_ARCHIVE] || permissions[PERMISSION_UNARCHIVE]);
};
renderSystemMessages = () => { renderSystemMessages = () => {
const { systemMessages, enableSysMes } = this.state; const { systemMessages, enableSysMes } = this.state;
const { theme } = this.props; const { theme } = this.props;
@ -691,11 +686,11 @@ class RoomInfoEditView extends React.Component {
style={[ style={[
styles.buttonInverted, styles.buttonInverted,
styles.buttonContainer_inverted, styles.buttonContainer_inverted,
!this.hasArchivePermission() && sharedStyles.opacity5, archived ? !permissions[PERMISSION_UNARCHIVE] && sharedStyles.opacity5 : !permissions[PERMISSION_ARCHIVE] && sharedStyles.opacity5,
{ flex: 1, marginLeft: 10, borderColor: dangerColor } { flex: 1, marginLeft: 10, borderColor: dangerColor }
]} ]}
onPress={this.toggleArchive} 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'} testID={archived ? 'room-info-edit-view-unarchive' : 'room-info-edit-view-archive'}
> >
<Text <Text

4283
yarn.lock

File diff suppressed because it is too large Load Diff