Skip to content

fix ItemSeparatorComponent position in horizontal and inverted mode - #15865

Closed
VahidBo wants to merge 3 commits into
react:masterfrom
VahidBo:fix-horizontal-ItemSeparatorComponent
Closed

fix ItemSeparatorComponent position in horizontal and inverted mode#15865
VahidBo wants to merge 3 commits into
react:masterfrom
VahidBo:fix-horizontal-ItemSeparatorComponent

Conversation

@VahidBo

Copy link
Copy Markdown
Contributor

Motivation

There's a positioning bug in VirtualizedList when ItemSeparatorComponent is defined for a list in horizontal or inverted mode. And also we face this bug in FlatList, because it is using VirtualizedList to render lists.
This commit will fix the #15777.

Before fix:

<FlatList
...
horizontal={true}
inverted={true}
...
/>

image

<FlatList
...
horizontal={true}
inverted={false}
...
/>

image

Test Plan

I ran this code with all possible values of horizontal and inverted props in FlatList and VirtualizedList and the results of each run was as below:
After fix bug:

<FlatList
...
horizontal={true}
inverted={false}
...
/>

image

<FlatList
...
horizontal={true}
inverted={true}
...
/>

image

@facebook-github-botfacebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. GH Review: review-needed labels Sep 8, 2017
@hramos

Copy link
Copy Markdown
Contributor

Thanks for the pull request! This is a great first PR.

@facebook-github-botfacebook-github-bot added GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Sep 8, 2017
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@hramos has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@VahidBo

Copy link
Copy Markdown
ContributorAuthor

@hramos Thank you very much.

@chiranjeevisaride

chiranjeevisaride commented Sep 10, 2017

Copy link
Copy Markdown

I'm still facing this Issue, I'm not getting Space between Images

<FlatList horizontal={true}
inverted={false}
data={characters}
ItemSeparatorComponent={ () => <View style={ { width: 10} } /> }
renderItem={({item}) => this._renderItem(item)} /> 

Live Demo

@VahidBo
VahidBo deleted the fix-horizontal-ItemSeparatorComponent branch September 10, 2017 07:07
@VahidBo

Copy link
Copy Markdown
ContributorAuthor

@chiranjeevisaride It's not released yet.

@gautan

Copy link
Copy Markdown

When are you planning to release?

@gautan

Copy link
Copy Markdown

@VahidBo When are you planning to release?

@djhr

djhr commented Oct 11, 2017

Copy link
Copy Markdown

@hramos when is it expected to have a release with this fix?

@hramos

Copy link
Copy Markdown
Contributor

You can find which release any commit has shipped to by looking at the list of tags. In this case, this commit is already part of the 0.50 Release Candidate.

screen shot 2017-10-11 at 2 18 59 pm

@andrefrtsandrefrts left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maravilhoso!@ pegou bonitinho!

@stokesbga

Copy link
Copy Markdown

It looks like this doesnt work on sectionlist, v57.8

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.Import StartedThis pull request has been imported. This does not imply the PR has been approved.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@VahidBo@hramos@facebook-github-bot@chiranjeevisaride@gautan@djhr@stokesbga@andrefrts