> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# RTL Support

> Show CometChat React Native UI Kit components right to left for Arabic and other RTL languages, globally or per component, with layoutDirection.

> [accordion] AI Integration Quick Reference
>
> | Field | Value |
> | - | - |
> | Package | `@cometchat/chat-uikit-react-native` |
> | Requires | UI Kit 5.7.0 or later |
> | Import | `import { CometChatUIKit, UIKitSettings, useCometChatLayoutDirection } from "@cometchat/chat-uikit-react-native";` |
> | Purpose | Show UI Kit components right to left (RTL) or left to right (LTR), for the whole kit or for one component. |
> | Global setting | `layoutDirection` in `UIKitSettings` at init, `CometChatUIKit.setLayoutDirection(...)` at runtime |
> | Per component | `layoutDirection` prop on the screen components |
> | Values | Global: `"auto"` (default) · `"ltr"` · `"rtl"`. Component prop: `"ltr"` · `"rtl"` (leave it unset to inherit) |
> | Default behavior | `"auto"` follows the app's direction (`I18nManager.isRTL`), so an app that is already RTL needs no extra code |
> | Your own views | `useCometChatLayoutDirection()` returns `"ltr"` or `"rtl"` for the UI Kit content around your view |
> | Type | `CometChatLayoutDirection` (`"auto" \| "ltr" \| "rtl"`), exported for typing your own settings state |
> | Related | [Localize](https://www.cometchat.com/docs/ui-kit/react-native/localize.md) · [Methods](https://www.cometchat.com/docs/ui-kit/react-native/methods.md) · [Theme](https://www.cometchat.com/docs/ui-kit/react-native/theme.md) |

## Overview

Languages such as Arabic are read right to left. In an RTL layout, the UI Kit mirrors its components: avatars, names, buttons, message bubbles, menus and sheets swap sides, and arrows point the other way.

Mirroring the layout doesn't mean flipping the content. The UI Kit keeps every piece of content readable:

* Each message reads in its own direction, so an English message in an Arabic chat still reads left to right.
* Names, mentions and numbers keep their order inside the text around them.
* Audio players and code blocks stay left to right, as they do in every RTL app.

## Layout Direction and Language

Layout direction and language are two separate settings:

| Setting | Decides | Set with |
| - | - | - |
| Layout direction | Which side things sit on | `layoutDirection` |
| Language | Which strings are shown | `CometChatI18nProvider` (see [Localize](https://www.cometchat.com/docs/ui-kit/react-native/localize.md)) |

By default the UI Kit follows the app's direction. You can also set them apart, for example an English app laid out RTL, or an Arabic app kept LTR.

## Turn On RTL

### Follow the app's direction (default)

With the default value, `"auto"`, the UI Kit uses the direction the app is already in (`I18nManager.isRTL`). If your app switches to RTL for an RTL language with React Native's `I18nManager`, the UI Kit follows with no extra code:

> [tab] TypeScript
>
> ```tsx theme={null}
> import { I18nManager } from "react-native";
>
> // React Native applies this after the app restarts.
> I18nManager.allowRTL(true);
> I18nManager.forceRTL(true);
> ```

Set the UI Kit's language to Arabic with `CometChatI18nProvider`. See [Localize](https://www.cometchat.com/docs/ui-kit/react-native/localize.md).

### Set it for the whole UI Kit

Pass `layoutDirection` in `UIKitSettings` to give every UI Kit component a fixed direction, whatever the app's direction. It needs no `I18nManager.forceRTL` and no restart, and your own screens are not affected:

> [tab] TypeScript
>
> ```tsx theme={null}
> import { CometChatUIKit, UIKitSettings } from "@cometchat/chat-uikit-react-native";
>
> const uikitSettings: UIKitSettings = {
>   appId: "APP_ID",
>   region: "REGION",
>   authKey: "AUTH_KEY",
>   layoutDirection: "rtl",
> };
>
> CometChatUIKit.init(uikitSettings);
> ```

| Value | Result |
| - | - |
| `"auto"` | Follows the app's direction. This is the default, so apps that don't set it see no change. |
| `"ltr"` | Every UI Kit component is left to right. |
| `"rtl"` | Every UI Kit component is right to left. |

### Change it at runtime

Use `CometChatUIKit.setLayoutDirection` to change the direction while the app is running, for example from a settings screen:

> [tab] TypeScript
>
> ```tsx theme={null}
> import { CometChatUIKit } from "@cometchat/chat-uikit-react-native";
>
> CometChatUIKit.setLayoutDirection("rtl");
>
> // Remount the UI Kit screens so they pick up the new direction,
> // for example: <NavigationContainer key={screensKey}> and setScreensKey(k => k + 1)
> ```

> [!NOTE]
>
> The new direction applies to UI Kit components created after the change. Components that stay mounted (open screens, tab screens, screens on the back stack) can show a mix of the old and new direction, so remount the UI Kit screens after changing it, for example by changing a `key` on your navigator. `init()` applies `layoutDirection` only when you pass it, so a direction you set with `setLayoutDirection` before `init()` is kept.

## Set It Per Component

The screen components take a `layoutDirection` prop. It overrides the global setting for that component and everything inside it, including the sheets, menus and dialogs it opens:

> [tab] TypeScript
>
> ```tsx theme={null}
> // The whole kit is RTL, but this list stays LTR.
> <CometChatConversations layoutDirection="ltr" />
> ```

Leave it unset to inherit the direction from the UI Kit component around it, or from the global setting.

These components take `layoutDirection`:

| Chat | Messages | Calls |
| - | - | - |
| [Conversations](https://www.cometchat.com/docs/ui-kit/react-native/conversations.md) | [Message Header](https://www.cometchat.com/docs/ui-kit/react-native/message-header.md) | [Call Buttons](https://www.cometchat.com/docs/ui-kit/react-native/call-buttons.md) |
| [Users](https://www.cometchat.com/docs/ui-kit/react-native/users.md) | [Message List](https://www.cometchat.com/docs/ui-kit/react-native/message-list.md) | [Call Logs](https://www.cometchat.com/docs/ui-kit/react-native/call-logs.md) |
| [Groups](https://www.cometchat.com/docs/ui-kit/react-native/groups.md) | [Message Composer](https://www.cometchat.com/docs/ui-kit/react-native/message-composer.md) | [Incoming Call](https://www.cometchat.com/docs/ui-kit/react-native/incoming-call.md) |
| [Group Members](https://www.cometchat.com/docs/ui-kit/react-native/group-members.md) | [Compact Message Composer](https://www.cometchat.com/docs/ui-kit/react-native/compact-message-composer.md) | [Outgoing Call](https://www.cometchat.com/docs/ui-kit/react-native/outgoing-call.md) |
| [Search](https://www.cometchat.com/docs/ui-kit/react-native/search.md) | [Threaded Messages Header](https://www.cometchat.com/docs/ui-kit/react-native/threaded-messages-header.md) | |
| [Notification Feed](https://www.cometchat.com/docs/ui-kit/react-native/notification-feed.md) | [Message Information](https://www.cometchat.com/docs/ui-kit/react-native/message-information.md) | |
| [AI Assistant Chat History](https://www.cometchat.com/docs/ui-kit/react-native/ai-assistant-chat-history.md) | [Pinned Messages](https://www.cometchat.com/docs/ui-kit/react-native/pinned-messages.md) | |
| | [Saved Messages](https://www.cometchat.com/docs/ui-kit/react-native/saved-messages.md) | |

> [!NOTE]
>
> The ongoing-call screen ([Ongoing Call](https://www.cometchat.com/docs/ui-kit/react-native/ongoing-call.md)) is drawn by the Calls SDK and doesn't follow `layoutDirection`.

## Which Setting Wins

When settings disagree, the first rule that gives a direction wins:

1. Audio players are always left to right.
2. The component's own `layoutDirection`.
3. The nearest UI Kit component around it: its own `layoutDirection`, or the global setting as it was when that component was created.
4. The global setting, when it is `"ltr"` or `"rtl"`.
5. The app's own direction (`I18nManager.isRTL`).

Don't wrap a UI Kit component in a view with a `direction` style to change its direction: that mirrors the layout but not the icons or text inputs, and a global `"ltr"` or `"rtl"` ignores it. To force one component's direction, use its `layoutDirection` prop.

## App Screens Outside the UI Kit

The UI Kit never changes your app's direction. With a global `"ltr"` or `"rtl"`, the UI Kit's components follow it but your own screens stay as they are. To give one of your screens the same direction, set `direction` on its root view:

> [tab] TypeScript
>
> ```tsx theme={null}
> import { View } from "react-native";
>
> const SettingsScreen = () => (
>   <View style={{ flex: 1, direction: "rtl" }}>
>     {/* your screen */}
>   </View>
> );
> ```

To mirror the whole app, use `I18nManager.forceRTL(true)` and restart, and leave the UI Kit on `"auto"`.

## What Changes in RTL

### Layout

Everything that has a side moves to the other one: avatars, titles, subtitles, timestamps, unread badges, receipts, buttons, the composer's actions, message bubbles, menus, sheets, swipe actions, tooltips and loading skeletons. Sent messages sit on the left and received messages on the right. Swipe to reply goes the other way. Horizontal lists, such as emoji and sticker tabs and the attachment tray, start from the right.

### Icons

| Icon | In RTL |
| - | - |
| Arrows that point along the reading direction: back, forward, chevrons, send (including the AI send button), reply, reply all, forward, reply in thread, logout, and the call-direction arrows (incoming, outgoing and missed, voice and video) | Flip on iOS and Android |
| Bulleted list | Flips on iOS and Android |
| Video camera, copy, chat and sticker | Flip on Android; stay as drawn on iOS, following Apple's guidelines |
| Numbered list | Swaps to a drawing with the numbers on the right |
| Everything else: phone handset, microphone, attach, emoji, close, search, receipt ticks, pin, media controls, file types, logos | Stay as drawn |

Icons you pass into the UI Kit are drawn as you give them.

### What doesn't mirror

* **Audio players**, including voice notes, the audio recorder and the attachment tray's audio tile: playback controls, waveforms and progress bars stay left to right in every language. The times use the language's digits.
* **Video** plays in the system player, whose controls follow the phone's own direction rules.
* **Code**: inline code and code blocks, in chat messages and in AI assistant replies, always read left to right.

### Message text

* **Each message reads in its own direction.** The first letter decides it: a message that starts with an English letter reads left to right, one that starts with an Arabic letter reads right to left. A message with digits but no letters (`123 + 456 = 579`) reads left to right, unless it contains a mention. A message of only emoji follows the bubble.
* **Names and mentions keep their place.** A user's name can't scramble the sentence around it, and a mention always reads `@name`. Invisible direction-control characters are removed from names, so a name can't reverse the text after it.
* **Links, email addresses and phone numbers** read left to right.
* **Numbers and dates.** When the UI Kit's language is Arabic, the dates, times and counts it formats use Arabic digits (٠١٢٣٤٥٦٧٨٩) and Arabic plural forms. Text you supply yourself, for example from a `datePattern` callback, is shown as given.

### Message composer

* The text follows the language you type: English starts at the left, Arabic at the right.
* In an empty composer, the cursor sits on the side of the keyboard's language: English keyboard on the left, Arabic keyboard on the right. This uses a native module added in UI Kit 5.7.0, so rebuild the app after upgrading (`pod install` and an Xcode build on iOS, a Gradle build on Android). On Expo, use a development build; Expo Go doesn't include the module. Without it, the cursor sits at the start edge.

## Custom Views in RTL

Views you pass into the UI Kit (view slots, custom message templates, custom bubbles) are placed inside the component's direction. Use start/end styles so they mirror with the rest of the UI Kit:

| Instead of | Use |
| - | - |
| `marginLeft`, `marginRight` | `marginStart`, `marginEnd` |
| `paddingLeft`, `paddingRight` | `paddingStart`, `paddingEnd` |
| `left`, `right` (absolute position) | `start`, `end` |
| `borderTopLeftRadius` | `borderTopStartRadius` |

When a view needs to know the direction itself, for example to choose an icon, read it with `useCometChatLayoutDirection()` instead of `I18nManager.isRTL`. It returns the direction of the UI Kit content around your view, so it is right even when you set the UI Kit's direction with `layoutDirection` and it differs from the app's:

> [tab] TypeScript
>
> ```tsx theme={null}
> import { Text, View } from "react-native";
> import { CometChatConversations, useCometChatLayoutDirection } from "@cometchat/chat-uikit-react-native";
>
> const MySubtitle = ({ text }: { text: string }) => {
>   const direction = useCometChatLayoutDirection(); // "ltr" or "rtl"
>   return (
>     <View style={{ flexDirection: "row", paddingStart: 8 }}>
>       <Text>{direction === "rtl" ? "←" : "→"} </Text>
>       <Text>{text}</Text>
>     </View>
>   );
> };
>
> <CometChatConversations
>   SubtitleView={(conversation) => (
>     <MySubtitle text={conversation.getLastMessage()?.getSender()?.getName() ?? ""} />
>   )}
> />
> ```

## Languages

The UI Kit ships Arabic translations. For another RTL language, such as Hebrew, Persian or Urdu, add it with `CometChatI18nProvider` as described in [Localize](https://www.cometchat.com/docs/ui-kit/react-native/localize.md), then make the app RTL with `I18nManager` or set `layoutDirection: "rtl"`.

## Next Steps

> [card] [Localize](https://www.cometchat.com/docs/ui-kit/react-native/localize.md)
>
> Set the UI Kit's language and translations

> [card] [Methods](https://www.cometchat.com/docs/ui-kit/react-native/methods.md)
>
> UIKitSettings and CometChatUIKit reference

> [card] [Theme](https://www.cometchat.com/docs/ui-kit/react-native/theme.md)
>
> Colors, typography and styles

> [card] [Troubleshooting](https://www.cometchat.com/docs/ui-kit/react-native/troubleshooting.md)
>
> Common RTL questions


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.