From 13e691cc9cdd6cd55c75699b64abedac3b51fac9 Mon Sep 17 00:00:00 2001 From: Nobody Date: Tue, 17 Oct 2023 23:43:14 -0700 Subject: [PATCH] [MDCPageControl] Fix currentPage being set as -1 in RTL languages. PiperOrigin-RevId: 574376258 --- components/PageControl/src/MDCPageControl.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/PageControl/src/MDCPageControl.m b/components/PageControl/src/MDCPageControl.m index 7a8c9f1bcdb..dc912313e0f 100644 --- a/components/PageControl/src/MDCPageControl.m +++ b/components/PageControl/src/MDCPageControl.m @@ -252,7 +252,7 @@ - (NSInteger)scrolledPageNumber:(UIScrollView *)scrollView { lround(scrollView.contentOffset.x / scrollView.frame.size.width); NSInteger scrolledPageNumberLTR = MAX(0, MIN(_numberOfPages - 1, unboundedPageNumberLTR)); if ([self isRTL]) { - return self.numberOfPages - 1 - scrolledPageNumberLTR; + return MAX(0, self.numberOfPages - 1 - scrolledPageNumberLTR); } return scrolledPageNumberLTR; }