Skip to content

Commit

Permalink
ReScript
Browse files Browse the repository at this point in the history
  • Loading branch information
MoOx committed May 3, 2021
1 parent 042e85c commit b4c7849
Show file tree
Hide file tree
Showing 15 changed files with 110 additions and 119 deletions.
3 changes: 0 additions & 3 deletions .gitattributes

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ node_modules
# npm unused lock file (we use yarn.lock)
package-lock.json

# ReScript / Reason / Ocaml artifacts
#*.bs.js # we do want this files to ensure zero-cost
# ReScript artifacts
# *.bs.js # we do want this files to ensure zero-cost
.bsb.lock
**/lib/bs
**/lib/ocaml
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Changelog of `@reason-react-native/viewpager`
# Changelog of `@rescript-react-native/viewpager`

## 4.0.0 - 2020-11-19

- 4.0.0 compat
- rescript 8.2
- reason-react-native 0.63
- rescript-react-native 0.63

## 3.3.0 - 2020-01-30

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 @reason-react-native contributors
Copyright (c) 2019 @rescript-react-native contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# `@reason-react-native/viewpager`
# `@rescript-react-native/viewpager`

[![Build Status](https://github.com/reason-react-native/viewpager/workflows/Build/badge.svg)](https://github.com/reason-react-native/viewpager/actions)
[![Version](https://img.shields.io/npm/v/@reason-react-native/viewpager.svg)](https://www.npmjs.com/@reason-react-native/viewpager)
[![Chat](https://img.shields.io/discord/235176658175262720.svg?logo=discord&colorb=blue)](https://reasonml-community.github.io/reason-react-native/discord/)
[![Build Status](https://github.com/rescript-react-native/viewpager/workflows/Build/badge.svg)](https://github.com/rescript-react-native/viewpager/actions)
[![Version](https://img.shields.io/npm/v/@rescript-react-native/viewpager.svg)](https://www.npmjs.com/@rescript-react-native/viewpager)
[![ReScript Forum](https://img.shields.io/discourse/posts?color=e6484f&label=ReScript%20Forum&server=https%3A%2F%2Fforum.rescript-lang.org)](https://forum.rescript-lang.org/)

[ReScript](https://rescript-lang.org) / [Reason](https://reasonml.github.io) bindings for
[ReScript](https://rescript-lang.org) bindings for
[`@react-native-community/viewpager`](https://github.com/callstack/react-native-viewpager).

Exposed as `ReactNativeViewPager` module.

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

## Installation
Expand All @@ -20,30 +20,30 @@ is properly installed & configured by following their installation instructions,
you can install the bindings:

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

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

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

## Usage

```reason
```rescript
[@react.component]
let app = () =>
<SafeAreaView style={styles##body}>
Expand All @@ -62,7 +62,7 @@ let app = () =>

#### `ReactNativeViewPager` props

```reason
```rescript
~ref: ref=?,
~initialPage: int=?,
~scrollEnabled: bool=?,
Expand All @@ -83,13 +83,13 @@ let app = () =>

#### `ReactNativeViewPager.setPage`

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

#### `ReactNativeViewPager.setPage`

```reason
```rescript
setPageWithoutAnimation: (T.t, int) => unit =
"setPageWithoutAnimation";
```
Expand All @@ -106,11 +106,11 @@ releases.
## Contribute

Read the
[contribution guidelines](https://github.com/reason-react-native/.github/blob/master/CONTRIBUTING.md)
[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/reason-react-native/.github/blob/master/CODE_OF_CONDUCT.md)
[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.
9 changes: 3 additions & 6 deletions bsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"name": "@reason-react-native/viewpager",
"refmt": 3,
"reason": {
"react-jsx": 3
},
"name": "@rescript-react-native/viewpager",
"reason": { "react-jsx": 3 },
"package-specs": {
"module": "commonjs",
"in-source": true
Expand All @@ -19,5 +16,5 @@
"warnings": {
"error": true
},
"bs-dependencies": ["reason-react", "reason-react-native"]
"bs-dependencies": ["@rescript/react", "rescript-react-native"]
}
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@reason-react-native/viewpager",
"name": "@rescript-react-native/viewpager",
"description": "ReScript bindings for @react-native-community/viewpager.",
"version": "4.0.0",
"publishConfig": {
Expand All @@ -8,19 +8,17 @@
"peerDependencies": {
"@react-native-community/viewpager": "^4.0.0"
},
"repository": "https://github.com/reason-react-native/viewpager.git",
"repository": "https://github.com/rescript-react-native/viewpager.git",
"license": "MIT",
"keywords": [
"rescript",
"reason",
"reasonml",
"bucklescript",
"react-native"
],
"files": [
"*.md",
"bsconfig.json",
"src/**/*.re",
"src/**/*.res",
"src/**/*.resi",
"src/**/*.js",
"!src/**/*.bs.js"
],
Expand All @@ -37,13 +35,13 @@
"release": "npmpub"
},
"devDependencies": {
"bs-platform": "^8.2.0",
"bs-platform": "^9.0.0",
"husky": "^4.0.0",
"lint-staged": "^10.0.0",
"npmpub": "^5.0.0",
"prettier": "^2.0.0",
"reason-react": "^0.9.0",
"reason-react-native": "^0.63.0"
"@rescript/react": "^0.10.0",
"rescript-react-native": "^0.64.3"
},
"prettier": {
"trailingComma": "all"
Expand Down
2 changes: 1 addition & 1 deletion src/ReactNativeViewPager.bs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var ViewPagerElement = require("./ViewPagerElement.bs.js");
var Event$ReactNative = require("reason-react-native/src/apis/Event.bs.js");
var Event$ReactNative = require("rescript-react-native/src/apis/Event.bs.js");

Event$ReactNative.SyntheticEvent({});

Expand Down
51 changes: 0 additions & 51 deletions src/ReactNativeViewPager.re

This file was deleted.

47 changes: 47 additions & 0 deletions src/ReactNativeViewPager.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
open ReactNative
include ViewPagerElement

module PageScrollEvent = {
type payload = {
position: int,
offset: float,
}
include Event.SyntheticEvent({
type _payload = payload
})
}

module PageSelectedEvent = {
type payload = {position: float}
include Event.SyntheticEvent({
type _payload = payload
})
}

module PageScrollStateChangedEvent = {
// new bs new polyvar encoding
//type payload = {pageScrollState: [ | `idle | `dragging | `settling]};
type payload = {pageScrollState: string}
include Event.SyntheticEvent({
type _payload = payload
})
}

@module("@react-native-community/viewpager") @react.component
external make: (
~ref: ref=?,
~initialPage: int=?,
~scrollEnabled: bool=?,
~onPageScroll: PageScrollEvent.t => unit=?,
~onPageSelected: PageSelectedEvent.t => unit=?,
~onPageScrollStateChanged: PageScrollStateChangedEvent.t => unit=?,
~keyboardDismissMode: @string [#none | @as("on-drag") #onDrag]=?,
~pageMargin: int=?,
~onMoveShouldSetResponderCapture: ReactNative.Event.pressEvent => bool=?,
~style: ReactNative.Style.t=?,
~children: React.element=?,
~orientation: [#horizontal | #vertical]=?,
~transitionStyle: [#scroll | #curl]=?,
~showPageIndicator: bool=?,
~overScrollMode: ScrollView.overScrollMode=?,
) => React.element = "default"
6 changes: 0 additions & 6 deletions src/ViewPagerElement.re

This file was deleted.

6 changes: 6 additions & 0 deletions src/ViewPagerElement.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type element
type ref = React.ref<Js.nullable<element>>

include ViewPagerMethods.Make({
type t = element
})
6 changes: 0 additions & 6 deletions src/ViewPagerMethods.re

This file was deleted.

9 changes: 9 additions & 0 deletions src/ViewPagerMethods.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Make = (
T: {
type t
},
) => {
@send external setPage: (T.t, int) => unit = "setPage"
@send
external setPageWithoutAnimation: (T.t, int) => unit = "setPageWithoutAnimation"
}
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@
dependencies:
"@types/node" ">= 8"

"@rescript/react@^0.10.0":
version "0.10.2"
resolved "https://registry.yarnpkg.com/@rescript/react/-/react-0.10.2.tgz#170d2a5ff34ad09cd614d92467d5efad95202794"
integrity sha512-Qe21P4WnrmrbhbEMQ4dpaXC1/iMMc7JmqjuSpZouSP+s41K5dCXUGY9sds30gajU74lSfJdG2PzSDYcNAcDyVA==

"@sindresorhus/df@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@sindresorhus/df/-/df-1.0.1.tgz#c69b66f52f6fcdd287c807df210305dbaf78500d"
Expand Down Expand Up @@ -251,10 +256,10 @@ braces@^3.0.1:
dependencies:
fill-range "^7.0.1"

bs-platform@^8.2.0:
version "8.3.2"
resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-8.3.2.tgz#c307f1cc2d2397c3d088c7f3b62e9f493283cdcf"
integrity sha512-iOTi5JIlNPoCPq31NS9ET79FLyCpwTL2JZbgHz35LzY9Bch1iDtbBR3FVGhRbjphxelAP4fLlFONfUNp5Y3a5g==
bs-platform@^9.0.0:
version "9.0.2"
resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-9.0.2.tgz#a6eac70eb8924a322556dacaccbfbc9b2a0d3a37"
integrity sha512-Ye9JqJ4Oa7mcjjoOVRYI8Uc2Cf8N7jQLWDcdUplY7996d/YErSR7WitmV7XnSwr4EvdrbwjEsg1NxNjUQv3ChA==

callsites@^3.0.0:
version "3.1.0"
Expand Down Expand Up @@ -1104,21 +1109,16 @@ readjson@^2.0.1:
dependencies:
try-catch "^3.0.0"

reason-react-native@^0.63.0:
version "0.63.0"
resolved "https://registry.yarnpkg.com/reason-react-native/-/reason-react-native-0.63.0.tgz#08de85136a41809b9a66cac066d4ea6975406000"
integrity sha512-rE1OOph5Jxceost2ahdvX+VXJ2RPNyefX9FMXa/OXgqmLKjFeZuyVOySUj41UoohOYyKmZWbgansDGccwYrdUQ==

reason-react@^0.9.0:
version "0.9.1"
resolved "https://registry.yarnpkg.com/reason-react/-/reason-react-0.9.1.tgz#30a887158200b659aa03e2d75ff4cc54dc462bb0"
integrity sha512-nlH0O2TDy9KzOLOW+vlEQk4ExHOeciyzFdoLcsmmiit6hx6H5+CVDrwJ+8aiaLT/kqK5xFOjy4PS7PftWz4plA==

regenerator-runtime@^0.13.4:
version "0.13.5"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz#d878a1d094b4306d10b9096484b33ebd55e26697"
integrity sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==

rescript-react-native@^0.64.3:
version "0.64.3"
resolved "https://registry.yarnpkg.com/rescript-react-native/-/rescript-react-native-0.64.3.tgz#8fd11a2681cfdd65c02f0ff620186e5adf0c6854"
integrity sha512-PjGDkV3RYiCTk4hCZyaKtZJV69By0AmJuzWyuHZONdeCB0q3DwjVJtA73gu6+jBrdl0OWon6UdXaVRXhhR47cQ==

resolve-from@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
Expand Down

0 comments on commit b4c7849

Please sign in to comment.