ScrollView inside RTL NavigationStack.

Apparently ScrollView inside RTL NavigationStack has a bug. iOS 16.4 and Xcode 14.3. (iOS 16.3 works fine)

var body: some View {
        NavigationStack {
            ScrollView(.horizontal) {
                HStack {
                    // given that items width smaller than scrollview width
                    ForEach(0..<5) {
                        Text("\($0)")
                            .padding(.horizontal)
                    }
                }
            }
            .navigationTitle("ScrollView RTL NavigationStack")
        }
        .environment(\.layoutDirection, .rightToLeft)
    }

The issue is animation bug where is jumps as if starting position is left, then jumps back to the expected starting position of right.

I have the same issue .. did you find a workaround for it ?

I found this this modifier on any scrolling view... iOS Deployment target should be 16.4.

.scrollBounceBehavior(.basedOnSize, axes: .horizontal)

Another ugly workaround:

@State private var contentLargerThanScrollView = false
GeometryReader { reader in
    ScrollView(.horizontal) {
        HStack {
            ForEach(0..<15) {
                Text("\($0)")
                    .padding(.horizontal)
            }
        }.background(
            GeometryReader { proxy in
                Color.clear.onAppear { contentLargerThanScrollView = proxy.size.width > reader.size.width }
            }
        )
    }
    .disabled(!contentLargerThanScrollView)
}

I have the same issue .. I hope in the future scrollview will support rtl without any workaround.

ScrollView inside RTL NavigationStack.
 
 
Q