https://github.com/dhairya0907/react-native-compass
Native android compass library for react-native
https://github.com/dhairya0907/react-native-compass
android compass native react-native
Last synced: about 2 months ago
JSON representation
Native android compass library for react-native
- Host: GitHub
- URL: https://github.com/dhairya0907/react-native-compass
- Owner: dhairya0907
- License: mit
- Created: 2022-04-02T09:28:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-02T12:21:33.000Z (over 3 years ago)
- Last Synced: 2024-06-23T17:51:57.455Z (over 1 year ago)
- Topics: android, compass, native, react-native
- Language: Kotlin
- Homepage: https://www.npmjs.com/package/@dhairyasharma/react-native-compass
- Size: 1.6 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `@dhairyasharma/react-native-compass`
 [  ](/LICENSE)  [  ](https://github.com/dhairya0907) [](https://github.com/dhairya0907/react-native-encryption/releases)
[ ](https://twitter.com/dhairya_0907) [  ](https://www.linkedin.com/in/dhairyasharma0907/)
### Native android compass library for react-native
***Only supports Android, for IOS work is in progress.***
# Getting started
Install the library using either Yarn:
```
yarn add @dhairyasharma/react-native-compass
yarn add react-native-shared-preferences@1.0.2
```or npm:
```sh
npm install --save @dhairyasharma/react-native-compass
npm install --save eact-native-shared-preferences@1.0.2
```or git:
```sh
npm install git+https://github.com/dhairya0907/react-native-compass.git
npm install git+https://github.com/sriraman/react-native-shared-preferences.git
```### Using React Native >= 0.60
Linking the package manually is not required anymore with [Autolinking](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md).
# Usage
## Import the library
```javascript
import { CompassModule, getDegree } from "@dhairyasharma/react-native-compass";
```## Get compass
```javascript// 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 example
```## Get the compass Degree
```javascript
getDegree().then(degree => {
console.log(degree);
});
```---
**NOTE**
**For detail usage see [example](https://github.com/dhairya0907/react-nativee-compass/blob/a593e7376c48a755a506f972949fe69c48f9aeba/example/src/App.tsx#L1).**
---
# Acknowledgements
- Module template by [react-native-module-template](https://github.com/demchenkoalex/react-native-module-template)
# Author
Dhairya Sharma | [@dhairya0907](https://github.com/dhairya0907)
# License
The library is released under the MIT license. For more information see [`LICENSE`](/LICENSE).