A simple library to turn on or off flash on Android/iOS device.
npm install react-native-magic-flashlight
import {
toggleFlash,
isFlashOn,
hasFlash,
} from 'react-native-magic-flashlight';
// ...
function deviceHasFlash() {
hasFlash(
() => console.log('Has Flash'),
() => console.log('No Flash')
);
}
function turnOn() {
toggleFlash(
true,
() => console.log('Success'),
() => console.log('Error')
);
}
function flashIsOn() {
const result = isFlashOn((on) => on);
console.log(result);
}
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Created by Marco Almeida