https://github.com/rescript-react-native/viewpager
ReScript bindings for @react-native-community/viewpager
https://github.com/rescript-react-native/viewpager
react react-native rescript rescript-react rescript-react-native viewpager
Last synced: 9 months ago
JSON representation
ReScript bindings for @react-native-community/viewpager
- Host: GitHub
- URL: https://github.com/rescript-react-native/viewpager
- Owner: rescript-react-native
- License: mit
- Created: 2020-01-20T07:39:17.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2023-05-07T19:28:57.000Z (over 2 years ago)
- Last Synced: 2025-04-13T12:08:42.011Z (9 months ago)
- Topics: react, react-native, rescript, rescript-react, rescript-react-native, viewpager
- Language: ReScript
- Homepage:
- Size: 249 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# `@rescript-react-native/viewpager`
[](https://github.com/rescript-react-native/viewpager/actions)
[](https://www.npmjs.com/@rescript-react-native/viewpager)
[](https://forum.rescript-lang.org/)
[ReScript](https://rescript-lang.org) bindings for
[`@react-native-community/viewpager`](https://github.com/callstack/react-native-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`](https://github.com/callstack/react-native-viewpager)
is properly installed & configured by following their installation instructions,
you can install the bindings:
```console
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`:
```diff
{
//...
"bs-dependencies": [
"@rescript/react",
"rescript-react-native",
// ...
+ "@rescript-react-native/viewpager"
],
//...
}
```
## Usage
```rescript
[@react.component]
let app = () =>
;
```
#### `ReactNativeViewPager` props
```rescript
~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`
```rescript
setPage: (T.t, int) => unit = "setPage";
```
#### `ReactNativeViewPager.setPage`
```rescript
setPageWithoutAnimation: (T.t, int) => unit =
"setPageWithoutAnimation";
```
---
## Changelog
Check the [changelog](./CHANGELOG.md) for more informations about recent
releases.
---
## Contribute
Read the
[contribution guidelines](https://github.com/rescript-react-native/.github/blob/master/CONTRIBUTING.md)
before contributing.
## Code of Conduct
We want this community to be friendly and respectful to each other. Please read
[our full code of conduct](https://github.com/rescript-react-native/.github/blob/master/CODE_OF_CONDUCT.md)
so that you can understand what actions will and will not be tolerated.