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
deviceInfoservices:
import deviceInfo from 'LinkerStudio/core/services/forceUpdateServices';Import
Platformto 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
Was this helpful?