Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taro 不支持陀螺仪 startGyroscope #8496

Closed
vanswang opened this issue Jan 10, 2021 · 0 comments · Fixed by #8497
Closed

Taro 不支持陀螺仪 startGyroscope #8496

vanswang opened this issue Jan 10, 2021 · 0 comments · Fixed by #8497
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Milestone

Comments

@vanswang
Copy link

相关平台

微信小程序

复现仓库

https://github.com/github177/taroTest
小程序基础库: 2.14.3
使用框架: React

复现步骤

  1. 下载代码之后 npm i 然后运行 npm run dev:weapp

  2. 在微信开发者工具中打开

期望结果

打开之后支持调用 startGyroscope 监听陀螺仪

实际结果

代码做了判断,不做判断的话会报错 Taro.startGyroscope is not a function. 因此无法调用陀螺仪。

环境信息

👽 Taro v3.0.23


  Taro CLI 3.0.23 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.15.3 - C:\Program Files\nodejs\node.EXE
      npm: 6.14.9 - C:\Program Files\nodejs\npm.CMD

补充信息

我找到了原因所在,以及解决办法,如下:

在 node_modules@tarojs\api\dist\index.esm.js 这个文件里面添加如下代码即可解决此问题:

  1. noPromiseApis 这个对象中添加:

startGyroscope: true,
stopGyroscope: true,

  1. onAndSyncApis 这个对象添加:

onGyroscopeChange: true,

希望官方能尽早修复此问题,感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants