fix(scrollbar): hide horizontal scrollbar and fix bottom content clipping - #611
Merged
pengfeixx merged 1 commit intoApr 28, 2026
Merged
Conversation
pengfeixx
force-pushed
the
fix/hide-horizontal-scrollbar
branch
from
April 28, 2026 06:17
80994c0 to
46ab367
Compare
lzwind
approved these changes
Apr 28, 2026
…ping Add renderView to disable horizontal overflow and remove negative marginBottom from react-custom-scrollbars that was clipping the last line of content in both nav and article areas. 添加 renderView 隐藏水平滚动条,移除 react-custom-scrollbars 的负 marginBottom, 修复左侧大纲和右侧内容区域最后一行被裁剪的问题。 Log: 修复水平滚动条和底部内容裁剪问题 PMS: BUG-342675 Influence: 隐藏水平滚动条,修复导航栏和内容区最后一行文本被遮挡一半的问题。
pengfeixx
force-pushed
the
fix/hide-horizontal-scrollbar
branch
from
April 28, 2026 06:24
46ab367 to
1e0178d
Compare
deepin pr auto review这段代码是一个 React 组件的修改,主要涉及自定义滚动条的实现。以下是对这段代码的审查意见,包括语法逻辑、代码质量、代码性能和代码安全方面: 1. 语法逻辑优点:
改进建议:
2. 代码质量优点:
改进建议:
3. 代码性能优点:
改进建议:
4. 代码安全优点:
改进建议:
5. 其他建议
修改后的代码示例// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
import React from 'react';
import PropTypes from 'prop-types';
import { Scrollbars } from 'react-custom-scrollbars';
const viewStyle = { overflowX: 'hidden', marginBottom: 0 };
function renderTrackHorizontal(props) {
return (
<div {...props} className="scrollbar-track-horizontal" />
);
}
function renderView(props) {
return (
<div {...props} style={{ ...props.style, ...viewStyle }} />
);
}
/**
* 自定义滚动条组件
* @param {Object} props - 组件属性
* @returns {JSX.Element} 滚动条组件
*/
function Scrollbar(props) {
return (
<Scrollbars
{...props}
className="scrollbar"
autoHide
renderTrackHorizontal={renderTrackHorizontal}
renderView={renderView}
autoHideTimeout={800}
>
{props.children}
</Scrollbars>
);
}
Scrollbar.propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string,
autoHide: PropTypes.bool,
autoHideTimeout: PropTypes.number,
};
export default React.memo(Scrollbar);总结这段代码整体质量不错,但可以通过以下方式进一步优化:
|
lzwind
approved these changes
Apr 28, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, pengfeixx The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
Author
|
/merge |
Contributor
|
This pr cannot be merged! (status: unstable) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add renderView to disable horizontal overflow and remove negative marginBottom from react-custom-scrollbars that was clipping the last line of content in both nav and article areas.
添加 renderView 隐藏水平滚动条,移除 react-custom-scrollbars 的负 marginBottom, 修复左侧大纲和右侧内容区域最后一行被裁剪的问题。
Log: 修复水平滚动条和底部内容裁剪问题
PMS: BUG-342675
Influence: 隐藏水平滚动条,修复导航栏和内容区最后一行文本被遮挡一半的问题。