Simple API to turn on and off flash in react native
npm install react-native-flash
react-native link react-native-flash
In your index.android.js
:
import RNFlash from 'react-native-flash';
RNFlash.turnOnFlash(); // turn on flash
RNFlash.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.
*/
RNFlash.hasFlash(function(){
RNFlash.turnOnFlash();
},function(){
alert("You do not have flash")
});
});
- Any Suggestions?