Prevent the phone screen from going to sleep.
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: add hook and component

Provides greater convenience for using the functionality

Joseph Hale (Jul 25, 2025, 4:05 PM -0700) 94946f46 d788f88d

+16 -3
+16 -3
src/index.tsx
··· 1 - import KeepAwake from './NativeKeepAwake'; 1 + import NativeKeepAwake from './NativeKeepAwake'; 2 + import { useEffect } from 'react'; 2 3 3 4 export function activate(): void { 4 - KeepAwake.activate(); 5 + NativeKeepAwake.activate(); 5 6 } 6 7 7 8 export function deactivate(): void { 8 - KeepAwake.deactivate(); 9 + NativeKeepAwake.deactivate(); 10 + } 11 + 12 + export function useKeepAwake(): void { 13 + useEffect(() => { 14 + activate(); 15 + return deactivate; 16 + }, []); 17 + } 18 + 19 + export function KeepAwake() { 20 + useKeepAwake(); 21 + return null; 9 22 }