react native controlling device brightness
npm i @adrianso/react-native-device-brightness //write code as following import DeviceBrightness from 'react-native-device-brightness'; // Setting brightness DeviceBrightness.setBrightnessLevel(brightness); // Getting brightness const brightness = await DeviceBrightness.getBrightnessLevel(); console.log(brightness); // Getting system brightness (Android only) const brightness = await DeviceBrightness.getSystemBrightnessLevel(); console.log(brightness);
Here is what the above code is Doing:
1. Importing the library
2. Setting the brightness level
3. Getting the brightness level
4. Getting the system brightness level (Android only)