Skip to content

Commit 11192c4

Browse files
committed
Add an example for direction prop
1 parent c65db83 commit 11192c4

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

versioned_docs/version-7.x/navigation-container.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,38 @@ Custom theme to use for the navigation components such as the header, tab bar et
917917
918918
The direction of the text configured in the app. Defaults to `'rtl'` when `I18nManager.getConstants().isRTL` returns `true`, otherwise `'ltr'`.
919919
920+
Supported values:
921+
922+
- `'ltr'`: Left-to-right text direction for languages like English, French etc.
923+
- `'rtl'`: Right-to-left text direction for languages like Arabic, Hebrew etc.
924+
925+
Example:
926+
927+
<Tabs groupId="config" queryString="config">
928+
<TabItem value="static" label="Static" default>
929+
930+
```js
931+
<Navigation
932+
// highlight-next-line
933+
direction="rtl"
934+
/>
935+
```
936+
937+
</TabItem>
938+
<TabItem value="dynamic" label="Dynamic">
939+
940+
```js
941+
<NavigationContainer
942+
// highlight-next-line
943+
direction="rtl"
944+
>
945+
{/* content */}
946+
</NavigationContainer>
947+
```
948+
949+
</TabItem>
950+
</Tabs>
951+
920952
This is used in various navigators to adjust the content according to the text direction, for example, the drawer in the [drawer navigator](drawer-navigator.md) is positioned on the right side in RTL languages.
921953
922954
This prop informs React Navigation about the text direction in the app, it doesn't change the text direction by itself. If you intend to support RTL languages, it's important to set this prop to the correct value that's configured in the app. If it doesn't match the actual text direction, the layout might be incorrect.

0 commit comments

Comments
 (0)