Are you debugging due to react-native-pager-view?
npm install react-native-pager-view-x``sh`
npm install react-native-pager-view-xor
yarn add react-native-pager-view-x
`tsx
const pagerViewXRef = useRef
const scrollEnabledRef = useRef(true);
return (
flex: 1,
width: Dimensions.get('window').width,
backgroundColor: 'red',
}}
>
title={'toggle setScrollEnabled'}
onPress={() => {
pagerViewXRef.current?.setScrollEnabled(
!scrollEnabledRef.current
);
scrollEnabledRef.current = !scrollEnabledRef.current;
}}
/>
onPress={() => {
pagerViewXRef.current?.setPage(2);
}}
/>
onPress={() => {
pagerViewXRef.current?.setPageWithoutAnimation(0);
}}
/>
`
| Prop | Type | Description |
|--------------------|--------------------------------------------------|--------------------------------------------------|
| initialPage | number (optional) | The initial page index. |scrollEnabled
| | boolean (optional) | Sets whether scrolling is enabled. |onPageScroll
| | function (optional) | Event handler for page scroll events. |children
| | ReactElement or ReactElement\[\] (optional) | Child elements to be displayed as pages. |activityIndicator
| | ReactNode (optional) | Component to display while a page is loading. |[key: string]
| | any | Any prop that can be used in FlatList can be added |
| Method | Description |
|---------------------------|--------------------------------------------------|
| setPage | Sets the current page. |setPageWithoutAnimation
| | Sets the current page without animation. |setScrollEnabled` | Sets whether scrolling is enabled. |
|
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
---
Made with create-react-native-library