@mertozyilmazz/react-native-flash
v1.0.3
Published
It helps to turn the phone's flash on and off.
Downloads
33
Maintainers
Readme
react-native-flash
Simple API to turn on and off flash in react native
Installation
npm install @mertozyilmazz/react-native-flash
or
yarn add @mertozyilmazz/react-native-flash
Usage
In your *.js
:
import Flash from '@mertozyilmazz/react-native-flash'
Flash.turnOnFlash() // turn on flash
Flash.turnOffFlash() // turn off flash
/*Has flash checks if the phone has flash available.
Since all communication between react native and native modules is asychrounous, it takes a success callback, and failure callback. atm both callbacks are necessary.
*/
Flash.hasFlash(function(){
Flash.turnOnFlash()
},function(){
alert("You do not have flash")
})
})