diff options
Diffstat (limited to 'src/screens')
| -rw-r--r-- | src/screens/chat/ChatResultsCell.tsx | 9 | ||||
| -rw-r--r-- | src/screens/chat/ChatResultsList.tsx | 19 | ||||
| -rw-r--r-- | src/screens/chat/ChatSearchBar.tsx | 9 | ||||
| -rw-r--r-- | src/screens/chat/NewChatModal.tsx | 3 |
4 files changed, 12 insertions, 28 deletions
diff --git a/src/screens/chat/ChatResultsCell.tsx b/src/screens/chat/ChatResultsCell.tsx index 00f7130d..3678a2d7 100644 --- a/src/screens/chat/ChatResultsCell.tsx +++ b/src/screens/chat/ChatResultsCell.tsx @@ -2,14 +2,12 @@ import {useNavigation} from '@react-navigation/native'; import React, {useContext, useEffect, useState} from 'react'; import {Alert, Image, StyleSheet, Text, View} from 'react-native'; import {TouchableOpacity} from 'react-native-gesture-handler'; -import {useDispatch, useSelector, useStore} from 'react-redux'; +import {ChatContext} from '../../App'; +import {ERROR_FAILED_TO_CREATE_CHANNEL} from '../../constants/strings'; import {loadImageFromURL} from '../../services'; -import {RootState} from '../../store/rootReducer'; import {ProfilePreviewType, UserType} from '../../types'; import {createChannel, normalize, SCREEN_WIDTH} from '../../utils'; import {defaultUserProfile} from '../../utils/users'; -import {ChatContext} from '../../App'; -import {ERROR_FAILED_TO_CREATE_CHANNEL} from '../../constants/strings'; interface ChatResults { profileData: ProfilePreviewType; @@ -24,7 +22,6 @@ const ChatResultsCell: React.FC<ChatResults> = ({ }) => { const [avatar, setAvatar] = useState<string | undefined>(undefined); const {chatClient, setChannel} = useContext(ChatContext); - const {university} = useSelector((state: RootState) => state.user.profile); useEffect(() => { (async () => { @@ -42,8 +39,6 @@ const ChatResultsCell: React.FC<ChatResults> = ({ })(); }, [thumbnail_url]); - const dispatch = useDispatch(); - const state: RootState = useStore().getState(); const navigation = useNavigation(); const createChannelIfNotPresentAndNavigate = async () => { try { diff --git a/src/screens/chat/ChatResultsList.tsx b/src/screens/chat/ChatResultsList.tsx index 17a16572..0c6d58e4 100644 --- a/src/screens/chat/ChatResultsList.tsx +++ b/src/screens/chat/ChatResultsList.tsx @@ -23,16 +23,13 @@ interface ChatResultsProps { setChatModalVisible: Function; } -const sectionHeader: React.FC<Boolean> = () => { - return null; -}; - const ChatResultsList: React.FC<ChatResultsProps> = ({ results, setChatModalVisible, }) => { const [showEmptyView, setshowEmptyView] = useState<boolean>(false); const {user: loggedInUser} = useSelector((state: RootState) => state.user); + const tabbarHeight = useBottomTabBarHeight(); useEffect(() => { if (results && results.length > 0) { @@ -54,7 +51,7 @@ const ChatResultsList: React.FC<ChatResultsProps> = ({ ) : ( <SectionList onScrollBeginDrag={Keyboard.dismiss} - contentContainerStyle={[{paddingBottom: useBottomTabBarHeight()}]} + contentContainerStyle={[{paddingBottom: tabbarHeight}]} sections={results} keyExtractor={(item, index) => item.id + index} renderItem={({item}) => { @@ -68,12 +65,7 @@ const ChatResultsList: React.FC<ChatResultsProps> = ({ }} stickySectionHeadersEnabled={false} ListEmptyComponent={() => ( - <View - style={{ - marginTop: 20, - justifyContent: 'center', - alignItems: 'center', - }}> + <View style={styles.empty}> <Text>Start a new chat by searching for someone</Text> </View> )} @@ -102,6 +94,11 @@ const styles = StyleSheet.create({ fontWeight: '500', fontSize: normalize(14), }, + empty: { + marginTop: 20, + justifyContent: 'center', + alignItems: 'center', + }, }); export default ChatResultsList; diff --git a/src/screens/chat/ChatSearchBar.tsx b/src/screens/chat/ChatSearchBar.tsx index 294efa57..4916ec45 100644 --- a/src/screens/chat/ChatSearchBar.tsx +++ b/src/screens/chat/ChatSearchBar.tsx @@ -1,4 +1,4 @@ -import React, {useEffect, useState} from 'react'; +import React from 'react'; import { Keyboard, NativeSyntheticEvent, @@ -10,16 +10,9 @@ import { TouchableOpacity, View, ViewStyle, - LayoutChangeEvent, } from 'react-native'; import {normalize} from 'react-native-elements'; import Animated, {useAnimatedStyle} from 'react-native-reanimated'; -import Icon from 'react-native-vector-icons/Feather'; -import {useSelector} from 'react-redux'; -import {RootState} from '../../store/rootReducer'; -import {getSearchSuggestions} from '../../utils'; - -const AnimatedIcon = Animated.createAnimatedComponent(Icon); interface SearchBarProps extends TextInputProps { onCancel: () => void; diff --git a/src/screens/chat/NewChatModal.tsx b/src/screens/chat/NewChatModal.tsx index 32a9b667..a7754d3a 100644 --- a/src/screens/chat/NewChatModal.tsx +++ b/src/screens/chat/NewChatModal.tsx @@ -1,5 +1,4 @@ -import {useNavigation} from '@react-navigation/core'; -import React, {useEffect, useRef, useState} from 'react'; +import React, {useEffect, useState} from 'react'; import { Keyboard, SectionListData, |
