RTL pagination support ❓
firemanx07 opened this issue · 3 comments
does the pagination here support RTL ? it would be awesome if it does .
Thank you for the question, It does support RTL by default.
All you need to do is add the inverted
prop to the FlatList
and swap up to pagination buttons.
Call prevPage()
when you want to move the list to the right and call nextPage()
for when you want to move it to the left.
Example:
<Button text="<" onPress={nextPage} />
<Text>{pageIndex}</Text>
<Button text=">" onPress={prevPage} />
The pageIndex
will be updated when you put the inverted prop, making the far rightest element index 0.
@dozsolti well in use-case to support both LTR and RTL depending on user language preferences
nextPage( )
and previousPage( )
didn't go well (ios most of the case) .
my work around 2-way indexing of the list of data =[isRTL ?data:invertedData
]
and use goToPage(index)
@firemanx07 It works out of the box.
inverted={isRTL}
to your FlatList.
And everything will be flipped: your data, the page index, and the buttons.
You can use the nextPage and prevPage as if they were LTR