Make compass in React-Native
<p>I'am trying to make a compass but i don't know how to use the data of the Magnetometer.</p>

<p>This is my class Compass:</p>

<pre><code>class Compass extends Component {
  constructor(props) {
    super(props);
  }
  componentWillMount(){
    this._animeRotation = new Animated.Value(0);
  }
  componentDidMount() {
      this.startAnimation();
  }
  startAnimation() {
    Animated.timing(this._animeRotation, {
      toValue: this.props.magn, //&lt;-- What put here?
      duration: 1000,
    }).start(() =&gt; {
      this.startAnimation();
    });
  }
  render() {
    var interpolatedRotateAnimation = this._animeRotation.interpolate({
      inputRange: [0, 100],
      outputRange: ['0deg', '360deg']
    });
    return (
      &lt;View&gt;
        &lt;Animated.View style={[styles.box, {transform: [{rotate: interpolatedRotateAnimation}]}]}&gt;
          &lt;Image style={styles.box} source={require('./arrow.png')}&gt;&lt;/Image&gt;
        &lt;/Animated.View&gt;
      &lt;/View&gt;
    );
  }
}
</code></pre>

<p>This is the class App:</p>

<pre><code>class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      magn: {
        x: 0,
        y: 0,
        z: 0
      }
    };
  }
  componentDidMount() {
    //I can get the gyroscope if is necessary
    SensorManager.startMagnetometer(500);
    // magn is a object with axis z,y and x
    DeviceEventEmitter.addListener('Magnetometer', (magn) =&gt; this.setState({magn})); 
  }
  render() {
    return (
      &lt;View&gt;
          &lt;Compass magn={this.state.magn.x}&gt;&lt;/Compass&gt;
      &lt;/View&gt;
    );
  }
}
</code></pre>

<p>With this code the arrow rotate but not as it should. That I have to do?</p>