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/permissions `
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/permissions/workflows/Build/badge.svg )] ( https://github.com/reason-react-native/permissions/actions )
4+ [ ![ Version] ( https://img.shields.io/npm/v/@reason-react-native/permissions.svg )] ( https://www.npmjs.com/@reason-react-native/permissions )
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 ` ReactNativePermissions ` 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/permissions ` X.y._ means it's compatible with
14+ ` react-native-permissions ` X.y._
3815
3916## Installation
4017
4118When
42- [ ` @ react-native-community/something ` ] ( `https://github.com/react-native-community/something ` )
19+ [ ` react-native-permissions ` ] ( `https://github.com/react-native-community/react-native-permissions ` )
4320is properly installed & configured by following their installation instructions,
4421you can install the bindings:
4522
4623``` console
47- npm install @reason-react-native/__template__
24+ npm install @reason-react-native/permissions
4825# or
49- yarn add @reason-react-native/__template__
26+ yarn add @reason-react-native/permissions
5027```
5128
52- ` @reason-react-native/__template__ ` should be added to ` bs-dependencies ` in your
29+ ` @reason-react-native/permissions ` should be added to ` bs-dependencies ` in your
5330` bsconfig.json ` . Something like
5431
5532``` diff
@@ -59,25 +36,33 @@ yarn add @reason-react-native/__template__
5936 "reason-react",
6037 "reason-react-native",
6138 // ...
62- + "@reason-react-native/__template__ "
39+ + "@reason-react-native/permissions "
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 ReactNative;
49+ open ReactNativePermissions;
50+
51+ let requestCamera = () => {
52+ Permissions.request(
53+ switch (Platform.os) {
54+ | os when os === "ios" => Permissions.Constants.IOS.camera
55+ | _ => Permissions.Constants.Android.camera
56+ },
57+ )
58+ |> Js.Promise.then_(permissionStatus =>
59+ switch (permissionStatus) {
60+ | status when status === Results.granted => Js.Promise.resolve()
61+ | _ => Js.Promise.reject(Js.Exn.raiseError("permission error"))
62+ }
63+ );
64+ };
65+ ```
8166
8267---
8368
@@ -90,10 +75,12 @@ releases.
9075
9176## Contribute
9277
93- Read the [ contribution guidelines] ( https://github.com/reason-react-native/.github/blob/master/CONTRIBUTING.md ) before contributing.
78+ Read the
79+ [ contribution guidelines] ( https://github.com/reason-react-native/.github/blob/master/CONTRIBUTING.md )
80+ before contributing.
9481
9582## Code of Conduct
9683
9784We 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.
85+ [ our full code of conduct] ( https://github.com/reason-react-native/.github/blob/master/CODE_OF_CONDUCT.md )
86+ so that you can understand what actions will and will not be tolerated.
0 commit comments