Skip to content

Commit d617614

Browse files
authored
fix(ios): removing last page (#395)
1 parent 36eaab9 commit d617614

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ios/ReactNativePageView.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ - (void)updateDataSource {
206206

207207
if (newIndex == NSNotFound) {
208208
// Current view was removed
209-
[self goTo:self.currentIndex animated:NO];
209+
NSInteger maxPage = self.reactSubviews.count - 1;
210+
NSInteger fallbackIndex = self.currentIndex >= maxPage ? maxPage : self.currentIndex;
211+
212+
[self goTo:fallbackIndex animated:NO];
210213
} else {
211214
[self goTo:newIndex animated:NO];
212215
}

0 commit comments

Comments
 (0)