浏览代码

tab bar in settings screen fix

Viktoriia 4 月之前
父节点
当前提交
a86c02bed7
共有 1 个文件被更改,包括 21 次插入3 次删除
  1. 21 3
      src/screens/InAppScreens/MessagesScreen/GroupSettingsScreen/index.tsx

+ 21 - 3
src/screens/InAppScreens/MessagesScreen/GroupSettingsScreen/index.tsx

@@ -1,6 +1,6 @@
 import React, { FC, useEffect, useState } from 'react';
 import { ScrollView, Text, TouchableOpacity, View, Image, StyleSheet } from 'react-native';
-import { NavigationProp } from '@react-navigation/native';
+import { NavigationProp, useFocusEffect } from '@react-navigation/native';
 import ImageView from 'react-native-image-viewing';
 import { storage, StoreType } from 'src/storage';
 import {
@@ -31,6 +31,7 @@ import UserPlusIcon from 'assets/icons/user-plus.svg';
 import { NAVIGATION_PAGES } from 'src/types';
 import { SheetManager } from 'react-native-actions-sheet';
 import EditGroupModal from '../Components/EditGroupModal';
+import { useBottomTabBarHeight } from '@react-navigation/bottom-tabs';
 
 type Props = {
   navigation: NavigationProp<any>;
@@ -41,6 +42,7 @@ const GroupSettingScreen: FC<Props> = ({ navigation, route }) => {
   const token = storage.get('token', StoreType.STRING) as string;
   const groupToken = route.params.groupToken;
   const insets = useSafeAreaInsets();
+  const tabBarHeight = useBottomTabBarHeight();
   const [canSeeMembers, setCanSeeMembers] = useState(false);
   const { data, refetch } = usePostGetGroupSettingsQuery(token, groupToken, true);
   const { data: members, refetch: refetchMembers } = usePostGetGroupMembersQuery(
@@ -62,6 +64,14 @@ const GroupSettingScreen: FC<Props> = ({ navigation, route }) => {
   const { mutateAsync: leaveGroup } = usePostLeaveGroupMutation();
   const { mutateAsync: removeGroupFromList } = usePostRemoveGroupFromListMutation();
 
+  useFocusEffect(() => {
+    navigation.getParent()?.setOptions({
+      tabBarStyle: {
+        display: 'none'
+      }
+    });
+  });
+
   useEffect(() => {
     if (data && data.settings) {
       setCanSeeMembers(data.settings.members_can_see_members === 1 || data.settings.admin === 1);
@@ -165,7 +175,7 @@ const GroupSettingScreen: FC<Props> = ({ navigation, route }) => {
         showsVerticalScrollIndicator={false}
         style={{ flex: 1 }}
         contentContainerStyle={{
-          paddingBottom: insets.bottom,
+          paddingBottom: insets.bottom + tabBarHeight,
           justifyContent: 'space-between',
           flex: 1
         }}
@@ -230,7 +240,15 @@ const GroupSettingScreen: FC<Props> = ({ navigation, route }) => {
                   ? members.settings.slice(0, 4)
                   : members.settings
                 ).map((member, index) => (
-                  <TouchableOpacity key={index} style={styles.userItem} onPress={() => {}}>
+                  <TouchableOpacity
+                    key={index}
+                    style={styles.userItem}
+                    onPress={() =>
+                      navigation.navigate(
+                        ...([NAVIGATION_PAGES.PUBLIC_PROFILE_VIEW, { userId: member.uid }] as never)
+                      )
+                    }
+                  >
                     {member.avatar ? (
                       <Image source={{ uri: API_HOST + member.avatar }} style={styles.avatar} />
                     ) : (