Only supports Android, for IOS work is in progress.
Install the library using either Yarn:
yarn add @dhairyasharma/react-native-compass
yarn add react-native-shared-preferences@1.0.2
or npm:
npm install --save @dhairyasharma/react-native-compass
npm install --save eact-native-shared-preferences@1.0.2or git:
npm install git+https://github.com/dhairya0907/react-native-compass.git
npm install git+https://github.com/sriraman/react-native-shared-preferences.gitLinking the package manually is not required anymore with Autolinking.
import { CompassModule, getDegree } from "@dhairyasharma/react-native-compass";<CompassModule style={{height : "100%", width : "100%"}} handHeight={270} />
// Here handHeight is the height of the hand in dp
// And the style is the style of the compass
// Try to call CompassModule in the end of the design, see examplegetDegree().then(degree => {
console.log(degree);
});NOTE
For detail usage see example.
- Module template by react-native-module-template
Dhairya Sharma | @dhairya0907
The library is released under the MIT license. For more information see LICENSE.