usePullDownRefresh 下拉刷新无法获取组件最新传值



  • const A = ({ query}) => {
      usePullDownRefresh(()=>{
        console.log(query)  //始终是{current:0}
      })
        console.log(query)  //会根据传值而改变
      return (
        <View>
        </View>
      )
    }
    

    页面内使用

    export default () => {
      const [current, setCurrent] = useState(0)
      const handleSelect = (temp) => {
        setCurrent(temp)
      }
    
      return (
        <View className='page'>
          <AtSegmentedControl
            values={['a', 'b']}
            onClick={handleSelect}
            current={current}
            fontSize={40}
          />
          <View className='doc-body'>
            <A query={{current} visibleStatus />
          </View>
        </View>
      )
    }
    

    下拉结果始终是{current:0}


登录后回复