- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.9k
 
[iOS] RTL column mirroring in UICollectionView - fix #32372
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
base: main
Are you sure you want to change the base?
Conversation
Explicitly sets the semantic content attribute on the native UICollectionView to ensure compositional layouts mirror columns correctly in right-to-left (RTL) scenarios. This addresses an issue where the platform view's semantic attribute does not propagate to native children not backed by IView.
| 
           Hey there @@kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where iOS UICollectionView compositional layouts don't properly mirror columns in right-to-left (RTL) flow directions. The fix explicitly sets the SemanticContentAttribute on the native UICollectionView to ensure RTL layout behavior is correctly applied.
- Adds explicit semantic content attribute handling for the UICollectionView based on FlowDirection
 - Maps FlowDirection enum values to appropriate UISemanticContentAttribute values
 - Only updates the SemanticContentAttribute when it differs from the desired value
 
| case FlowDirection.MatchParent: | ||
| // Let it inherit from the parent view we just updated | ||
| desiredAttr = UISemanticContentAttribute.Unspecified; | ||
| break; | 
    
      
    
      Copilot
AI
    
    
    
      Nov 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The switch statement can be simplified by initializing desiredAttr within the switch expression or handling the MatchParent case implicitly. Since desiredAttr is already initialized to Unspecified (line 319), the MatchParent case at line 328-331 is redundant and can be removed. Alternatively, use a switch expression to make the intent clearer.
| case FlowDirection.MatchParent: | |
| // Let it inherit from the parent view we just updated | |
| desiredAttr = UISemanticContentAttribute.Unspecified; | |
| break; | 
| 
           /azp run  | 
    
| 
          
Azure Pipelines successfully started running 3 pipeline(s). | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could include an UITest to check that after switching to RTL: first column is right‑anchored?
| } | ||
| 
               | 
          ||
| if (CollectionView.SemanticContentAttribute != desiredAttr) | ||
| { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compositional and flow layouts may not re-query attributes immediately, requires to force a layout pass?
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Explicitly sets the semantic content attribute on the native UICollectionView to ensure compositional layouts mirror columns correctly in right-to-left (RTL) scenarios. This addresses an issue where the platform view's semantic attribute does not propagate to native children not backed by IView.
Screen.Recording.2025-11-04.at.00.40.34.mov
Screen.Recording.2025-11-04.at.00.37.54.mov
Issues Fixed
Fixes #32359