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

inverted prop flips horizontal lists vertically instead of horizontally #512

Closed
2 tasks done
mmmoussa opened this issue Jul 5, 2022 · 4 comments · Fixed by #520
Closed
2 tasks done

inverted prop flips horizontal lists vertically instead of horizontally #512

mmmoussa opened this issue Jul 5, 2022 · 4 comments · Fixed by #520
Labels
bug Something isn't working

Comments

@mmmoussa
Copy link
Contributor

mmmoussa commented Jul 5, 2022

Current behavior

Setting the inverted prop to true on a horizontal list inverts the list vertically instead of horizontally.

Expected behavior

The list should be inverted horizontally.

To Reproduce

Render a horizontal list of items containing text and set inverted to true.

Platform:

  • iOS
  • Android

Environment

1.0.4

@mmmoussa mmmoussa added the bug Something isn't working label Jul 5, 2022
@naqvitalha
Copy link
Collaborator

What is a real world use case for an inverted horizontal list? We actually plan on throwing an exception of the list is used this way.
I'd love to understand why we should support this

@mmmoussa
Copy link
Contributor Author

mmmoussa commented Jul 7, 2022

Rendering books. Books have a directionality that is independent of device locale. For example, when rendering an English book, you can render each page as an item in a horizontal list, going from left to right. If the app is in an rtl locale, the pages should still go from left to right and hence you need the inverted prop. Similarly, in the case of a book from an rtl language, you may want to always render the list of pages from right to left and hence need to use the inverted prop when the app is using a ltr locale.

More broadly, I can imagine there are many use cases where leveraging the inverted prop in combination with app locale directionality woud be important, let alone the case I mentioned above where the content directionality is a factor as well.

@mmmoussa
Copy link
Contributor Author

mmmoussa commented Jul 7, 2022

For more specific context, in our app (https://tarteel.ai) we render the Quran (which is in Arabic) with mapping to the most common physical book format. We currently render using a slighltly modified version of VirtualizedList. On iOS, we use the app locale directionality (I18nManager.isRTL) in conjunction with the inverted prop to ensure the list of pages is always rendered from right to left. On Android, the default list behaviour is different (read: wrong), and we always render the list of pages as inverted but leverage renderScrollComponent to pass a different flexDirection value in the contentContainerStyle prop of the ScrollView depending on app locale directionality.

@naqvitalha naqvitalha mentioned this issue Jul 11, 2022
1 task
@naqvitalha
Copy link
Collaborator

That's very insightful. Thanks for letting me know. I've put up a PR to fix the issue.

@naqvitalha naqvitalha linked a pull request Jul 12, 2022 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants