Skip to content

Latest commit

 

History

History
78 lines (66 loc) · 2.32 KB

use-application-install-time.md

File metadata and controls

78 lines (66 loc) · 2.32 KB

useApplicationInstallTime

Get the time the app was installed on the device with Application

releases builds demo

Other hooks   —   Usage   —   Changelog


expo install @use-expo/application expo-application

Usage

// full hook
const [installTime, getInstallTime] = useApplicationInstallTime();

// other options
useApplicationInstallTime({ get: false });

Example

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>
    );
}

API

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