Describe the bug
I'm using react query in react native to fetch the geolocation coordinates. It iseems to be working fine but giving a warning in the console Setting a timer for a long period of time.
To Reproduce
Steps to reproduce the behavior:
- Create React Native CLI Project
- Install
react-native-geolocation-service
- create a react query for fetching location
Expected behavior
When I try to mimic the react query using custom hooks it doesn't give the timer warning.
Smartphone (please complete the following information):
- Device: Android emulator, Pixel_2_API_29
- OS: macOS Catalina
- "react": "16.13.1",
- "react-native": "0.63.3",
- "react-query": "^2.26.1"
Code:
async function getPosition() {
const hasLocationPermission = await checkLocationPermission();
if (!hasLocationPermission) {
return;
}
return new Promise((res, rej) => {
Geolocation.getCurrentPosition(res, rej);
});
}
const App = () => {
const info = useQuery('pos', getPosition);
console.log({info});
}
Warning:
Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See https://github.com/facebook/react-native/issues/12981 for more info.
(Saw setTimeout with duration 300000ms)
Describe the bug
I'm using react query in react native to fetch the geolocation coordinates. It iseems to be working fine but giving a warning in the console
Setting a timer for a long period of time.To Reproduce
Steps to reproduce the behavior:
react-native-geolocation-serviceExpected behavior
When I try to mimic the react query using custom hooks it doesn't give the timer warning.
Smartphone (please complete the following information):
Code:
Warning: