ScrollView 无法滚动 控制台报错

面板小程序开发相关产品技术讨论,包括面板小程序、智能小程序、React Native、Ray跨端框架、Panel SDK、微信小程序、小程序开发工具(IDE)及其他开发技术相关等话题


Post Reply
User avatar
angelofan
Posts: 10

环境信息

操作系统:Windows 11 专业版 22H2

Tuya MiniApp Tools 版本信息:v1.5.0 beta 8

App 应用版本信息: 2.17.2

移动设备信息:iPhone 15 - iOS 17.3.1 (与此无关,未在移动设备运行)

相关代码

来源于 涂鸦开发者文档 - Ray开发 - ScrollView - VerticalScroll

Code: Select all

import React from 'react';

import { ScrollView, View } from '@ray-js/components';

function hls() {
  return Math.floor(Math.random() * 55) + 200;
}

function randomColor() {
  return `rgb(${hls()},${hls()},${hls()})`;
}

function onScroll(event: any, type: string) {
  console.log(event, type);
}

function onScrollToLower() {
  console.log('触【底】了');
}

function onScrollToUpper() {
  console.log('触【顶】了');
}

export default function VerticalScroll() {
  return (
    <ScrollView
      style={{ width: '702rpx', height: '667rpx', backgroundColor: '#fff' }}
      scrollY
      scrollTop={100}
      onScroll={event => onScroll(event, 'Y')}
      onScrollToUpper={onScrollToUpper}
      onScrollToLower={onScrollToLower}
      refresherTriggered={false}
    >
      <View style={{ height: '200rpx', backgroundColor: randomColor() }} />
      <View style={{ height: '200rpx', backgroundColor: randomColor() }} />
      <View style={{ height: '200rpx', backgroundColor: randomColor() }} />
      <View style={{ height: '200rpx', backgroundColor: randomColor() }} />
      <View style={{ height: '200rpx', backgroundColor: randomColor() }} />
      <View style={{ height: '200rpx', backgroundColor: randomColor() }} />
      <View style={{ height: '200rpx', backgroundColor: randomColor() }} />
      <View style={{ height: '200rpx', backgroundColor: randomColor() }} />
      <View style={{ height: '200rpx', backgroundColor: randomColor() }} />
      <View style={{ height: '200rpx', backgroundColor: randomColor() }} />
      <View style={{ height: '200rpx', backgroundColor: randomColor() }} />
      <View style={{ height: '200rpx', backgroundColor: randomColor() }} />
    </ScrollView>
  );
}

日志信息

Code: Select all

[View] Uncaught TypeError: Cannot read properties of undefined (reading '5')
    at wQ (view.js?hash=70dcf0787c:2:413773)
    at window.document.addEventListener.passive (view.js?hash=70dcf0787c:2:414070)
    at US (view.js?hash=70dcf0787c:2:411539)
    at view.js?hash=70dcf0787c:2:411096
wQ @ VM191 service.html:2
window.document.addEventListener.passive @ VM191 service.html:2
US @ VM191 service.html:2
(匿名) @ VM191 service.html:2

[View] Uncaught TypeError: Cannot read properties of undefined (reading '5')
    at wQ (view.js?hash=70dcf0787c:2:413773)
    at window.document.addEventListener.passive (view.js?hash=70dcf0787c:2:414565)
    at US (view.js?hash=70dcf0787c:2:411539)
    at view.js?hash=70dcf0787c:2:411096
微信截图_20240401100718.jpg

复现步骤

  1. 打开 Tuya MiniApp Tools
  2. 点击 “新建”
  3. 选择 “面板 SDM 通用模板”
  4. 点击 “创建”,等待编译完成
  5. 在 vscode 中打开项目,在 src\pages\home\index.tsx 页面中将所有代码替换为 相关代码 中的代码
  6. 切换到 Tuya MiniApp Tools,在预览窗格用鼠标拖动滚动区域
  7. 无法滚动,且控制台出现报错

预期结果

复现步骤中的第8步,滚动区域应该纵向滚动,且控制台无报错。

实际结果

复现步骤中的第8步,滚动区域无法纵向滚动,且控制台出现报错。

全屏截图

微信截图_20240401100702.jpg

Tags:
智能小程序开发者
Posts: 137

Re: ScrollView 无法滚动 控制台报错

你好,问题已收到,我们看下

智能小程序开发者
Posts: 137

Re: ScrollView 无法滚动 控制台报错

你好,这个问题是因为在IDE中模拟touch事件导致,不影响真机运行,我们已在2.17.3 版本的基础库修复。该版本基础库正在灰度中。

Post Reply