Skip to content

setPage(index) not working — no effect #1021

@ROMDEMBELE

Description

@ROMDEMBELE

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions