Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
useEffect(() => {
if (availability) {
Gyroscope.isAvailableAsync().then(setAvailable);
}
if (options.interval !== undefined) {
Gyroscope.setUpdateInterval(options.interval);
}
return Gyroscope.addListener(setData).remove;
}, []);
private subscribe() {
this.subscription = Gyroscope.addListener(result => {
this.setState({ gyroscopeData: result });
});
}