|
|
@@ -24,6 +24,7 @@ import NMIcon from 'assets/icons/nm_icon.svg';
|
|
|
import PremiumIcon from 'assets/icons/premium.svg';
|
|
|
|
|
|
import { styles } from '../../Components/styles';
|
|
|
+import { ActivityIndicator } from 'react-native-paper';
|
|
|
|
|
|
type Props = {
|
|
|
avatar: string | null;
|
|
|
@@ -53,6 +54,7 @@ type Props = {
|
|
|
hideRequest: (id: number) => void;
|
|
|
friendDbId: number;
|
|
|
status: number;
|
|
|
+ loadingStatus: string | null;
|
|
|
};
|
|
|
|
|
|
export const FriendsProfile: FC<Props> = ({
|
|
|
@@ -78,7 +80,8 @@ export const FriendsProfile: FC<Props> = ({
|
|
|
updateFriendStatus,
|
|
|
hideRequest,
|
|
|
friendDbId,
|
|
|
- status
|
|
|
+ status,
|
|
|
+ loadingStatus
|
|
|
}) => {
|
|
|
const navigation = useNavigation();
|
|
|
|
|
|
@@ -104,21 +107,37 @@ export const FriendsProfile: FC<Props> = ({
|
|
|
borderColor: status === 3 ? Colors.RED : Colors.TEXT_GRAY,
|
|
|
paddingVertical: 6,
|
|
|
paddingHorizontal: 10
|
|
|
- }
|
|
|
+ },
|
|
|
+ loadingStatus === `4-${friendDbId}` || loadingStatus === `${friendDbId}`
|
|
|
+ ? { opacity: 0.6 }
|
|
|
+ : {}
|
|
|
]}
|
|
|
onPress={() =>
|
|
|
status === 3 ? updateFriendStatus(4, friendDbId) : hideRequest(friendDbId)
|
|
|
}
|
|
|
+ disabled={
|
|
|
+ status === 3
|
|
|
+ ? loadingStatus === `4-${friendDbId}`
|
|
|
+ : loadingStatus === `${friendDbId}`
|
|
|
+ }
|
|
|
>
|
|
|
- <Text
|
|
|
- style={{
|
|
|
- fontSize: getFontSize(10),
|
|
|
- fontFamily: 'redhat-600',
|
|
|
- color: status === 3 ? Colors.RED : Colors.TEXT_GRAY
|
|
|
- }}
|
|
|
- >
|
|
|
- {status === 3 ? 'Cancel' : 'Hide'}
|
|
|
- </Text>
|
|
|
+ {loadingStatus === `4-${friendDbId}` || loadingStatus === `${friendDbId}` ? (
|
|
|
+ <ActivityIndicator
|
|
|
+ size={13}
|
|
|
+ color={status === 3 ? Colors.RED : Colors.TEXT_GRAY}
|
|
|
+ style={{ paddingHorizontal: 6 }}
|
|
|
+ />
|
|
|
+ ) : (
|
|
|
+ <Text
|
|
|
+ style={{
|
|
|
+ fontSize: getFontSize(10),
|
|
|
+ fontFamily: 'redhat-600',
|
|
|
+ color: status === 3 ? Colors.RED : Colors.TEXT_GRAY
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {status === 3 ? 'Cancel' : 'Hide'}
|
|
|
+ </Text>
|
|
|
+ )}
|
|
|
</TouchableOpacity>
|
|
|
</View>
|
|
|
);
|
|
|
@@ -136,20 +155,30 @@ export const FriendsProfile: FC<Props> = ({
|
|
|
borderColor: Colors.ORANGE,
|
|
|
paddingVertical: 6,
|
|
|
paddingHorizontal: 10
|
|
|
- }
|
|
|
+ },
|
|
|
+ loadingStatus === `1-${friendDbId}` ? { opacity: 0.6 } : {}
|
|
|
]}
|
|
|
onPress={() => updateFriendStatus(1, friendDbId)}
|
|
|
+ disabled={loadingStatus === `1-${friendDbId}`}
|
|
|
>
|
|
|
- <Text
|
|
|
- style={[
|
|
|
- styles.statusTextSmall,
|
|
|
- {
|
|
|
- color: Colors.ORANGE
|
|
|
- }
|
|
|
- ]}
|
|
|
- >
|
|
|
- Approve
|
|
|
- </Text>
|
|
|
+ {loadingStatus === `1-${friendDbId}` ? (
|
|
|
+ <ActivityIndicator
|
|
|
+ size={13}
|
|
|
+ color={Colors.ORANGE}
|
|
|
+ style={{ paddingHorizontal: 12 }}
|
|
|
+ />
|
|
|
+ ) : (
|
|
|
+ <Text
|
|
|
+ style={[
|
|
|
+ styles.statusTextSmall,
|
|
|
+ {
|
|
|
+ color: Colors.ORANGE
|
|
|
+ }
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ Approve
|
|
|
+ </Text>
|
|
|
+ )}
|
|
|
</TouchableOpacity>
|
|
|
<TouchableOpacity
|
|
|
style={[
|
|
|
@@ -159,20 +188,30 @@ export const FriendsProfile: FC<Props> = ({
|
|
|
borderColor: Colors.RED,
|
|
|
paddingVertical: 6,
|
|
|
paddingHorizontal: 10
|
|
|
- }
|
|
|
+ },
|
|
|
+ loadingStatus === `2-${friendDbId}` ? { opacity: 0.6 } : {}
|
|
|
]}
|
|
|
onPress={() => updateFriendStatus(2, friendDbId)}
|
|
|
+ disabled={loadingStatus === `2-${friendDbId}`}
|
|
|
>
|
|
|
- <Text
|
|
|
- style={[
|
|
|
- styles.statusTextSmall,
|
|
|
- {
|
|
|
- color: Colors.RED
|
|
|
- }
|
|
|
- ]}
|
|
|
- >
|
|
|
- Deny
|
|
|
- </Text>
|
|
|
+ {loadingStatus === `2-${friendDbId}` ? (
|
|
|
+ <ActivityIndicator
|
|
|
+ size={13}
|
|
|
+ color={Colors.RED}
|
|
|
+ style={{ paddingHorizontal: 6 }}
|
|
|
+ />
|
|
|
+ ) : (
|
|
|
+ <Text
|
|
|
+ style={[
|
|
|
+ styles.statusTextSmall,
|
|
|
+ {
|
|
|
+ color: Colors.RED
|
|
|
+ }
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ Deny
|
|
|
+ </Text>
|
|
|
+ )}
|
|
|
</TouchableOpacity>
|
|
|
</>
|
|
|
) : (
|