1.0.1 • Published 1 year ago

react-native-screen-lock-unlock-listener v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-native-screen-lock-unlock-listener

Getting started

yarn add react-native-screen-lock-unlock-listener

or

$ npm install react-native-screen-lock-unlock-listener --save

Usage

at the top

import { NativeEventEmitter, NativeModules } from "react-native";
import PhoneLocked from "react-native-screen-lock-unlock-listener";

const App: () => React$Node = () => {
  // inside function //
  const eventEmitter = new NativeEventEmitter(NativeModules.PhoneLocked);

  eventEmitter.addListener("EventReminder", (res) => {
    // listen here for screen on or off action
    console.log(res.action); // ACTION_USER_PRESENT || ACTION_SCREEN_OFF || ACTION_SCREEN_ON
  });

  return <></>;
};
1.0.1

1 year ago

1.0.0

1 year ago