You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
app.js? [sm]:250 TypeError: Illegal invocation
at cancelTimeout (taro.js? [sm]:1629)
at List._this._resetIsScrollingDebounced (taro.js? [sm]:1180)
at qd (app.js? [sm]:170)
at Lf (app.js? [sm]:256)
at hh (app.js? [sm]:294)
at exports.unstable_runWithPriority (app.js? [sm]:370)
at Pc (app.js? [sm]:158)
at Zg (app.js? [sm]:291)
at Og (app.js? [sm]:282)
at app.js? [sm]:159(env: macOS,mp,1.05.2105170; lib: 2.17.0)
相关平台
微信小程序
小程序基础库: 2.17.0
使用框架: React
复现步骤
interface IProps {
/** 组件 ID /
id: string;
/* 组件渲染的数据 /
data: any;
/* 组件渲染数据的索引 /
index: number;
/* 组件是否正在滚动,当 useIsScrolling 值为 true 时返回布尔值,否则返回 undefined */
isScrolling?: boolean;
style?: any;
}
// { id, index, style, data }
const HouseTypeCard: React.FC = (props) => {
return (
<View
className={classNames(
'house-type-card',
props.index % 2 ? 'ListItemOdd' : 'ListItemEven'
)}
id={props.id}
style={props.style}
>
1111
);
};
function buildData (offset = 0) {
return Array(100).fill(0).map((_, i) => i offset);
}
class ListType extends Component {
state = {
data: buildData(0),
vlistHeight: 0
}
async componentDidMount() {
let listHeight = await this.getListHeight();
this.setState({
vlistHeight: listHeight
})
}
async getListHeight():Promise {
return new Promise((resolve) => {
// const query = Taro.createSelectorQuery();
// query.select('#house-type-list').boundingClientRect(rec => {
// console.log(rec, '111');
// }).exec();
let windowHeight = Taro.getSystemInfoSync().windowHeight;
let screenHeight = Taro.getSystemInfoSync().screenHeight;
let safeAreaHeight = Taro.getSystemInfoSync().safeArea.height;
let liuhai = Taro.getSystemInfoSync().safeArea.top;
// 默认底部横线 = 0
let bottomLine = 0;
//如果屏幕高度-顶部流海 大于 安全高度,说明底部有横线需要减
if (screenHeight - liuhai > safeAreaHeight) {
bottomLine = screenHeight - liuhai - safeAreaHeight;
}
resolve(windowHeight - bottomLine - 50 - 106);
});
}
render() {
const { data, vlistHeight } = this.state
return (
{HouseTypeCard}
)
}
}
期望结果
正常运行
实际结果
app.js? [sm]:250 TypeError: Illegal invocation
at cancelTimeout (taro.js? [sm]:1629)
at List._this._resetIsScrollingDebounced (taro.js? [sm]:1180)
at qd (app.js? [sm]:170)
at Lf (app.js? [sm]:256)
at hh (app.js? [sm]:294)
at exports.unstable_runWithPriority (app.js? [sm]:370)
at Pc (app.js? [sm]:158)
at Zg (app.js? [sm]:291)
at Og (app.js? [sm]:282)
at app.js? [sm]:159(env: macOS,mp,1.05.2105170; lib: 2.17.0)
环境信息
补充信息
无
The text was updated successfully, but these errors were encountered: