UNPKG

992 BJavaScriptView Raw
1import { NativeModules, Platform } from 'react-native';
2export async function getBrightnessAsync() {
3 return await NativeModules.ExponentBrightness.getBrightnessAsync();
4}
5export async function setBrightnessAsync(brightnessValue) {
6 brightnessValue = Math.max(0, Math.min(brightnessValue, 1));
7 return await NativeModules.ExponentBrightness.setBrightnessAsync(brightnessValue);
8}
9export async function getSystemBrightnessAsync() {
10 if (Platform.OS !== 'android') {
11 return await getBrightnessAsync();
12 }
13 return await NativeModules.ExponentBrightness.getSystemBrightnessAsync();
14}
15export async function setSystemBrightnessAsync(brightnessValue) {
16 brightnessValue = Math.max(0, Math.min(brightnessValue, 1));
17 if (Platform.OS !== 'android') {
18 return await setBrightnessAsync(brightnessValue);
19 }
20 else {
21 return await NativeModules.ExponentBrightness.setSystemBrightnessAsync(brightnessValue);
22 }
23}
24//# sourceMappingURL=Brightness.js.map
\No newline at end of file