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

onPullDownRefresh在react-redux里失效,不引用connect的话就能正常使用 #8129

Closed
GZWZC opened this issue Nov 25, 2020 · 5 comments
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects

Comments

@GZWZC
Copy link

GZWZC commented Nov 25, 2020

相关平台

H5

复现仓库

https://github.com/GZWZC
浏览器版本: 所有
使用框架: React

复现步骤

import React, { Component } from 'react'
import { connect } from 'react-redux'
import Taro from '@tarojs/taro'
import { View} from '@tarojs/components'
import './index.scss'

@connect(() => ({
}), (dispatch) => ({
}))
class Test extends Component {
  constructor(props) {
    super(props);
  }
  onPullDownRefresh(){
    Taro.stopPullDownRefresh()
  }
  componentDidMount(){
    Taro.startPullDownRefresh()
  }
  render() {
    return <View className='test'>
      1212122121
    </View>
  }
}

export default Test

期望结果

即将多了一层组件也能通知到onPullDownRefresh

实际结果

不能执行onPullDownRefresh回调

环境信息

taro info
👽 Taro v3.0.11


  Taro CLI 3.0.11 environment info:
    System:
      OS: macOS 10.15.6
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 12.18.4 - /usr/local/bin/node
      Yarn: 1.22.5 - /usr/local/bin/yarn
      npm: 6.14.8 - /usr/local/bin/npm
    npmPackages:
      @tarojs/cli: ^3.0.11 => 3.0.11 
      @tarojs/components: 3.0.11 => 3.0.11 
      @tarojs/mini-runner: 3.0.11 => 3.0.11 
      @tarojs/react: 3.0.11 => 3.0.11 
      @tarojs/runtime: 3.0.11 => 3.0.11 
      @tarojs/taro: 3.0.11 => 3.0.11 
      @tarojs/webpack-runner: ^3.0.14 => 3.0.14 
      babel-preset-taro: 3.0.11 => 3.0.11 
      eslint-config-taro: 3.0.11 => 3.0.11 
      react: ^16.10.0 => 16.13.1 
      taro-ui: 3.0.0-alpha.3 => 3.0.0-alpha.3 
    npmGlobalPackages:
      typescript: 4.0.3

@taro-bot2 taro-bot2 bot added F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x labels Nov 25, 2020
@GZWZC
Copy link
Author

GZWZC commented Nov 25, 2020

暂时解决方案是自己再写多一个高阶组件来监听onPullDownRefresh回调,然后传回到组件里。

不知道是否有更好的方法

@Chen-jj
Copy link
Contributor

Chen-jj commented Nov 25, 2020

升级到最新版再试试,最近 react redux 有更新过 forwardRef 字段,taro 某个版本更新后兼容过

@GZWZC
Copy link
Author

GZWZC commented Nov 25, 2020

@Chen-jj componentDidShow 和 componentDidHide也遇到这样的问题。

@Chen-jj
Copy link
Contributor

Chen-jj commented Dec 21, 2020

3.0.21 没有复现,升级后再试试吧。

@Chen-jj Chen-jj closed this as completed Dec 21, 2020
@fuersite
Copy link

升级了还是有这个问题

@ZakaryCode ZakaryCode added this to Done in H5 Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Archived in project
H5
  
Done
Development

No branches or pull requests

3 participants