import { useEffect , useState } from 'react' ; import { Pedometer } from 'expo-sensors' ; import { PedometerResult , PedometerOptions } from './use-pedometer' ; see https remarks example export function usePedometerHistory ( options ) { const [ data , setData ] = useState ( options . initial ) ; const [ available , setAvailable ] = useState < boolean > ( ) ; const { availability = true , start , end , } = options ; useEffect ( ( ) => { if ( availability ) { Pedometer . isAvailableAsync ( ) . then ( setAvailable ) ; } Pedometer . getStepCountAsync ( start , end ) . then ( setData ) ; } , [ availability , start , end ] ) ; return [ data , available ] ; } export interface PedometerHistpryOptions extends PedometerOptions { see https start : Date ; see https end : Date ; }