How to use the expo-keep-awake.useKeepAwake function in expo-keep-awake

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 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 4 months ago

Package Health Score

91 / 100
Full package analysis