Prevent the phone screen from going to sleep.
0

Configure Feed

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

refactor: simplify example code

Also better matches the README code

Joseph Hale (Jul 25, 2025, 5:29 PM -0700) 9d9eb064 3b9c0b60

+3 -14
+3 -14
example/src/App.tsx
··· 1 - import * as KeepAwake from '@thehale/react-native-keep-awake'; 2 - 3 1 import { Button, Platform, StyleSheet, Text, View } from 'react-native'; 2 + import { activate, deactivate } from '@thehale/react-native-keep-awake'; 4 3 5 4 export default function App() { 6 5 return ( ··· 22 21 </Text> 23 22 )} 24 23 </View> 25 - <Button 26 - title="Activate" 27 - onPress={() => { 28 - KeepAwake.activate(); 29 - }} 30 - /> 31 - <Button 32 - title="Deactivate" 33 - onPress={() => { 34 - KeepAwake.deactivate(); 35 - }} 36 - /> 24 + <Button title="Activate" onPress={activate} /> 25 + <Button title="Deactivate" onPress={deactivate} /> 37 26 </View> 38 27 ); 39 28 }