Skip to content

Releases: Qeepsake/react-native-use-permissions

v0.1.2

07 Jun 16:30
Compare
Choose a tag to compare

0.1.2 (2021-06-07)

Bug Fixes

  • tooling: added release automation and pre-commit linting (b8af6ff)

0.1.1

14 Jan 04:11
Compare
Choose a tag to compare

We updated onSetupAppListeners in use-notification-status 2d78ffb

v0.1.0...v0.1.1

0.1.0

12 Jan 20:17
Compare
Choose a tag to compare

We added the useNotificationStatus hook.

It works as such:

import { useNotificationStatus } from 'react-native-use-permissions';
import { RESULTS } from 'react-native-permissions';

  .... 

  /** State */
  const [notificationStatus, setNotificationStatus] = useNotificationStatus();

  return (
    <Button title="Enable Notifications" onPress={onEnableNotifications} />
  )

  /**
   * Asks for notification if we haven't asked for it yet
   */
  function onEnableNotifications() {
    if (notificationStatus === RESULTS.DENIED) {
      requestNotifications(['alert', 'badge']).then((value) => {
        setNotificationStatus(value.status);
      });
    }
  }