react-native-magic-flashlight
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

react-native-magic-flashlight

A simple library to turn on or off flash on Android/iOS device.

Installation

npm install react-native-magic-flashlight

Usage

import {
  toggleFlash,
  isFlashOn,
  hasFlash,
} from 'react-native-magic-flashlight';

// ...

function deviceHasFlash() {
  hasFlash(
    () => console.log('Has Flash'),
    () => console.log('No Flash')
  );
}

function turnOn() {
  toggleFlash(
    !flashState,
    () => console.log('Success'),
    () => console.log('Error')
  );
}

function flashIsOn() {
  const result = isFlashOn((on) => on);
  console.log(result);
}

Contributing

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

License

MIT


Created by Marco Almeida

Package Sidebar

Install

npm i react-native-magic-flashlight

Weekly Downloads

4

Version

0.1.3

License

MIT

Unpacked Size

35.7 kB

Total Files

20

Last publish

Collaborators

  • marcoalvesalmeida