Skip to content

ReScript bindings for @react-native-community/viewpager

License

Notifications You must be signed in to change notification settings

rescript-react-native/viewpager

Repository files navigation

@rescript-react-native/viewpager

Build Status Version ReScript Forum

ReScript bindings for @react-native-community/viewpager.

Exposed as ReactNativeViewPager module.

@rescript-react-native/viewpager X.y.* means it's compatible with @react-native-community/viewpager X.y.*

Installation

When @react-native-community/viewpager is properly installed & configured by following their installation instructions, you can install the bindings:

npm install @rescript-react-native/viewpager
# or
yarn add @rescript-react-native/viewpager

@rescript-react-native/viewpager should be added to bs-dependencies in your bsconfig.json:

{
  //...
  "bs-dependencies": [
    "@rescript/react",
    "rescript-react-native",
    // ...
+    "@rescript-react-native/viewpager"
  ],
  //...
}

Usage

[@react.component]
let app = () =>
    <SafeAreaView style={styles##body}>
      <ReactNativeViewPager style={styles##body}
        initialPage=1
        pageMargin=13
        transitionStyle={`curl}
        showPageIndicator=true
        >
        <View style={styles##red}/>
        <View style={styles##blue}/>
        <View style={styles##green}/>
      </ReactNativeViewPager>
    </SafeAreaView>;

ReactNativeViewPager props

~ref: ref=?,
~initialPage: int=?,
~scrollEnabled: bool=?,
~onPageScroll: PageScrollEvent.t => unit=?,
~onPageSelected: PageSelectedEvent.t => unit=?,
~onPageScrollStateChanged: PageScrollStateChangedEvent.t => unit=?,
~keyboardDismissMode: [@bs.string] [ | `none | [@bs.as "on-drag"] `onDrag]=?,
~pageMargin: int=?,
~onMoveShouldSetResponderCapture: ReactNative.Event.pressEvent => bool=?,
~style: ReactNative.Style.t=?,
~children: React.element=?,
~orientation: [@bs.string] [ | `horizontal | `vertical]=?,
~transitionStyle: [@bs.string] [ | `scroll | `curl]=?,
~showPageIndicator: bool=?

Methods

ReactNativeViewPager.setPage

setPage: (T.t, int) => unit = "setPage";

ReactNativeViewPager.setPage

setPageWithoutAnimation: (T.t, int) => unit =
    "setPageWithoutAnimation";

Changelog

Check the changelog for more informations about recent releases.


Contribute

Read the contribution guidelines before contributing.

Code of Conduct

We want this community to be friendly and respectful to each other. Please read our full code of conduct so that you can understand what actions will and will not be tolerated.