Skip to content

Commit 96872fd

Browse files
committed
fix: channel search not mirrored in RTL
1 parent 533f998 commit 96872fd

1 file changed

Lines changed: 36 additions & 28 deletions

File tree

examples/SampleApp/src/screens/ChannelListScreen.tsx

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@ import React, { RefObject, useCallback, useMemo, useRef, useState } from 'react'
22
import {
33
FlatList,
44
FlatListProps,
5+
I18nManager,
56
StyleSheet,
67
Text,
78
TextInput,
89
TouchableOpacity,
910
View,
1011
} from 'react-native';
1112
import { useNavigation, useScrollToTop } from '@react-navigation/native';
12-
import { ChannelList, useTheme, useStableCallback, ChannelActionItem } from 'stream-chat-react-native';
13+
import {
14+
ChannelList,
15+
useTheme,
16+
useStableCallback,
17+
ChannelActionItem,
18+
} from 'stream-chat-react-native';
1319
import { Channel } from 'stream-chat';
1420
import { ChannelPreview } from '../components/ChannelPreview';
1521
import { ChatScreenHeader } from '../components/ChatScreenHeader';
@@ -43,7 +49,7 @@ const styles = StyleSheet.create({
4349
alignItems: 'center',
4450
borderRadius: 30,
4551
borderWidth: 1,
46-
flexDirection: 'row',
52+
flexDirection: I18nManager.isRTL ? 'row-reverse' : 'row',
4753
margin: 8,
4854
paddingHorizontal: 10,
4955
paddingVertical: 8,
@@ -143,34 +149,36 @@ export const ChannelListScreen: React.FC = () => {
143149
[],
144150
);
145151

146-
const getChannelActionItems = useStableCallback(({ context: { isDirectChat, channel }, defaultItems }) => {
147-
const viewInfo = () => {
148-
if (!channel) {
149-
return;
150-
}
151-
if (navigation) {
152-
if (isDirectChat) {
153-
navigation.navigate('OneOnOneChannelDetailScreen', {
154-
channel,
155-
});
156-
} else {
157-
navigation.navigate('GroupChannelDetailsScreen', {
158-
channel,
159-
});
152+
const getChannelActionItems = useStableCallback(
153+
({ context: { isDirectChat, channel }, defaultItems }) => {
154+
const viewInfo = () => {
155+
if (!channel) {
156+
return;
157+
}
158+
if (navigation) {
159+
if (isDirectChat) {
160+
navigation.navigate('OneOnOneChannelDetailScreen', {
161+
channel,
162+
});
163+
} else {
164+
navigation.navigate('GroupChannelDetailsScreen', {
165+
channel,
166+
});
167+
}
160168
}
161-
}
162-
};
169+
};
163170

164-
const viewInfoItem: ChannelActionItem = {
165-
action: viewInfo,
166-
Icon: ChannelInfo,
167-
id: 'info',
168-
label: 'View Info',
169-
placement: 'sheet',
170-
type: 'standard',
171-
}
172-
return [viewInfoItem, ...defaultItems]
173-
})
171+
const viewInfoItem: ChannelActionItem = {
172+
action: viewInfo,
173+
Icon: ChannelInfo,
174+
id: 'info',
175+
label: 'View Info',
176+
placement: 'sheet',
177+
type: 'standard',
178+
};
179+
return [viewInfoItem, ...defaultItems];
180+
},
181+
);
174182

175183
if (!chatClient) {
176184
return null;

0 commit comments

Comments
 (0)