React Native module for iOS & Android to receive compass heading
$ yarn add react-native-compass-heading
$ npx pod-install
import CompassHeading from 'react-native-compass-heading';
React.useEffect(() => {
const degree_update_rate = 3;
CompassHeading.start(degree_update_rate, ({heading, accuracy}) => {
console.log('CompassHeading: ', heading, accuracy);
});
return () => {
CompassHeading.stop();
};
}, []);
Thanks to the authors of react-native-simple-compass for inspiration