How to use expo-keep-awake - 4 common examples

To help you get started, we’ve selected a few expo-keep-awake examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sysgears / larix / packages / create / templates / mobile-rest / src / AwakeInDevApp.tsx View on Github external
public _activate() {
    if (process.env.NODE_ENV === 'development') {
      activateKeepAwake();
    }
  }
github sysgears / larix / packages / create / templates / mobile-rest / src / AwakeInDevApp.tsx View on Github external
public _deactivate() {
    if (process.env.NODE_ENV === 'development') {
      deactivateKeepAwake();
    }
  }
}
github expo / expo / packages / expo / src / deprecated.ts View on Github external
get() {
      deprecatedModule(
        `import { KeepAwake } from 'expo' -> import KeepAwake from 'expo-keep-awake'`,
        'expo-keep-awake'
      );
      return require('expo-keep-awake').default;
    },
  },
github callstack / react-native-paper / example / src / index.tsx View on Github external
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);

expo-keep-awake

Provides a React component that prevents the screen sleeping when rendered. It also exposes static methods to control the behavior imperatively.

MIT
Latest version published 27 days ago

Package Health Score

89 / 100
Full package analysis