File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -247,14 +247,20 @@ - (void)goTo:(NSInteger)index animated:(BOOL)animated {
247
247
return ;
248
248
}
249
249
250
- BOOL isForward = (index > self.currentIndex && [self isLtrLayout ]) || (index < self.currentIndex && ![self isLtrLayout ]);
250
+ BOOL isRTL = ![self isLtrLayout ];
251
+
252
+ BOOL isForward = (index > self.currentIndex && !isRTL) || (index < self.currentIndex && isRTL);
253
+
254
+
251
255
UIPageViewControllerNavigationDirection direction = isForward ? UIPageViewControllerNavigationDirectionForward : UIPageViewControllerNavigationDirectionReverse;
252
256
253
257
self.reactPageIndicatorView .numberOfPages = numberOfPages;
254
258
self.reactPageIndicatorView .currentPage = index;
255
259
long diff = labs (index - _currentIndex);
256
260
257
- if (isForward && diff > 0 ) {
261
+ BOOL shouldGoForward = isRTL ? !isForward : isForward;
262
+
263
+ if (shouldGoForward && diff > 0 ) {
258
264
for (NSInteger i=_currentIndex; i<=index; i++) {
259
265
if (i == _currentIndex) {
260
266
continue ;
@@ -263,7 +269,7 @@ - (void)goTo:(NSInteger)index animated:(BOOL)animated {
263
269
}
264
270
}
265
271
266
- if (!isForward && diff > 0 ) {
272
+ if (!shouldGoForward && diff > 0 ) {
267
273
for (NSInteger i=_currentIndex; i>=index; i--) {
268
274
// Prevent removal of one or many pages at a time
269
275
if (i == _currentIndex || i >= numberOfPages) {
You can’t perform that action at this time.
0 commit comments