ReScript bindings for
react-native-permissions
.
Exposed as ReactNativePermissions
module.
@rescript-react-native/permissions
X.y.* means it's compatible with
react-native-permissions
X.y.*
When
react-native-permissions
is properly installed & configured by following their installation instructions,
you can install the bindings:
npm install @rescript-react-native/permissions
# or
yarn add @rescript-react-native/permissions
@rescript-react-native/permissions
should be added to bs-dependencies
in your
bsconfig.json
:
{
//...
"bs-dependencies": [
"@rescript/react",
"rescript-react-native",
// ...
+ "@rescript-react-native/permissions"
],
//...
}
open ReactNative;
let requestCamera = () => {
ReactNativePermissions.(
request(
switch (Platform.os) {
| os when os === "ios" => Ios.camera
| _ => Android.camera
},
)
|> Js.Promise.then_(permissionStatus =>
switch (permissionStatus) {
| status when status === granted => Js.Promise.resolve()
| _ => Js.Promise.reject(Js.Exn.raiseError("permission error"))
}
)
)
);
};
Check the changelog for more informations about recent releases.
Read the contribution guidelines before contributing.
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.