Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
This example uses both the Permissions and Brightness modules.
When you grant the SYSTEM_BRIGHTNESS permission, it renders two buttons to switch the system brightness mode.
{(permission && permission.status !== 'granted') && (
We need permission to modify the system brightness.
)}
{(permission && permission.status === 'granted') && (
<>
<button mode="{mode" color="#333"> setMode(BrightnessMode.AUTOMATIC)}
>
Automatic
</button>
<button mode="{mode" color="#333"> setMode(BrightnessMode.MANUAL)}
>
Manual
</button>
)}
onPress={() => setMode(BrightnessMode.AUTOMATIC)}
>