小编Tan*_*ker的帖子

没有位置提供者可用,React Native中的权限被拒绝

我有一个需要用户允许该位置的应用程序。我正在测试应用程序的设备对此没有任何问题。但是,每当我使用其他设备时,都会显示以下错误:

在此处输入图片说明

这是我的代码:

 componentDidMount() {
    navigator.geolocation.getCurrentPosition((position) => {
      let lat = parseFloat(position.coords.latitude)
      let long = parseFloat(position.coords.longitude)
      
      let initialRegion = {
        latitude: lat,
        longitude: long,
        latitudeDelta: LATITUDE_DELTA,
        longitudeDelta: LONGITUDE_DELTA
      }

      this.setState({ initialPosition: initialRegion })
      this.setState({ markerPosition: initialRegion })
    },
      (error) => alert(JSON.stringify(error)),
      { enableHighAccuracy: true, timeout: 2000, maximumAge: 3600000 }
    )
  }
Run Code Online (Sandbox Code Playgroud)

我试过了 { enableHighAccuracy: false, timeout: 2000 },但是显示了同样的错误。

reactjs react-native

5
推荐指数
1
解决办法
2986
查看次数

任务 ':react-native-firebase:compileDebugJavaWithJavac' 执行失败

在我的 React Native0.60.4应用程序中,我正在尝试使用react-native-firebase并且我已经完成了所有操作,除非react-native-link最新版本的 React Native 不支持它。当我发出命令时react-native-run-android,它显示了来自react-native-firebase. 我猜这是由于某些版本冲突而发生的。这是长错误:

在此处输入图片说明

这是我的应用程序构建/gradle 文件依赖项:

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+" 
    implementation "com.google.firebase:firebase-core:16.0.9"
    implementation "com.google.firebase:firebase-firestore:19.0.0"
    implementation "com.google.firebase:firebase-messaging:18.0.0"
    // implementation "com.google.firebase:firebase-functions: 17.0.0"
    // implementation "com.google.firebase:firebase-analytics: 16.5.0"
    // implementation " com.google.firebase:firebase-ads:17.2.1"
    // implementation "com.google.android.gms:play-services-measurement-api:16.5.0"
    // implementation "com.google.firebase:firebase-invites:17.0.0"
    // implementation "com.google.firebase:firebase-iid: 18.0.0"
    // implementation "com.google.firebase:firebase-config:17.0.0"
    // implementation "com.google.firebase:firebase-perf:17.0.0"
  
  // Firebase dependencies
    implementation "com.google.android.gms:play-services-base:16.1.0"
    implementation"com.google.android.gms:play-services-gcm:16.1.0"
   
    implementation 'com.android.support:multidex:1.0.3'

    if (enableHermes) {
      def hermesPath = "../../node_modules/hermesvm/android/";
      debugImplementation files(hermesPath + …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-firebase

5
推荐指数
3
解决办法
6742
查看次数