Giter Club home page Giter Club logo

react-native-compass-heading's People

Contributors

bhurghundii avatar cixio avatar cristianocca avatar cristianoccazinsp avatar dependabot[bot] avatar firofame avatar sebastiangrzymala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-compass-heading's Issues

undefined everywhere

I followed the installation instructions and I've got undefined for both heading and accuracy, while testing in emulator.
This is the code I am using and the logs says undefined:
`
import React, { useState, useEffect } from "react"
import { Image, StyleSheet } from "react-native"
import CompassHeading from "react-native-compass-heading"
function Compass() {
const [compassHeading, setCompassHeading] = useState(0)

useEffect(() => {
	const degree_update_rate = 3

	// accuracy on android will be hardcoded to 1
	// since the value is not available.
	// For iOS, it is in degrees
	CompassHeading.start(degree_update_rate, ({ heading, accuracy }) => {
        console.log({heading, accuracy})
		setCompassHeading(heading)
	})

	return () => {
		CompassHeading.stop()
	}
}, [])
if(!compassHeading) return null
return (
	<Image
		style={[
			styles.image,
			{ transform: [{ rotate: `${360 - compassHeading}deg` }] },
		]}
		resizeMode="contain"
		source={require("../compass.png")}
	/>
)}
const styles = StyleSheet.create({
image: {
	width: "90%",
	flex: 1,
	alignSelf: "center",
},
})
export default Compass

`

Types are missing in 1.5.0

Hi,

Using the 1.5.0 version of the package, my editor can't find the type declaration file. According to the package.json, it should be at the root of the project, but no file is here. Instead, a declaration file is created inside the lib/typescript directory (with just any as type).

I'd be glad to help if you can give me some information about the build system.

Version 1.4.2 is fine, by the way (see it in npm)

Compass doesn't work on ios

Hi,

I contact you because i wanna use a compass in my ios application.
And when I tried your example, it works perfectly on android, but I can't get it to work on ios.
If you have any advice.

Thanks in advance, best regards

doesn't seem to have accurate heading information on android

I used this to build a compass specifically for mapping tower locations and providing feedback on how to best directionally tune your antenna ... on iOS it works great (apple maps), however on android it doesn't work very well (google maps) ... if i open google maps and verify that it's tracking heading correctly it's fine, so i know it's not an issue with the device.

Terminating app due to uncaught exception

Hi, thank you for releasing this package! I'm trying to use it but when I start the app it doesn't load. In Xcode it says:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: HeadingUpdated with body: 323.4593505859375. Bridge is not set. This is probably because you've explicitly synthesized the bridge in CompassHeading, even though it's inherited from RCTEventEmitter.'

I'm using it in my main app.js on componentDidMount and without hooks (React Native 0.59.3). Any ideas? Thanks!

Can't get it working on android

It's working fine on iOS but on on Android I'm getting the error below and can't build the project

A problem occurred configuring project ':react-native-compass-heading'.
> compileSdkVersion is not specified. Please add it to build.gradle

* What went wrong:
A problem occurred evaluating project ':react-native-compass-heading'.
> Plugin with id 'maven' not found.

Compass loses North after couple rotations

I like this package, exactly what I was looking for! Lightweight, simple compass. But I notice if I am using, rotate my phone for a few seconds (like when walking) then pause, then move phone again my true north changes where it is pointing. So it is perfect initially but on pause, I am not sure what happens but loses true north.
My Android Phone Test: (against a real compass in my hand)
In my test, I lay the phone flat in palm (right angle) pointing away from my body. True north is correct.
I slowly reverse the phone so it is facing my body (180' turn), still at a right angle. True north is off by 90' or so.
When I continue clockwise to finish my 360 circle and put phone back in original position it slowly gets closer and when I get fully back to where I started, true north is correct.

How to use this liabrary?

How to use this liabrary? there is no examle and as well as very less explain how to use it in project.

Can't get running on iPhone iOS 15.3.1

For some uknown issue, I'm still reciving on iOS -1 heading.

react-native-geolocation-service shows same, until I don't move around a little bit, after it shows single value, probably there is some kind of limit for retriving info, this package doesn't change even after moving

By any chance somebody faced this issue ? Or it's something new?

Can I make it for 3d?

I want to make a 3d compass in android. Is there any way to do this with this library? Or Can anyone help me how I can proceed to 3d compass

Device shows this message: 'CompassHeading: undefined undefined'.

Hi, I am building an app for GNSS controller and I wanted to implement this in my code.

After importing and using this function as in the example, my device shows this message: 'CompassHeading: undefined undefined'.

It seems to be responding to rotation of the device but I can't resolve this issue. I tried giving more permisions but that didn't resolve the issue.

Does anyone know the fix?

'Corelocation/CoreLocation.h' file not found

I added the library to my project and it works perfectly on android, but when trying to run it on iOS Simulator through Xcode it shows this error: 'Corelocation/CoreLocation.h' file not found

Has anyone ever experienced this? Did I forget something?

Try in:
iOS 16.2
Xcode 14.2
RN 0.71.0

Some time I am facing issue when app start

Error: The package 'react-native-compass-heading' doesn't seem to be linked. Make sure:

  • You rebuilt the app after installing the package
  • You are not using Expo Go

I am using react native cli

Compass doesn't calculate degree if not moved

When u leave the compass page then go back in, if your device is stable on a surface for example, the compass either freezes or takes time to calculate the degree, anyone faced this issue and fixed it?

Is it possible to get accuracy information on Android?

Nowadays accuracy in Android is pseudo constant 1. At least this (https://stackoverflow.com/questions/28175420/android-compass-accuracy-when-to-calibrate) StackOverflow question and answer gives more options for the value. They come from SensorManager class. Some examplery code of the approach decribed there:

 switch(sensor.getType()) {
        case Sensor.TYPE_MAGNETIC_FIELD :
            switch(accuracy) {
                case SensorManager.SENSOR_STATUS_ACCURACY_LOW :
                    doSomething();
                    break;
                case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM :
                    doSomethingElse();
                    break;
                case SensorManager.SENSOR_STATUS_ACCURACY_HIGH :
                    doNothing();
                    break;
            }
            break;
        default:
            break;
     }

Those functions should be returning a value between 0 and 1. For Low there would be value 0, for Medium 0.5 and High 1 for example. Would that work?

CompassHeading.start Error

Dear developer
does this package work with Expo?
i'm getting error: null is not an object(evaluating 'CompassHeading.start')

Regards

can not run on android

Screen Shot 2022-05-17 at 21 55 45
hi guys pls help me, I got error like image when run npx react-native run-android
my setup: - react-native: 0.60.6
react-native-compass-heading: ^1.4.0
any special install?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.