如何通过GoogleMap应用将“感谢地图”移动到陀螺仪(传感器)数据? (本机)

时间:2019-02-11 11:50:08

标签: react-native react-native-maps

有人知道如何通过GoogleMap应用将感谢的地图方向移动到陀螺仪数据(x,y和z)吗?

我在这里得到了这些值,但是我不知道如何将它们实现为react-native-maps ...

所以我有以下代码:

componentWillMount() {

    this._toggle();
}

_subscribe = () => {
    this._subscription = Gyroscope.addListener((result) => {
        this.setState({gyroscopeData: result});
    });
};

_unsubscribe = () => {
    this._subscription && this._subscription.remove();
    this._subscription = null;
};


render() {
    let { x, y, z } = this.state.gyroscopeData;
    //console.log(this.round(x), this.round(y), this.round(z));
    return (
        <View style={styles.container}>
            <MapView
                style={styles.map}
                followsUserLocation
                showsUserLocation
                showsMyLocationButton
                loadingEnabled
                initialRegion={this.state.mapRegion}
                mapType="none"
                >
                <UrlTile
                urlTemplate="https://c.tile.openstreetmap.org/{z}/{x}/{y}.png"/>

                {this.props.children}

            </MapView>


        </View>

    );

}

先谢谢!

0 个答案:

没有答案