📜  反应本机控制设备亮度 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:58.503000             🧑  作者: Mango

代码示例1
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);