@okhi/react-native-core

Core package for the OkHi react native suite of libraries

Usage no npm install needed!

<script type="module">
  import okhiReactNativeCore from 'https://cdn.skypack.dev/@okhi/react-native-core';
</script>

README

@okhi/react-native-core

Core package for the OkHi react native suite of libraries

Installation

npm install @okhi/react-native-core

Usage

import {
  isGooglePlayServicesAvailable,
  isLocationPermissionGranted,
  isLocationServicesEnabled,
  requestEnableGooglePlayServices,
  requestEnableLocationServices,
  requestLocationPermission,
  isBackgroundLocationPermissionGranted,
  requestBackgroundLocationPermission,
} from '@okhi/react-native-core';

async function checkPermissions() {
  if (!(await isGooglePlayServicesAvailable())) {
    await requestEnableGooglePlayServices(); // resolves true | false
  }

  if (!(await isLocationPermissionGranted())) {
    await requestLocationPermission(); // resolves true | false
  }

  if (!(await isLocationServicesEnabled())) {
    await requestEnableLocationServices(); // resolves true | false
  }

  if (!(await isBackgroundLocationPermissionGranted())) {
    await requestBackgroundLocationPermission(); // resolves true | false
  }
}

Documentation

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT