You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useEffect(() => {
// Check if HealthKit is available
AppleHealthKit?.isAvailable((err, available) => {
if (err || !available) {
Alert.alert(
"HealthKit Not Available",
"This device does not support Apple HealthKit."
);
return;
}
setIsHealthKitAvailable(true);
I dont know what am i missing here my library is installed properly ,pods are installed correctly but getting such error.
same error also there for isAvailable call.
Can anyone suggest or help me out to solve this issue?
The text was updated successfully, but these errors were encountered:
This started happening in our project when we upgraded to React Native 0.76. The library works well with React Native 0.75.4.
This issue has already been reported here, and this PR has a fix
Same problem im facing. im using native 0.76.3. version. so you solved this issue ? or the problem is with react-native-health dependency only. please let me know .
import React, { useEffect, useState } from "react";
import { View, Text, Button, Alert } from "react-native";
import AppleHealthKit, { HealthKitPermissions } from "react-native-health";
const App = () => {
const [isHealthKitAvailable, setIsHealthKitAvailable] = useState(false);
const [hasPermissions, setHasPermission] = useState(false);
const [steps, setSteps] = useState<number | null>(null);
const permissions: HealthKitPermissions = {
permissions: {
read: [AppleHealthKit.Constants.Permissions.Steps],
write: [],
},
};
const fetchSteps = () => {
const options = {
startDate: new Date(2024, 0, 1).toISOString(), // Example: fetch data from Jan 1, 2024
endDate: new Date().toISOString(),
};
};
useEffect(() => {
// Check if HealthKit is available
AppleHealthKit?.isAvailable((err, available) => {
if (err || !available) {
Alert.alert(
"HealthKit Not Available",
"This device does not support Apple HealthKit."
);
return;
}
setIsHealthKitAvailable(true);
}, []);
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
{isHealthKitAvailable
?
Steps Count: ${steps ?? "Loading..."}
: "HealthKit not available"}
{isHealthKitAvailable && (
)}
);
};
export default App;
I dont know what am i missing here my library is installed properly ,pods are installed correctly but getting such error.
same error also there for isAvailable call.
Can anyone suggest or help me out to solve this issue?
The text was updated successfully, but these errors were encountered: