Skip to content

Firefox + standards support for showsScrollIndicator=false #489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions packages/rax-recyclerview/src/VirtualizedList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,14 @@ export default class VirtualizedList extends BaseList {

let showsScrollIndicator = horizontal ? showsHorizontalScrollIndicator : showsVerticalScrollIndicator;

if (!showsScrollIndicator && typeof document !== 'undefined' && !document.getElementById(STYLE_NODE_ID)) {
let styleNode = document.createElement('style');
styleNode.id = STYLE_NODE_ID;
document.head.appendChild(styleNode);
styleNode.innerHTML = `.${this.props.className}::-webkit-scrollbar{display: none;}`;
if (!showsScrollIndicator) {
wrapperStyle.scrollbarWidth = 'none';
if (typeof document !== 'undefined' && !document.getElementById(STYLE_NODE_ID)) {
let styleNode = document.createElement('style');
styleNode.id = STYLE_NODE_ID;
document.head.appendChild(styleNode);
styleNode.innerHTML = `.${this.props.className}::-webkit-scrollbar{display: none;}`;
}
}

// return children when has nested list
Expand Down
22 changes: 12 additions & 10 deletions packages/rax-scrollview/src/web/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,18 @@ const ScrollView: ForwardRefExoticComponent<ScrollViewProps> = forwardRef(
? showsHorizontalScrollIndicator
: showsVerticalScrollIndicator;
{
if (
!showsScrollIndicator &&
typeof document !== 'undefined' &&
typeof document.getElementById === 'function' &&
!document.getElementById(STYLE_NODE_ID)
) {
let styleNode = document.createElement('style');
styleNode.id = STYLE_NODE_ID;
document.head.appendChild(styleNode);
styleNode.innerHTML = `.${baseCls}::-webkit-scrollbar{display: none;}`;
if (!showsScrollIndicator) {
scrollerStyle.scrollbarWidth = 'none';
if (
typeof document !== 'undefined' &&
typeof document.getElementById === 'function' &&
!document.getElementById(STYLE_NODE_ID)
) {
let styleNode = document.createElement('style');
styleNode.id = STYLE_NODE_ID;
document.head.appendChild(styleNode);
styleNode.innerHTML = `.${baseCls}::-webkit-scrollbar{display: none;}`;
}
}

scrollerStyle.WebkitOverflowScrolling = 'touch';
Expand Down