mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 16:34:54 +00:00
- Added refetching if the family members when opening My group tab
This commit is contained in:
@ -14,7 +14,7 @@ import {
|
|||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
View,
|
View,
|
||||||
} from "react-native-ui-lib";
|
} from "react-native-ui-lib";
|
||||||
import React, { useEffect, useRef, useState } from "react";
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import { ImageBackground, Platform, StyleSheet } from "react-native";
|
import { ImageBackground, Platform, StyleSheet } from "react-native";
|
||||||
import { PickerSingleValue } from "react-native-ui-lib/src/components/picker/types";
|
import { PickerSingleValue } from "react-native-ui-lib/src/components/picker/types";
|
||||||
import { useCreateSubUser } from "@/hooks/firebase/useCreateSubUser";
|
import { useCreateSubUser } from "@/hooks/firebase/useCreateSubUser";
|
||||||
@ -35,6 +35,7 @@ import { ScrollView } from "react-native-gesture-handler";
|
|||||||
import { useUploadProfilePicture } from "@/hooks/useUploadProfilePicture";
|
import { useUploadProfilePicture } from "@/hooks/useUploadProfilePicture";
|
||||||
import UserOptions from "./UserOptions";
|
import UserOptions from "./UserOptions";
|
||||||
import { colorMap } from "@/constants/colorMap";
|
import { colorMap } from "@/constants/colorMap";
|
||||||
|
import { useFocusEffect } from "@react-navigation/core";
|
||||||
|
|
||||||
type MyGroupProps = {
|
type MyGroupProps = {
|
||||||
onNewUserClick: boolean;
|
onNewUserClick: boolean;
|
||||||
@ -65,7 +66,7 @@ const MyGroup: React.FC<MyGroupProps> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { mutateAsync: createSubUser, isLoading, isError } = useCreateSubUser();
|
const { mutateAsync: createSubUser, isLoading, isError } = useCreateSubUser();
|
||||||
const { data: familyMembers } = useGetFamilyMembers(true);
|
const { data: familyMembers, refetch: refetchFamilyMembers } = useGetFamilyMembers(true);
|
||||||
const { user } = useAuthContext();
|
const { user } = useAuthContext();
|
||||||
const {
|
const {
|
||||||
pickImage,
|
pickImage,
|
||||||
@ -75,6 +76,12 @@ const MyGroup: React.FC<MyGroupProps> = ({
|
|||||||
profileImageAsset,
|
profileImageAsset,
|
||||||
} = useUploadProfilePicture(newUserId);
|
} = useUploadProfilePicture(newUserId);
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
refetchFamilyMembers();
|
||||||
|
}, [refetchFamilyMembers])
|
||||||
|
);
|
||||||
|
|
||||||
const parents =
|
const parents =
|
||||||
familyMembers?.filter((x) => x.userType === ProfileType.PARENT) ?? [];
|
familyMembers?.filter((x) => x.userType === ProfileType.PARENT) ?? [];
|
||||||
const children =
|
const children =
|
||||||
|
|||||||
Reference in New Issue
Block a user