收到错误 No ViewManager defined for class RCTRawText

getting an error No ViewManager defined for class RCTRawText

我正在尝试使用 geolocation.getcurrentposition,但出现错误。以下是错误的屏幕截图:

下面是我的 App.Js 代码:

import React, { Component } from 'react';
import { View, Text } from 'react-native';

class GeolocationExample extends Component {
  constructor(props) {
    super(props);

    this.state = {
      latitude: null,
      longitude: null,
      error: null,
    };
  }

  componentDidMount() {
    // Instead of navigator.geolocation, just use Geolocation.
    if (hasLocationPermission) {
        Geolocation.getCurrentPosition(
            (position) => {
                console.log(position);
            },
            (error) => {
                // See error code charts below.
                console.log(error.code, error.message);
            },
            { enableHighAccuracy: true, timeout: 15000, maximumAge: 10000 }
        );
    }
}

  render() {
    return (
      <View style={{ flexGrow: 1, alignItems: 'center', justifyContent: 'center' }}>
        <Text>Latitude: {this.state.latitude}</Text>
        <Text>Longitude: {this.state.longitude}</Text>
        {this.state.error ? <Text>Error: {this.state.error}</Text> : null}
      </View>
    );
  }
}

export default GeolocationExample;

我也对MainActivity.Java文件做了一些修改。下面是我在 MainActivity 的依赖项部分所做的更改。 java

import com.agontuk.RNFusedLocation.RNFusedLocationPackage;
@Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
         // new MainReactPackage()
          new RNFusedLocationPackage()
      );
    }

在使用 getcUrrentposition 时,我的经度和纬度超时,这就是原因,我正在使用解决方法。此解决方法是安装 react-native-geolocation -service。我使用的google播放服务版本是12.2.21。下面是图片:

我还在build.gradle中添加了依赖项。我在 build.gradle

中插入了当前的 google 播放服务版本
  compile(project(':react-native-geolocation-service')) {
    exclude group: 'com.google.android.gms', module: 'play-services-location'
}
compile 'com.google.android.gms:play-services-location:12.2.21'

当我试图获取用户当前位置的经度和纬度时,上面的代码超时。我进行了这些更改,以便我的 android phone 开始显示经度和纬度而不会超时。我不确定这个错误是从哪里来的。错误是没有显示任何行号。

任何帮助将不胜感激

同样的问题,但是当我尝试自动链接时,我在 Android Studio 中收到了一个警告,那个包

com.agontuk.RNFusedLocation

已弃用

所以我认为 react-native-geolocation-service 有问题