Skip to content

Commit 4912ce9

Browse files
committed
fix: expo sample app keyboardVerticalOffset for channel and thread screen
1 parent e89fa89 commit 4912ce9

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

examples/ExpoMessaging/app/channel/[cid]/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { useContext, useEffect } from 'react';
22
import { SafeAreaView, View } from 'react-native';
3-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
43
import { Channel, MessageInput, MessageList, useAttachmentPickerContext } from 'stream-chat-expo';
54
import { Stack, useRouter } from 'expo-router';
65
import { AuthProgressLoader } from '../../../components/AuthProgressLoader';
@@ -25,7 +24,11 @@ export default function ChannelScreen() {
2524
<SafeAreaView>
2625
<Stack.Screen options={{ title: 'Channel Screen' }} />
2726
{channel && (
28-
<Channel audioRecordingEnabled={true} channel={channel}>
27+
<Channel
28+
audioRecordingEnabled={true}
29+
channel={channel}
30+
keyboardVerticalOffset={headerHeight}
31+
>
2932
<View style={{ flex: 1 }}>
3033
<MessageList
3134
onThreadSelect={(thread) => {

examples/ExpoMessaging/app/channel/[cid]/thread/[cid]/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import { SafeAreaView, View } from 'react-native';
33
import { Channel, Thread } from 'stream-chat-expo';
44
import { Stack } from 'expo-router';
55
import { AppContext } from '../../../../../context/AppContext';
6+
import { useHeaderHeight } from '@react-navigation/elements';
67

78
export default function ThreadScreen() {
89
const { channel, thread, setThread } = useContext(AppContext);
10+
const headerHeight = useHeaderHeight();
911

1012
if (channel === undefined) {
1113
return null;
@@ -15,7 +17,13 @@ export default function ThreadScreen() {
1517
<SafeAreaView>
1618
<Stack.Screen options={{ title: 'Thread Screen' }} />
1719

18-
<Channel audioRecordingEnabled={true} channel={channel} thread={thread} threadList>
20+
<Channel
21+
audioRecordingEnabled={true}
22+
channel={channel}
23+
keyboardVerticalOffset={headerHeight}
24+
thread={thread}
25+
threadList
26+
>
1927
<View
2028
style={{
2129
flex: 1,

0 commit comments

Comments
 (0)