javascript - react native : Can't find variable: Actions

标签 javascript react-native

我已经使用 react-native-background-geolocation 插件进行后台 gps 跟踪,但我经常收到此错误“找不到变量:操作”

虽然我得到了正确的位置对象

我使用了下面的代码

BackgroundGeolocation.on('location', (location) => {
      //handle your locations here 
      console.log(JSON.stringify(location));
      Actions.sendLocation(location);
    });

如果有人曾经遇到过这个问题或知道如何解决,那对我会很有帮助!!

最佳答案

Actions 是一个包的一部分,所以你必须导入它 例如

import { Actions } from 'react-native-router-flux';

关于javascript - react native : Can't find variable: Actions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41119388/

相关文章:

javascript - 当用户单击它时,如何阻止输入边框颜色发生变化

javascript - 如何将 Prop 从父级传递给子级再到子级的子级?

javascript - 无法将图片上传到 Firebase

javascript - 使用 eclipse 在 angularjs 中运行 Linux/windows 命令

javascript - Vue.js 无法使用模板正确渲染

javascript - 如何获取鼠标在 HTML 页面中的点击位置

javascript - 引用错误 : youtubeBgVideoStyle is not defined

android - 在 Expo : Asyncstorage gets cleared when app refreshes 中 react 原生

react-native - 安装 Expo CLI 的无限循环

reactjs - 如果我有catch(),我是否需要在promise链的末尾调用done()?