taro showToast会受到hideLoading的影响

mv1qrgav  于 2个月前  发布在  其他
关注(0)|答案(3)|浏览(30)

相关平台

React Native

复现仓库

git@github.com:wuba/taro-playground.git

使用框架: React

复现步骤

点击按钮,出现toast后,toast立即消失
<Button
className="api-page-btn"
type="primary"
onClick={() =>
Taro.showToast({
title: '成功',
icon: 'success',
duration: 2000,
success: () =>
setTimeout(() => {
Taro.hideLoading();
}, 200),
})
}

点击复现

期望结果

调用hideLoading不应该隐藏toast

实际结果

toast会被hideLoading关闭

环境信息

Taro CLI 3.6.1 environment info:
    System:
      OS: macOS 12.6.3
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 16.10.0 - ~/.nvm/versions/node/v16.10.0/bin/node
      Yarn: 1.22.10 - /usr/local/bin/yarn
      npm: 7.24.0 - ~/.nvm/versions/node/v16.10.0/bin/npm
    npmPackages:
      @tarojs/cli: 3.5.11 => 3.5.11 
      @tarojs/components: 3.5.11 => 3.5.11 
      @tarojs/components-rn: 3.5.11 => 3.5.11 
      @tarojs/helper: 3.5.11 => 3.5.11 
      @tarojs/plugin-framework-react: 3.5.11 => 3.5.11 
      @tarojs/plugin-html: 3.5.11 => 3.5.11 
      @tarojs/plugin-mini-ci: 3.5.11 => 3.5.11 
      @tarojs/plugin-platform-alipay: 3.5.11 => 3.5.11 
      @tarojs/plugin-platform-jd: 3.5.11 => 3.5.11 
      @tarojs/plugin-platform-qq: 3.5.11 => 3.5.11 
      @tarojs/plugin-platform-swan: 3.5.11 => 3.5.11 
      @tarojs/plugin-platform-tt: 3.5.11 => 3.5.11 
      @tarojs/plugin-platform-weapp: 3.5.11 => 3.5.11 
      @tarojs/react: 3.5.11 => 3.5.11 
      @tarojs/rn-runner: 3.5.11 => 3.5.11 
      @tarojs/router: 3.5.11 => 3.5.11 
      @tarojs/runtime: 3.5.11 => 3.5.11 
      @tarojs/shared: 3.5.11 => 3.5.11 
      @tarojs/taro: 3.5.11 => 3.5.11 
      @tarojs/taro-h5: 3.5.11 => 3.5.11 
      @tarojs/taro-rn: 3.5.11 => 3.5.11 
      @tarojs/webpack5-runner: 3.5.11 => 3.5.11 
      babel-preset-taro: 3.5.11 => 3.5.11 
      eslint-config-taro: 3.5.11 => 3.5.11 
      expo: ~46.0.1 => 46.0.19 
      react: ^18.0.0 => 18.2.0 
      react-native: ^0.69.7 => 0.69.7

补充信息

微信小程序中,hideLoading不会影响toast

zysjyyx4

zysjyyx41#

https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html
微信小程序文档写了只能同时存在一个,原生是用同一个实现的,所以会互相影响。

1yjd4xko

1yjd4xko2#

微信小程序中,hideLoading不会影响toast

实际这不可能,会相互影响的

px9o7tmv

px9o7tmv3#

微信小程序中,hideLoading不会影响toast

实际这不可能,会相互影响的

微信小程序中,调用showToast后立即调用hideLoading,并不会关闭toast

相关问题