We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
没有实现 wx.offAccelerometerChange(对应 Taro.offAccelerometerChange),在 @tarojs/taro/types/device/accelerometer.d.ts 中有相应的类型,然后我尝试在 @tarojs/taro/src/native-apis.js 中的 onAndSyncApis 加上 offAccelerometerChange: true 后仍然报错。
wx.offAccelerometerChange
Taro.offAccelerometerChange
onAndSyncApis
offAccelerometerChange: true
/** * 这段注释后可以贴代码 * 提供完整可复现的代码和整理好代码格式,有助于我们快速定位问题,节省你我时间 * 代码提供不全或代码格式混乱的 issues 【有可能会被忽略】 * * 查看如何插入代码:https://coding.net/help/doc/project/markdown.html#i-5 */ // 摇一摇然后随机抽取对应餐厅或饮品店的功能 const Rock: Taro.FC = () => { const [active, setActive] = useState<'food' | 'drink' | null>(null) const [dialog, setDialog] = useState<{ isShow: boolean, shop: Shop }>(initialDialogState) useEffect(() => { const cb: Taro.onAccelerometerChange.Callback = (res) => { if (dialog.isShow) return if (active === null) return if (Math.abs(res.x) > .7) { setDialog({ isShow: true, shop: getRandom(active!) }) } } Taro.onAccelerometerChange(cb) return () => { Taro.offAccelerometerChange(cb) } }, [active, dialog.isShow]) return (/* jsx... */) }
useEffect 的 cleanup 函数能执行,并把 Taro.onAccelerometerChange 的监听取消
👽 Taro v2.0.2
Taro CLI 2.0.2 environment info: System: OS: macOS 10.15.2 Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.13.0 - ~/.nvm/versions/node/v12.13.0/bin/node Yarn: 1.21.1 - ~/.yarn/bin/yarn npm: 6.13.6 - ~/.nvm/versions/node/v12.13.0/bin/npm npmPackages: @tarojs/components: 2.0.2 => 2.0.2 @tarojs/components-qa: 2.0.2 => 2.0.2 @tarojs/mini-runner: 2.0.2 => 2.0.2 @tarojs/redux: 2.0.2 => 2.0.2 @tarojs/redux-h5: 2.0.2 => 2.0.2 @tarojs/router: 2.0.2 => 2.0.2 @tarojs/taro: 2.0.2 => 2.0.2 @tarojs/taro-alipay: 2.0.2 => 2.0.2 @tarojs/taro-h5: 2.0.2 => 2.0.2 @tarojs/taro-qq: 2.0.2 => 2.0.2 @tarojs/taro-quickapp: 2.0.2 => 2.0.2 @tarojs/taro-swan: 2.0.2 => 2.0.2 @tarojs/taro-tt: 2.0.2 => 2.0.2 @tarojs/taro-weapp: 2.0.2 => 2.0.2 @tarojs/webpack-runner: 2.0.2 => 2.0.2 eslint-config-taro: 2.0.2 => 2.0.2 eslint-plugin-taro: 2.0.2 => 2.0.2 nerv-devtools: ^1.5.6 => 1.5.6 nervjs: ^1.5.6 => 1.5.6 stylelint-config-taro-rn: 2.0.2 => 2.0.2 stylelint-taro-rn: 2.0.2 => 2.0.2
如果您有功能上的建议,可以提到 FeatHub 使用上的问题,欢迎在「Taro 社区」一起交流
如果您有功能上的建议,可以提到 FeatHub
使用上的问题,欢迎在「Taro 社区」一起交流
The text was updated successfully, but these errors were encountered:
CC @Chen-jj
Sorry, something went wrong.
欢迎提交 Issue~
如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏
如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。
Good luck and happy coding~
API 说明
而对于微信小程序中没有,而某些小程序平台特有的 API,可以先尝试用 Taro. + API 名称来进行调用,如果出现未定义,则使用对应小程序平台的命名空间(如 my、swan、tt 等)来进行调用,并反馈给我们。
先直接使用 wx.offAccelerometerChange 调用吧
f0c1e39
Chen-jj
No branches or pull requests
问题描述
没有实现
wx.offAccelerometerChange
(对应Taro.offAccelerometerChange
),在 @tarojs/taro/types/device/accelerometer.d.ts 中有相应的类型,然后我尝试在 @tarojs/taro/src/native-apis.js 中的onAndSyncApis
加上offAccelerometerChange: true
后仍然报错。复现步骤
onAndSyncApis
加上offAccelerometerChange: true
属性期望行为
useEffect 的 cleanup 函数能执行,并把 Taro.onAccelerometerChange 的监听取消
报错信息
系统信息
👽 Taro v2.0.2
Taro CLI 2.0.2 environment info:
System:
OS: macOS 10.15.2
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.13.0 - ~/.nvm/versions/node/v12.13.0/bin/node
Yarn: 1.21.1 - ~/.yarn/bin/yarn
npm: 6.13.6 - ~/.nvm/versions/node/v12.13.0/bin/npm
npmPackages:
@tarojs/components: 2.0.2 => 2.0.2
@tarojs/components-qa: 2.0.2 => 2.0.2
@tarojs/mini-runner: 2.0.2 => 2.0.2
@tarojs/redux: 2.0.2 => 2.0.2
@tarojs/redux-h5: 2.0.2 => 2.0.2
@tarojs/router: 2.0.2 => 2.0.2
@tarojs/taro: 2.0.2 => 2.0.2
@tarojs/taro-alipay: 2.0.2 => 2.0.2
@tarojs/taro-h5: 2.0.2 => 2.0.2
@tarojs/taro-qq: 2.0.2 => 2.0.2
@tarojs/taro-quickapp: 2.0.2 => 2.0.2
@tarojs/taro-swan: 2.0.2 => 2.0.2
@tarojs/taro-tt: 2.0.2 => 2.0.2
@tarojs/taro-weapp: 2.0.2 => 2.0.2
@tarojs/webpack-runner: 2.0.2 => 2.0.2
eslint-config-taro: 2.0.2 => 2.0.2
eslint-plugin-taro: 2.0.2 => 2.0.2
nerv-devtools: ^1.5.6 => 1.5.6
nervjs: ^1.5.6 => 1.5.6
stylelint-config-taro-rn: 2.0.2 => 2.0.2
stylelint-taro-rn: 2.0.2 => 2.0.2
补充信息
The text was updated successfully, but these errors were encountered: