Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onPress={async () => {
const end = new Date();
const start = new Date();
start.setDate(end.getDate() - 1);
const result = await Pedometer.getStepCountAsync(start, end);
Alert.alert(
'Pedometer result',
`Number of steps for the last day: ${result.steps}`
);
}}
title="Get steps count"
useEffect(() => {
if (availability) {
Pedometer.isAvailableAsync().then(setAvailable);
}
Pedometer.getStepCountAsync(start, end).then(setData);
}, []);