NervJS / taro-ui

一款基于 Taro 框架开发的多端 UI 组件库
https://taro-ui.taro.zone
MIT License
4.49k stars 753 forks source link

AtIndexes飞书小程序兼容性问题 #1029

Open lzs2000131 opened 4 years ago

lzs2000131 commented 4 years ago

Taro UI 版本信息

2.3.1

问题描述

Taro编译成飞书小程序的时候有时候组件的变量获取不到,现在AtIndexes组件ScrollView里面的scrollTop={isWEB ? _scrollTop : undefined} scrollIntoView={!isWEB ? _scrollIntoView : ''}两个变量都获取不到,导致编译成飞书小程序的索引无法滑动,滑动后立即跳转到顶部

复现步骤

引入索引,编译成飞书小程序运行

复现代码

import { View } from '@tarojs/components'
import Taro from '@tarojs/taro'
import { AtIndexes } from 'taro-ui'

function Index() {

  const list = [{
    title: 'A',
    key: 'A',
    items: [
      {
        'name': '阿坝'
      },
      {
        'name': '阿拉善'
      }]
  },
  {
    title: 'B',
    key: 'B',
    items: [
      {
        'name': '北京'
      },
      {
        'name': '保定'
      },
    ]
  }
  ]

  return (
    <View style='height:100vh'>
      <AtIndexes
        list={list}
      >
        <View>自定义内容</View>
      </AtIndexes>
    </View>

  )
}

export default Index

报错信息

列表超出屏幕时无法正常滚动

系统信息

👽 Taro v2.0.7

Taro CLI 2.0.7 environment info: System: OS: macOS 10.15.3 Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.4.0 - /usr/local/bin/node Yarn: 1.21.0 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm npmPackages: @tarojs/components: 2.0.7 => 2.0.7 @tarojs/components-rn: 2.0.7 => 2.0.7 @tarojs/mini-runner: 2.0.7 => 2.0.7 @tarojs/plugin-babel: 2.0.7 => 2.0.7 @tarojs/plugin-csso: 2.0.7 => 2.0.7 @tarojs/plugin-sass: 2.0.7 => 2.0.7 @tarojs/plugin-uglifyjs: 2.0.7 => 2.0.7 @tarojs/router: 2.0.7 => 2.0.7 @tarojs/taro: 2.0.7 => 2.0.7 @tarojs/taro-alipay: 2.0.7 => 2.0.7 @tarojs/taro-h5: 2.0.7 => 2.0.7 @tarojs/taro-qq: 2.0.7 => 2.0.7 @tarojs/taro-quickapp: 2.0.7 => 2.0.7 @tarojs/taro-redux-rn: 2.0.7 => 2.0.7 @tarojs/taro-rn: 2.0.7 => 2.0.7 @tarojs/taro-router-rn: 2.0.7 => 2.0.7 @tarojs/taro-swan: 2.0.7 => 2.0.7 @tarojs/taro-tt: 2.0.7 => 2.0.7 @tarojs/taro-weapp: 2.0.7 => 2.0.7 @tarojs/webpack-runner: 2.0.7 => 2.0.7 eslint-config-taro: 2.0.7 => 2.0.7 eslint-plugin-taro: 2.0.7 => 2.0.7 nerv-devtools: ^1.5.6 => 1.5.6 nervjs: ^1.5.6 => 1.5.6 react: 16.3.1 => 16.3.1 react-native: 0.55.4 => 0.55.4 stylelint-config-taro-rn: 2.0.7 => 2.0.7 stylelint-taro-rn: 2.0.7 => 2.0.7 npmGlobalPackages: typescript: 3.6.4

补充信息

只要把!isWEB ? _scrollIntoView : ''等变量在return之前先赋给另一个变量,ScrollView就能从另一个变量获取到值了

taro-ui-bot[bot] commented 4 years ago

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~