|
@@ -31,7 +31,7 @@ import {
|
|
LongPressGestureHandler,
|
|
LongPressGestureHandler,
|
|
Swipeable
|
|
Swipeable
|
|
} from 'react-native-gesture-handler';
|
|
} from 'react-native-gesture-handler';
|
|
-import { Header } from 'src/components';
|
|
|
|
|
|
+import { AvatarWithInitials, Header } from 'src/components';
|
|
import { Colors } from 'src/theme';
|
|
import { Colors } from 'src/theme';
|
|
import { useFocusEffect, useNavigation } from '@react-navigation/native';
|
|
import { useFocusEffect, useNavigation } from '@react-navigation/native';
|
|
import { Video } from 'expo-av';
|
|
import { Video } from 'expo-av';
|
|
@@ -61,6 +61,7 @@ import EmojiSelectorModal from '../Components/EmojiSelectorModal';
|
|
import { styles } from './styles';
|
|
import { styles } from './styles';
|
|
import SendIcon from 'assets/icons/messages/send.svg';
|
|
import SendIcon from 'assets/icons/messages/send.svg';
|
|
import { SheetManager } from 'react-native-actions-sheet';
|
|
import { SheetManager } from 'react-native-actions-sheet';
|
|
|
|
+import { NAVIGATION_PAGES } from 'src/types';
|
|
|
|
|
|
const options = {
|
|
const options = {
|
|
enableVibrateFallback: true,
|
|
enableVibrateFallback: true,
|
|
@@ -473,13 +474,15 @@ const ChatScreen = ({ route }: { route: any }) => {
|
|
closeEmojiSelector();
|
|
closeEmojiSelector();
|
|
};
|
|
};
|
|
|
|
|
|
- useEffect(() => {
|
|
|
|
- navigation?.getParent()?.setOptions({
|
|
|
|
- tabBarStyle: {
|
|
|
|
- display: 'none'
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }, [navigation]);
|
|
|
|
|
|
+ useFocusEffect(
|
|
|
|
+ useCallback(() => {
|
|
|
|
+ navigation?.getParent()?.setOptions({
|
|
|
|
+ tabBarStyle: {
|
|
|
|
+ display: 'none'
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }, [navigation])
|
|
|
|
+ );
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
const intervalId = setInterval(() => {
|
|
const intervalId = setInterval(() => {
|
|
@@ -917,16 +920,29 @@ const ChatScreen = ({ route }: { route: any }) => {
|
|
<Header
|
|
<Header
|
|
label={name}
|
|
label={name}
|
|
rightElement={
|
|
rightElement={
|
|
- <Image
|
|
|
|
- source={{ uri: API_HOST + avatar }}
|
|
|
|
- style={{
|
|
|
|
- width: 30,
|
|
|
|
- height: 30,
|
|
|
|
- borderRadius: 15,
|
|
|
|
- borderWidth: 1,
|
|
|
|
- borderColor: Colors.FILL_LIGHT
|
|
|
|
- }}
|
|
|
|
- />
|
|
|
|
|
|
+ <TouchableOpacity
|
|
|
|
+ onPress={() =>
|
|
|
|
+ navigation.navigate(
|
|
|
|
+ ...([NAVIGATION_PAGES.PUBLIC_PROFILE_VIEW, { userId: id }] as never)
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ >
|
|
|
|
+ {avatar ? (
|
|
|
|
+ <Image source={{ uri: API_HOST + avatar }} style={styles.avatar} />
|
|
|
|
+ ) : (
|
|
|
|
+ <AvatarWithInitials
|
|
|
|
+ text={
|
|
|
|
+ name
|
|
|
|
+ .split(/ (.+)/)
|
|
|
|
+ .map((n) => n[0])
|
|
|
|
+ .join('') ?? ''
|
|
|
|
+ }
|
|
|
|
+ flag={API_HOST + 'flag.png'}
|
|
|
|
+ size={30}
|
|
|
|
+ fontSize={12}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
|
|
+ </TouchableOpacity>
|
|
}
|
|
}
|
|
/>
|
|
/>
|
|
</View>
|
|
</View>
|
|
@@ -1002,6 +1018,13 @@ const ChatScreen = ({ route }: { route: any }) => {
|
|
maxComposerHeight={100}
|
|
maxComposerHeight={100}
|
|
renderComposer={(props) => <Composer {...props} />}
|
|
renderComposer={(props) => <Composer {...props} />}
|
|
keyboardShouldPersistTaps="handled"
|
|
keyboardShouldPersistTaps="handled"
|
|
|
|
+ renderChatEmpty={() => (
|
|
|
|
+ <View style={styles.emptyChat}>
|
|
|
|
+ <Text
|
|
|
|
+ style={styles.emptyChatText}
|
|
|
|
+ >{`No messages yet.\nFeel free to start the conversation.`}</Text>
|
|
|
|
+ </View>
|
|
|
|
+ )}
|
|
shouldUpdateMessage={shouldUpdateMessage}
|
|
shouldUpdateMessage={shouldUpdateMessage}
|
|
scrollToBottom={true}
|
|
scrollToBottom={true}
|
|
scrollToBottomComponent={renderScrollToBottom}
|
|
scrollToBottomComponent={renderScrollToBottom}
|