Skip to content

Commit 1302070

Browse files
init
1 parent b3b089d commit 1302070

File tree

8 files changed

+189
-60
lines changed

8 files changed

+189
-60
lines changed

README.md

Lines changed: 32 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,32 @@
1-
**How to use this template**
2-
3-
- Put your bindings in `src/ReactNativeSomething` & rename accordingly or use
4-
`bsconfig.json` `"namespace"` field (more on this below),
5-
- Update all occurences of
6-
7-
- `@reason-react-native/__template__`
8-
- `https://github.com/reason-react-native/__template__`
9-
- `__template__`
10-
- `@react-native-community/something`
11-
- `https://github.com/react-native-community/something`
12-
- `ReactNativeSomething`. If you have more than a file exposed, you should
13-
consider using BuckleScript custom namespace by adjusting `bsconfig.json`
14-
and adding a `"namespace": "react-native-something"` (note that it will be
15-
converted to `ReactNativeSomething`)
16-
17-
- Add your `@react-native-community/something` (adjusted) in `peerDependencies`
18-
& `devDependencies` section
19-
- Adjust the changelog (and/or clean it)
20-
- Remove this part ⬆ & keep everything below ⬇
1+
# `@reason-react-native/image-picker`
212

22-
---
23-
24-
# `@reason-react-native/__template__`
25-
26-
[![Build Status](https://github.com/reason-react-native/__template__/workflows/Build/badge.svg)](https://github.com/reason-react-native/__template__/actions)
27-
[![Version](https://img.shields.io/npm/v/@reason-react-native/__template__.svg)](https://www.npmjs.com/@reason-react-native/__template__)
3+
[![Build Status](https://github.com/reason-react-native/image-picker/workflows/Build/badge.svg)](https://github.com/reason-react-native/image-picker/actions)
4+
[![Version](https://img.shields.io/npm/v/@reason-react-native/image-picker.svg)](https://www.npmjs.com/@reason-react-native/image-picker)
285
[![Chat](https://img.shields.io/discord/235176658175262720.svg?logo=discord&colorb=blue)](https://reasonml-community.github.io/reason-react-native/discord/)
296

307
[ReasonML](https://reasonml.github.io) /
318
[BuckleScript](https://bucklescript.github.io) bindings for
329
[`@react-native-community/something`](https://github.com/react-native-community/something).
3310

34-
Exposed as `ReactNativeSomething` module.
11+
Exposed as `ReactNativeImagePicker` module.
3512

36-
`@reason-react-native/__template__` X.y._ means it's compatible with
37-
`@react-native-community/something` X.y._
13+
`@reason-react-native/image-picker` X.y._ means it's compatible with
14+
`react-native-image-picker` X.y._
3815

3916
## Installation
4017

4118
When
42-
[`@react-native-community/something`](`https://github.com/react-native-community/something`)
19+
[`react-native-image-picker`](`https://github.com/react-native-community/react-native-image-picker`)
4320
is properly installed & configured by following their installation instructions,
4421
you can install the bindings:
4522

4623
```console
47-
npm install @reason-react-native/__template__
24+
npm install @reason-react-native/image-picker
4825
# or
49-
yarn add @reason-react-native/__template__
26+
yarn add @reason-react-native/image-picker
5027
```
5128

52-
`@reason-react-native/__template__` should be added to `bs-dependencies` in your
29+
`@reason-react-native/image-picker` should be added to `bs-dependencies` in your
5330
`bsconfig.json`. Something like
5431

5532
```diff
@@ -59,25 +36,30 @@ yarn add @reason-react-native/__template__
5936
"reason-react",
6037
"reason-react-native",
6138
// ...
62-
+ "@reason-react-native/__template__"
39+
+ "@reason-react-native/image-picker"
6340
],
6441
//...
6542
}
6643
```
6744

6845
## Usage
6946

70-
### Types
71-
72-
#### `ReactNativeSomething.t`
73-
74-
...
75-
76-
### Methods
77-
78-
#### `ReactNativeSomething.method`
79-
80-
...
47+
```reason
48+
open ReactNativeImagePicker;
49+
50+
ImagePicker.(
51+
launchCamera(
52+
Options.make(
53+
~title="Take a picture",
54+
~cameraType=`back,
55+
~mediaType=`photo,
56+
~permissionDenied=
57+
Options.PermissionDenied.options(~title="Permission denied !", ()),
58+
(),
59+
),
60+
)
61+
);
62+
```
8163

8264
---
8365

@@ -90,10 +72,12 @@ releases.
9072

9173
## Contribute
9274

93-
Read the [contribution guidelines](https://github.com/reason-react-native/.github/blob/master/CONTRIBUTING.md) before contributing.
75+
Read the
76+
[contribution guidelines](https://github.com/reason-react-native/.github/blob/master/CONTRIBUTING.md)
77+
before contributing.
9478

9579
## Code of Conduct
9680

9781
We want this community to be friendly and respectful to each other. Please read
98-
[our full code of conduct](https://github.com/reason-react-native/.github/blob/master/CODE_OF_CONDUCT.md) so that you can understand what
99-
actions will and will not be tolerated.
82+
[our full code of conduct](https://github.com/reason-react-native/.github/blob/master/CODE_OF_CONDUCT.md)
83+
so that you can understand what actions will and will not be tolerated.

bsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
2-
"name": "@reason-react-native/__template__",
2+
"name": "@reason-react-native/image-picker",
33
"refmt": 3,
44
"reason": {
55
"react-jsx": 3
66
},
7+
"namespace": false,
78
"package-specs": {
89
"module": "commonjs",
910
"in-source": true
@@ -16,5 +17,5 @@
1617
}
1718
],
1819
"bsc-flags": ["-bs-no-version-header", "-warn-error @a"],
19-
"bs-dependencies": []
20+
"bs-dependencies": ["reason-react"]
2021
}

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
2-
"name": "@reason-react-native/__template__",
3-
"version": "0.0.0",
2+
"name": "@reason-react-native/image-picker",
3+
"version": "1.1.0",
44
"publishConfig": {
55
"access": "public"
66
},
77
"peerDependencies": {
8+
"react-native-image-picker": "1.1.0"
89
},
9-
"repository": "https://github.com/reason-react-native/__template__.git",
10+
"repository": "https://github.com/reason-react-native/image-picker.git",
1011
"license": "MIT",
1112
"keywords": [
1213
"reason",
@@ -37,7 +38,8 @@
3738
"bs-platform": "^5.2.0",
3839
"husky": "^1.3.0",
3940
"lint-staged": "^8.1.0",
40-
"prettier": "^1.18.0"
41+
"prettier": "^1.18.0",
42+
"reason-react": "^0.7.0"
4143
},
4244
"prettier": {
4345
"trailingComma": "all",

src/ReactNativeImagePicker.bs.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
4+
var PermissionDenied = { };
5+
6+
var $$Storage = { };
7+
8+
var Options = {
9+
PermissionDenied: PermissionDenied,
10+
Storage: $$Storage
11+
};
12+
13+
var ImagePicker = {
14+
Options: Options
15+
};
16+
17+
exports.ImagePicker = ImagePicker;
18+
/* No side effect */

src/ReactNativeImagePicker.re

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
module ImagePicker = {
2+
module Options = {
3+
type t;
4+
5+
module PermissionDenied = {
6+
type t;
7+
8+
[@bs.obj]
9+
external options:
10+
(
11+
~title: string=?,
12+
~text: string=?,
13+
~reTryTitle: string=?,
14+
~okTitle: string=?,
15+
unit
16+
) =>
17+
t =
18+
"";
19+
};
20+
21+
module Storage = {
22+
type t;
23+
24+
[@bs.obj]
25+
external options:
26+
(
27+
~skipBackup: bool=?,
28+
~path: string=?,
29+
~cameraRoll: bool=?,
30+
~waitUntilSaved: bool=?,
31+
unit
32+
) =>
33+
t =
34+
"";
35+
};
36+
37+
[@bs.obj]
38+
external make:
39+
(
40+
~title: string=?,
41+
~cancelButtonTitle: string=?,
42+
~takePhotoButtonTitle: string=?,
43+
~chooseFromLibraryButtonTitle: string=?,
44+
~chooseWhichLibraryTitle: string=?,
45+
~tintColor: string=?,
46+
~cameraType: [@bs.string] [ | `front | `back]=?,
47+
~mediaType: [@bs.string] [ | `photo | `video | `mixed]=?,
48+
~maxWidth: float=?,
49+
~maxHeight: float=?,
50+
~quality: float=?,
51+
~durationLimit: int=?,
52+
~rotation: float=?,
53+
~allowsEditing: bool=?,
54+
~noData: bool=?,
55+
~videoQuality: [@bs.string] [ | `low | `medium | `high]=?,
56+
~storageOptions: Storage.t=?,
57+
~permissionDenied: PermissionDenied.t=?,
58+
unit
59+
) =>
60+
t =
61+
"";
62+
};
63+
64+
type response = {. "didCancel": bool};
65+
66+
[@bs.module "react-native-image-picker"] [@bs.scope "default"]
67+
external launchCamera: Options.t => response = "launchCamera";
68+
};

src/ReactNativeSomething.bs.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/ReactNativeSomething.re

Lines changed: 0 additions & 4 deletions
This file was deleted.

yarn.lock

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,11 @@ isobject@^3.0.0, isobject@^3.0.1:
842842
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
843843
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=
844844

845+
"js-tokens@^3.0.0 || ^4.0.0":
846+
version "4.0.0"
847+
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
848+
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
849+
845850
js-yaml@^3.13.1:
846851
version "3.13.1"
847852
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
@@ -989,6 +994,13 @@ log-update@^2.3.0:
989994
cli-cursor "^2.0.0"
990995
wrap-ansi "^3.0.1"
991996

997+
loose-envify@^1.1.0, loose-envify@^1.4.0:
998+
version "1.4.0"
999+
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
1000+
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
1001+
dependencies:
1002+
js-tokens "^3.0.0 || ^4.0.0"
1003+
9921004
map-cache@^0.2.2:
9931005
version "0.2.2"
9941006
resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf"
@@ -1117,7 +1129,7 @@ number-is-nan@^1.0.0:
11171129
resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d"
11181130
integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=
11191131

1120-
object-assign@^4.0.1, object-assign@^4.1.0:
1132+
object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
11211133
version "4.1.1"
11221134
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
11231135
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
@@ -1277,6 +1289,15 @@ prettier@^1.18.0:
12771289
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
12781290
integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==
12791291

1292+
prop-types@^15.6.2:
1293+
version "15.7.2"
1294+
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
1295+
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
1296+
dependencies:
1297+
loose-envify "^1.4.0"
1298+
object-assign "^4.1.1"
1299+
react-is "^16.8.1"
1300+
12801301
property-expr@^1.5.0:
12811302
version "1.5.1"
12821303
resolved "https://registry.yarnpkg.com/property-expr/-/property-expr-1.5.1.tgz#22e8706894a0c8e28d58735804f6ba3a3673314f"
@@ -1290,6 +1311,30 @@ pump@^3.0.0:
12901311
end-of-stream "^1.1.0"
12911312
once "^1.3.1"
12921313

1314+
react-dom@>=16.8.1:
1315+
version "16.11.0"
1316+
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.11.0.tgz#7e7c4a5a85a569d565c2462f5d345da2dd849af5"
1317+
integrity sha512-nrRyIUE1e7j8PaXSPtyRKtz+2y9ubW/ghNgqKFHHAHaeP0fpF5uXR+sq8IMRHC+ZUxw7W9NyCDTBtwWxvkb0iA==
1318+
dependencies:
1319+
loose-envify "^1.1.0"
1320+
object-assign "^4.1.1"
1321+
prop-types "^15.6.2"
1322+
scheduler "^0.17.0"
1323+
1324+
react-is@^16.8.1:
1325+
version "16.11.0"
1326+
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.11.0.tgz#b85dfecd48ad1ce469ff558a882ca8e8313928fa"
1327+
integrity sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw==
1328+
1329+
react@>=16.8.1:
1330+
version "16.11.0"
1331+
resolved "https://registry.yarnpkg.com/react/-/react-16.11.0.tgz#d294545fe62299ccee83363599bf904e4a07fdbb"
1332+
integrity sha512-M5Y8yITaLmU0ynd0r1Yvfq98Rmll6q8AxaEe88c8e7LxO8fZ2cNgmFt0aGAS9wzf1Ao32NKXtCl+/tVVtkxq6g==
1333+
dependencies:
1334+
loose-envify "^1.1.0"
1335+
object-assign "^4.1.1"
1336+
prop-types "^15.6.2"
1337+
12931338
read-pkg@^4.0.1:
12941339
version "4.0.1"
12951340
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237"
@@ -1299,6 +1344,14 @@ read-pkg@^4.0.1:
12991344
parse-json "^4.0.0"
13001345
pify "^3.0.0"
13011346

1347+
reason-react@^0.7.0:
1348+
version "0.7.0"
1349+
resolved "https://registry.yarnpkg.com/reason-react/-/reason-react-0.7.0.tgz#46a975c321e81cd51310d7b1a02418ca7667b0d6"
1350+
integrity sha512-czR/f0lY5iyLCki9gwftOFF5Zs40l7ZSFmpGK/Z6hx2jBVeFDmIiXB8bAQW/cO6IvtuEt97OmsYueiuOYG9XjQ==
1351+
dependencies:
1352+
react ">=16.8.1"
1353+
react-dom ">=16.8.1"
1354+
13021355
regenerator-runtime@^0.13.2:
13031356
version "0.13.3"
13041357
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5"
@@ -1378,6 +1431,14 @@ safe-regex@^1.1.0:
13781431
dependencies:
13791432
ret "~0.1.10"
13801433

1434+
scheduler@^0.17.0:
1435+
version "0.17.0"
1436+
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.17.0.tgz#7c9c673e4ec781fac853927916d1c426b6f3ddfe"
1437+
integrity sha512-7rro8Io3tnCPuY4la/NuI5F2yfESpnfZyT6TtkXnSWVkcu0BCDJ+8gk5ozUaFaxpIyNuWAPXrH0yFcSi28fnDA==
1438+
dependencies:
1439+
loose-envify "^1.1.0"
1440+
object-assign "^4.1.1"
1441+
13811442
semver-compare@^1.0.0:
13821443
version "1.0.0"
13831444
resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc"

0 commit comments

Comments
 (0)