Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public _activate() {
if (process.env.NODE_ENV === 'development') {
activateKeepAwake();
}
}
public _deactivate() {
if (process.env.NODE_ENV === 'development') {
deactivateKeepAwake();
}
}
}
get() {
deprecatedModule(
`import { KeepAwake } from 'expo' -> import KeepAwake from 'expo-keep-awake'`,
'expo-keep-awake'
);
return require('expo-keep-awake').default;
},
},
export default function PaperExample() {
useKeepAwake();
const [isReady, setIsReady] = React.useState(false);
const [initialState, setInitialState] = React.useState<
InitialState | undefined
>();
const [theme, setTheme] = React.useState(DefaultTheme);
const [rtl, setRtl] = React.useState(I18nManager.isRTL);
React.useEffect(() => {
const restoreState = async () => {
try {
const savedStateString = await AsyncStorage.getItem(PERSISTENCE_KEY);
const state = JSON.parse(savedStateString || '');
setInitialState(state);