react-native-light
React Native module for mobile flashlight. (IOS / ANDROID)
Installation
Using yarn:
yarn add react-native-light
or using npm:
npm install --save react-native-light
Linking
react-native link react-native-light
Usage
Methods
Method Name | Return type | Notes |
---|---|---|
turnLightOn | trun light on | |
turnLightOff | turn light off | |
toggle | toggle light | |
isLightActive | Boolean | if light is active |
Events
Event Name | Returns | Notes |
---|---|---|
onLightTurnedOn | Callback that is called once the light turned on. | |
onLightTurnedOff | Callback that is called once the light turned off. |
Example
;;; async { const state = await ; ; } { lightEventEmitter; lightEventEmitter; } { return <View style=stylescontainer> <View style=stylesbuttons> <Button title='on' onPress= /> <Button title='off' onPress= /> <Button title='toggle' onPress= /> <Button title='state' onPress= this /> </View> </View> ; } const styles = StyleSheet;