Have ideas to improve npm?Join in the discussion! »

    @reason-react-native/permissions

    2.2.1 • Public • Published

    @reason-react-native/permissions

    Build Status Version Chat

    ReScript / Reason bindings for react-native-permissions.

    Exposed as ReactNativePermissions module.

    @reason-react-native/permissions X.y.* means it's compatible with react-native-permissions X.y.*

    Installation

    When react-native-permissions is properly installed & configured by following their installation instructions, you can install the bindings:

    npm install @reason-react-native/permissions
    # or
    yarn add @reason-react-native/permissions

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

    {
      //...
      "bs-dependencies": [
        "reason-react",
        "reason-react-native",
        // ...
    +    "@reason-react-native/permissions"
      ],
      //...
    }

    Usage

    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"))
            }
          )
        )
      );
    };

    Changelog

    Check the changelog for more informations about recent releases.


    Contribute

    Read the contribution guidelines before contributing.

    Code of Conduct

    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.

    Install

    npm i @reason-react-native/permissions

    DownloadsWeekly Downloads

    1

    Version

    2.2.1

    License

    MIT

    Unpacked Size

    14.4 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar