File tree Expand file tree Collapse file tree 9 files changed +32
-42
lines changed
ChannelSettings/components/ChannelSettingsUI Expand file tree Collapse file tree 9 files changed +32
-42
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,13 @@ export const VoicePlayerProvider = ({
211211 stop,
212212 voicePlayerStore,
213213 } } >
214+ { /**
215+ * This empty div is also used for finding the root div element
216+ * within SendbirdProvider to set the 'dir' attribute ('rtl' | 'ltr').
217+ * See hooks/useHTMLTextDirection.tsx for more details.
218+ */ }
214219 < div id = { VOICE_PLAYER_ROOT_ID } style = { { display : 'none' } } />
220+
215221 { children }
216222 </ Context . Provider >
217223 ) ;
Original file line number Diff line number Diff line change 1+ import { useEffect } from 'react' ;
2+ import { VOICE_PLAYER_ROOT_ID } from '../utils/consts' ;
3+ import { HTMLTextDirection } from '../types' ;
4+
5+ const useHTMLTextDirection = ( direction : HTMLTextDirection ) => {
6+ useEffect ( ( ) => {
7+ /**
8+ * It sets the 'dir' attribute of the closest parent <div> element of the element with VOICE_PLAYER_ROOT_ID cause:
9+ * - An empty <div> element is created in the VoiceMessageProvider, which is the highest-level <div> element within the SendbirdProvider.
10+ * - It tries to find the nearest parent <div> element within the SendbirdProvider and sets 'dir' attribute,
11+ * ensuring that the directionality is applied correctly.
12+ * */
13+ const targetElement = document . getElementById ( VOICE_PLAYER_ROOT_ID ) ;
14+ targetElement . parentElement . dir = direction ;
15+ } , [ direction ] ) ;
16+ } ;
17+
18+ export default useHTMLTextDirection ;
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ import { EmojiManager } from './emojiManager';
5555import { uikitConfigStorage } from './utils/uikitConfigStorage' ;
5656import useMessageTemplateUtils from './hooks/useMessageTemplateUtils' ;
5757import { EmojiReactionListRoot , MenuRoot } from '../ui/ContextMenu' ;
58+ import useHTMLTextDirection from '../hooks/useHTMLTextDirection' ;
5859
5960export { useSendbirdStateContext } from '../hooks/useSendbirdStateContext' ;
6061
@@ -285,6 +286,8 @@ const SendbirdSDK = ({
285286 } ;
286287 } , [ currentTheme ] ) ;
287288
289+ useHTMLTextDirection ( htmlTextDirection ) ;
290+
288291 const isOnline = useOnlineStatus ( sdkStore . sdk , logger ) ;
289292
290293 const markAsReadScheduler = useMarkAsReadScheduler ( { isConnected : isOnline } , { logger } ) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ import { MobileLayout } from './MobileLayout';
99import useSendbirdStateContext from '../../hooks/useSendbirdStateContext' ;
1010import { SendableMessageType } from '../../utils' ;
1111import { getCaseResolvedReplyType } from '../../lib/utils/resolvedReplyType' ;
12- import useApplyTextDirection from './hooks/useApplyTextDirection' ;
1312
1413export const AppLayout = ( props : AppLayoutProps ) => {
1514 const {
@@ -20,7 +19,6 @@ export const AppLayout = (props: AppLayoutProps) => {
2019 currentChannel,
2120 setCurrentChannel,
2221 enableLegacyChannelModules,
23- htmlTextDirection,
2422 } = props ;
2523
2624 const globalStore = useSendbirdStateContext ( ) ;
@@ -34,8 +32,6 @@ export const AppLayout = (props: AppLayoutProps) => {
3432 const [ startingPoint , setStartingPoint ] = useState < number | null > ( null ) ;
3533 const { isMobile } = useMediaQueryContext ( ) ;
3634
37- useApplyTextDirection ( htmlTextDirection ) ;
38-
3935 /**
4036 * Below configs can be set via Dashboard UIKit config setting but as a lower priority than App props.
4137 * So need to be have fallback value \w global configs even though each prop values are undefined
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -157,6 +157,7 @@ export default function App(props: AppProps) {
157157 isReactionEnabled = { isReactionEnabled }
158158 isMentionEnabled = { isMentionEnabled }
159159 isVoiceMessageEnabled = { isVoiceMessageEnabled }
160+ htmlTextDirection = { htmlTextDirection }
160161 >
161162 < AppLayout
162163 isMessageGroupingEnabled = { isMessageGroupingEnabled }
@@ -169,7 +170,6 @@ export default function App(props: AppProps) {
169170 isReactionEnabled = { isReactionEnabled }
170171 replyType = { replyType }
171172 showSearchIcon = { showSearchIcon }
172- htmlTextDirection = { htmlTextDirection }
173173 />
174174 </ Sendbird >
175175 ) ;
Original file line number Diff line number Diff line change 8686 }
8787 .sendbird-channel-settings__panel-icon-right {
8888 right : 16px ;
89- /* rtl:raw:
90- transform: rotate(180deg);*/
9189 }
9290 .sendbird-channel-settings__panel-icon--open {
9391 transform : rotate (90deg ) /* rtl:rotate(270deg)*/ ;
Original file line number Diff line number Diff line change 7979 padding : 6px ;
8080 right : 16px ;
8181 bottom : 14px ;
82+ /* rtl:raw:
83+ transform: rotate(180deg);*/
8284 }
8385
8486 .sendbird-message-input--attach-input {
Original file line number Diff line number Diff line change 5757 display : flex ;
5858 flex-direction : row ;
5959 justify-content : flex-end ;
60+ /* rtl:raw:
61+ justify-content: flex-start;*/
6062 @include mobile () {
6163 position : sticky ;
6264 bottom : 24px ;
You can’t perform that action at this time.
0 commit comments