Fix AutoHeight on last list item #1871
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes (issue #)
#1868
This PR resolves the issue where ItemSeparatorComponent in grid layouts ( numColumns > 1 ) causes all items in a row to stretch to match the height of the tallest item, including separator height. The fix ensures that separators are positioned outside the main item container to prevent interference with grid layout calculations.
Changes Made:
Key Technical Changes:
Reviewers’ hat-rack 🎩
Focus Areas for Review:
Verify that separators are correctly positioned in both horizontal and vertical grid layouts
Test with various ItemSeparatorComponent implementations to ensure no visual regressions
Confirm that the refactored code maintains all existing functionality
Check TypeScript compilation and type safety improvements
Validate that grid items no longer stretch unnecessarily due to separator height
Testing Scenarios:
Grid layout with numColumns={2} and custom separator components
Items with varying content heights in the same row
Horizontal and vertical list orientations
Different separator designs (tall, short, with margins)
Screenshots or videos (if needed)
Before Fix:
Grid items in the same row would all stretch to match the height of the tallest item + separator height
Items without separators (last in row) would have unnecessary empty space
After Fix:
Each grid item maintains its natural content height
Separators are positioned independently without affecting item dimensions
Clean, consistent grid layout regardless of separator presence
Test configuration:
The fix ensures that ItemSeparatorComponent works seamlessly with grid layouts while maintaining the expected visual separation between items.