diff options
Diffstat (limited to 'src/components/common')
-rw-r--r-- | src/components/common/Avatar.tsx | 23 | ||||
-rw-r--r-- | src/components/common/BottomDrawer.tsx | 11 |
2 files changed, 23 insertions, 11 deletions
diff --git a/src/components/common/Avatar.tsx b/src/components/common/Avatar.tsx index 831cf906..86ebedf3 100644 --- a/src/components/common/Avatar.tsx +++ b/src/components/common/Avatar.tsx @@ -1,17 +1,30 @@ import React, {FC} from 'react'; -import {Image, ImageStyle, StyleProp} from 'react-native'; +import {Image, ImageStyle, StyleProp, ImageBackground} from 'react-native'; type AvatarProps = { style: StyleProp<ImageStyle>; uri: string | undefined; + loading: boolean; + loadingStyle: StyleProp<ImageStyle> | undefined; }; -const Avatar: FC<AvatarProps> = ({style, uri}) => { +const Avatar: FC<AvatarProps> = ({ + style, + uri, + loading = false, + loadingStyle, +}) => { return ( - <Image + <ImageBackground style={style} defaultSource={require('../../assets/images/avatar-placeholder.png')} - source={{uri, cache: 'reload'}} - /> + source={{uri, cache: 'reload'}}> + {loading && ( + <Image + source={require('../../assets/gifs/loading-animation.gif')} + style={loadingStyle} + /> + )} + </ImageBackground> ); }; diff --git a/src/components/common/BottomDrawer.tsx b/src/components/common/BottomDrawer.tsx index 3d9c0471..16e98690 100644 --- a/src/components/common/BottomDrawer.tsx +++ b/src/components/common/BottomDrawer.tsx @@ -71,15 +71,14 @@ const BottomDrawer: React.FC<BottomDrawerProps> = (props) => { enabledContentGestureInteraction={false} callbackNode={bgAlpha} onCloseEnd={() => { - setModalVisible(false); - setIsOpen(false); + if (!isOpen) { + setModalVisible(false); + setIsOpen(false); + } }} /> - <TouchableWithoutFeedback - onPress={() => { - setIsOpen(false); - }}> + <TouchableWithoutFeedback onPress={() => setIsOpen(false)}> <Animated.View style={[styles.backgroundView, {backgroundColor}]} /> </TouchableWithoutFeedback> </Modal> |