mattermost-mobile/app/components/post_list/post/shimmer_animation.tsx
Mattermost Build e8f1d0c729
Add autotranslations (#9324) (#9500)
* Add autotranslations

* Develop latest changes and missing features

* i18n-extract

* Fix tests and update api behavior

* Fix minor bugs

* adjustments to shimmer animation, showtranslation modal style

* Update post.tsx

* Update show_translation.tsx

* adjust sizing and opacity of translate icon

* Add channel header translated icon

* Disable auto translation item if it is not a supported language

* Move channel info to the top

* Update edit channel to channel info

* Fix align of option items

* Fix i18n

* Add detox related changes for channel settings changes

* Add tests

* Address changes around the my channel column change

* Address feedback

* Fix test

* Fix bad import

* Fix set my channel autotranslation

* Fix test

* Address feedback

* Add missing files from last commit

* Remove unneeded change

---------


(cherry picked from commit 23565b5135)

Co-authored-by: Daniel Espino García <larkox@gmail.com>
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
2026-02-11 08:09:39 +02:00

72 lines
1.9 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {LinearGradient} from 'expo-linear-gradient';
import {StyleSheet, View} from 'react-native';
import Animated from 'react-native-reanimated';
import type {ComponentProps} from 'react';
type Props = {
isTranslating: boolean;
backgroundColor: string;
shimmerAnimatedStyle: ComponentProps<typeof Animated.View>['style'];
gradientColors: ComponentProps<typeof LinearGradient>['colors'];
};
const shimmerStyles = StyleSheet.create({
shimmerContainer: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
overflow: 'hidden',
},
shimmerBackground: {
...StyleSheet.absoluteFillObject,
},
shimmerWrapper: {
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
width: '300%',
},
});
const gradientSettings = {
locations: [0, 0.3, 0.5, 0.7, 1] as const,
start: {x: 0, y: 0},
end: {x: 0.766, y: 0.643}, // 130 degree angle (more severe)
};
const ShimmerAnimation = ({
isTranslating,
backgroundColor,
shimmerAnimatedStyle,
gradientColors,
}: Props) => {
if (!isTranslating) {
return null;
}
return (
<View
style={shimmerStyles.shimmerContainer}
pointerEvents='none'
>
<View style={[shimmerStyles.shimmerBackground, {backgroundColor}]}/>
<Animated.View style={[shimmerStyles.shimmerWrapper, shimmerAnimatedStyle]}>
<LinearGradient
colors={gradientColors}
locations={gradientSettings.locations}
start={gradientSettings.start}
end={gradientSettings.end}
style={StyleSheet.absoluteFill}
/>
</Animated.View>
</View>
);
};
export default ShimmerAnimation;