(resolved) checkForUpdatesAsync seems to always return true

Hello! I have a button in my app that checks for updates:

      const updateAvailable = await Updates.checkForUpdateAsync();
      if (updateAvailable) {
        await Updates.fetchUpdateAsync();
        Toast.show({
          textStyle: { fontFamily: 'Roboto_regular' },
          text: 'Update Available.',
          buttonText: 'OK',
          type: 'success',
        });
      }

I deployed the app as a standalone and every time I call this code it returns true that an update is available. Am I doing something wrong?

My bad, I didn’t read the return type and due to lack of ability to test this on a simulator I didn’t realize. checkForUpdatesAsync returns an object with an isAvailable boolean prop.

      const { isAvailable } = await Updates.checkForUpdateAsync();
      if (isAvailable) {
        await Updates.fetchUpdateAsync();
        Toast.show({
          textStyle: { fontFamily: 'Roboto_regular' },
          text: 'Update Available.',
          buttonText: 'OK',
          type: 'success',
        });
      }

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.