0.1.3 • Published 2 years ago

react-native-magic-flashlight v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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