In my App I use Accelerometer and I would like to use the function Accelerometer.isAvailableAsync().
My App is managed with Expo.
This is my code :
import { Accelerometer } from 'expo';
...
isAccelerometerAvailable(){
Accelerometer.isAvailableAsync()
.then(
result => {
this.setState({
isAccelerometerAvailable: String(result)
});
},
error => {
this.setState({
isAccelerometerAvailable: "Could not get isAvailable: " + error
});
}
);
}
I receive this error :
TypeError: _expo.Accelerometer.isAvailableAsync is not a function. (In '_expo.Accelerometer.isAvailableAsync()', '_expo.Accelerometer.isAvailableAsync' is undefined)]
Can you provide some more information as to how it “doesn’t work”? It’s impossible for us to help you out without concrete errors or detailed explanations of what’s occurring.
Sorry for the delay here. Can you try creating a Snack that reproduces this issue? From your json files, it looks like things should be working properly.