react-native-pager-view icon indicating copy to clipboard operation
react-native-pager-view copied to clipboard

setPage(index) not working — no effect

Open ROMDEMBELE opened this issue 5 months ago • 0 comments

Environment

Key Value
Library react-native-pager-view
Tested versions 6.5.1, 6.9.1, 7.x (latest)
Platform Android only
Android API tested API 29
Error logs None
Expected behavior Pager view should switch to the requested index

Description

Calling setPage(index) on react-native-pager-view has no visible effect. The page does not change, and no error or warning is thrown.

This issue persists across multiple versions of the library and on Android.

Reproducible Demo

Using hook (usePagerView) to wrap the pager logic and calling setPage should update the pager to show the corresponding page. • Is there an internal condition that could silently block setPage()? • Is the method fully supported on Android 29?

const { AnimatedPagerView, ...rest } = usePagerView({ pagesAmount: 3 })

Tabs

<TouchableOpacity onPress={() => rest.setPage(0)}>
  <Text>Tab 1</Text>
</TouchableOpacity>

<TouchableOpacity onPress={() => rest.setPage(1)}>
  <Text>Tab 2</Text>
</TouchableOpacity>

<TouchableOpacity onPress={() => rest.setPage(2)}>
  <Text>Tab 3</Text>
</TouchableOpacity>

PagerView

<AnimatedPagerView
  initialPage={0}
  orientation="horizontal"
  style={styles.pager}
>
  {/* 3 View */}
</AnimatedPagerView>


Thanks in advance for any help or guidance on this issue!

ROMDEMBELE avatar Aug 21 '25 12:08 ROMDEMBELE