Get the time the app was installed on the device with Application
Other hooks — Usage — Changelog
expo install @use-expo/application expo-application
// full hook
const [installTime, getInstallTime] = useApplicationInstallTime();
// other options
useApplicationInstallTime({ get: false });
import { useApplicationInstallTime } from '@use-expo/application';
import React from 'react';
import { Text, View } from 'react-native';
function ApplicationInstallTimeExample() {
const [installTime] = useApplicationInstallTime();
return (
<View>
<Text>Install time: {installTime ? installTime.toString() : '-'}</Text>
</View>
);
}
function useApplicationInstallTime(options?: Options): Result;
interface Options {
/** If it should fetch the application install time when mounted, defaults to `true` */
get?: boolean;
}
type Result = [
/** The current application install time */
Date | undefined,
/** Callback to manually get the application install time */
() => Promise<void>,
];
with ❤️ byCedric