Force update

useGetDeviceAppVersion

How to use it?

  • Import useGetDeviceAppVersion:

import {useGetDeviceAppVersion} from 'LinkerStudio/core/hooks';
  • Add this code block:

const [updateRequired] = useGetDeviceAppVersion();
  • Import ForceUpdateStackNavigator

import ForceUpdateStackNavigator from 'src/navigation/ForceUpdateStackNavigator';
  • In your <NavigationContainer></NavigationContainer> add the next code block

<NavigationContainer >
   {updateRequired ? <ForceUpdateStackNavigator /> : /* Other stack */}
</NavigationContainer>

How to get force update?

  • Import the deviceInfo services:

import deviceInfo from 'LinkerStudio/core/services/forceUpdateServices';
  • Import Platform to get the platform the app is running on (Android or iOS).

import {Platform} from 'react-native';
const getApiCurrentVersion = useCallback(async () => {
    try {
      const response = await deviceInfo.fetchDeviceAppVersion(
        Platform.OS.toUpperCase(),
      );
    } catch (error) {
      return error
    }
  }, []);

Last updated