Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Right To Left flow direction is not applied to the ListView on the Mac and iOS platforms. #22391

Open
ArunachalamSyncfusion opened this issue May 14, 2024 · 5 comments
Labels
area-controls-listview ListView and TableView platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@ArunachalamSyncfusion
Copy link

Description

Right To Left flow direction is not applied to the ListView on the Mac and iOS platforms. On the Android and Windows, RTL applied to the ListView properly but the issue only occurred on Mac and iOS platforms. I have attached the output images of each platform after providing RTL to the list view.

Sample repository link - https://github.com/Arunachalam3641/ListViewRTL

  • iOS platform

image

  • Mac platform

image

  • Android
    image

  • Windows platform
    image

Steps to Reproduce

  1. Run the sample on iOS and Mac platforms.
  2. RTL not applied to the ListView

Expected result:
RTL applied to the ListView.

Link to public reproduction project repository

https://github.com/Arunachalam3641/ListViewRTL

Version with bug

8.0.6 SR1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

@ArunachalamSyncfusion ArunachalamSyncfusion added the t/bug Something isn't working label May 14, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@ninachen03 ninachen03 added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels May 15, 2024
@ninachen03
Copy link

Verified this issue with Visual Studio 17.6.12(build410) (8.0.21 & 8.0.3). Can repro it.
image

@jsuarezruiz jsuarezruiz added this to the Backlog milestone Jun 6, 2024
@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 3, 2024
@samhouts samhouts added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 10, 2024
@kubaflo
Copy link
Contributor

kubaflo commented Feb 2, 2025

Hi, @ArunachalamSyncfusion it looks to me like the iOS native behaviour. Setting FlowDirection="RightToLeft" only on CV/ListView won't affect cells. You should also set FlowDirection="RightToLeft" on the cell template to apply RTL like this:

<CollectionView FlowDirection="RightToLeft"
        x:Name="listView">
    <CollectionView.ItemTemplate>
        <DataTemplate>
            <StackLayout FlowDirection="RightToLeft"
                    HeightRequest="40">
                <Label  Text="{Binding .}"
                        Padding="10,0,0,0"
                        FontSize="16"
                        TextColor="Black"/>
            </StackLayout>
        </DataTemplate>
    </CollectionView.ItemTemplate>
</CollectionView>

Here's a sample in Swift which shows that forcing RTL on the UITableView won't apply its to its cells like Android does

import UIKit

class TableViewViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
    
    let animals: [String] = ["Horse", "Cow", "Camel", "Sheep", "Goat"]
    
    let cellReuseIdentifier = "cell"
    
    private var tableView : UITableView = {
        let tableView = UITableView()
        tableView.semanticContentAttribute = .forceRightToLeft;
        tableView.translatesAutoresizingMaskIntoConstraints = false;
        return tableView
    }()
        
    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(tableView)
        self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: cellReuseIdentifier)
        tableView.delegate = self
        tableView.dataSource = self
        
        NSLayoutConstraint.activate([
            tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
            tableView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
            tableView.topAnchor.constraint(equalTo: view.topAnchor),
            tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
        ])
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return self.animals.count
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell:UITableViewCell = self.tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier)! as UITableViewCell
        
        cell.textLabel?.text = self.animals[indexPath.row]
        //uncomment to applu RTL
        //cell.textLabel?.semanticContentAttribute = .forceRightToLeft
        
        return cell
    }
}

In theory we could propagate it to viewCells, but this would be a new feature I think @PureWeen @jsuarezruiz?

@PureWeen
Copy link
Member

PureWeen commented Feb 7, 2025

@kubaflo usually we propagate RTL settings all the way down the visual tree

So it should work with CV. Does it not?

@kubaflo
Copy link
Contributor

kubaflo commented Feb 9, 2025

@PureWeen it doesn't work for CV either
#27653

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-listview ListView and TableView platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants