Skip to content

Commit 8dc0c24

Browse files
author
Ahmed Awaad
committed
fix(iOS): enhance layout direction handling in NewTabView for better RTL support
1 parent 4977ddb commit 8dc0c24

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/react-native-bottom-tabs/ios/TabView/NewTabView.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ struct NewTabView: AnyTabView {
1212
@ViewBuilder
1313
var body: some View {
1414
var effectiveLayoutDirection: LayoutDirection {
15-
if let layoutDirectionString = props.layoutDirection {
16-
return layoutDirectionString == "rightToLeft" ? .rightToLeft : .leftToRight
17-
}
18-
return .leftToRight
15+
let dir = props.layoutDirection ?? "locale"
16+
if let mapped = ["rtl": LayoutDirection.rightToLeft,
17+
"ltr": LayoutDirection.leftToRight][dir] {
18+
return mapped
1919
}
20+
let system = UIView.userInterfaceLayoutDirection(for: .unspecified)
21+
return system == .rightToLeft ? .rightToLeft : .leftToRight
22+
}
23+
2024
TabView(selection: $props.selectedPage) {
2125
ForEach(props.children) { child in
2226
if let index = props.children.firstIndex(of: child),

0 commit comments

Comments
 (0)