New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

react-native-pager-view-x

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-pager-view-x

Are you debugging due to react-native-pager-view?

latest
Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
2
Maintainers
0
Weekly downloads
 
Created
Source

React Native Pager View X

Installation

npm install react-native-pager-view-x
# or
yarn add react-native-pager-view-x

Usage

If you encounter a bug due to react-native-pager-view, you can also use the FlatList provided by default in RN.

const pagerViewXRef = useRef<PagerViewXRef>(null);
const scrollEnabledRef = useRef(true);

return (
  <PagerViewX ref={pagerViewXRef} initialPage={1}>
    <View
      style={{
        flex: 1,
        width: Dimensions.get('window').width,
        backgroundColor: 'red',
      }}
    >
      <Button
        title={'toggle setScrollEnabled'}
        onPress={() => {
          pagerViewXRef.current?.setScrollEnabled(
            !scrollEnabledRef.current
          );
          scrollEnabledRef.current = !scrollEnabledRef.current;
        }}
      />
      <ExButton
        text={'Go to 3 Page'}
        onPress={() => {
          pagerViewXRef.current?.setPage(2);
        }}
      />
    </View>
    <View style={{ flex: 1, backgroundColor: 'blue' }} />
    <View style={{ flex: 1, backgroundColor: 'green' }}>
      <ExButton
        text={'go to 1page without animation'}
        onPress={() => {
          pagerViewXRef.current?.setPageWithoutAnimation(0);
        }}
      />
    </View>
  </PagerViewX>

Video

API

Props

PropTypeDescription
initialPagenumber (optional)The initial page index.
scrollEnabledboolean (optional)Sets whether scrolling is enabled.
onPageScrollfunction (optional)Event handler for page scroll events.
childrenReactElement or ReactElement[] (optional)Child elements to be displayed as pages.
activityIndicatorReactNode (optional)Component to display while a page is loading.
[key: string]anyAny prop that can be used in FlatList can be added

Methods from ref

MethodDescription
setPageSets the current page.
setPageWithoutAnimationSets the current page without animation.
setScrollEnabledSets whether scrolling is enabled.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Made with create-react-native-library

Keywords

react-native

FAQs

Package last updated on 23 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts