Skip to content

Commit a0a610b

Browse files
committed
Added support for safari.
1 parent a429926 commit a0a610b

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-virtualized-sticky-tree",
33
"description": "A React component for efficiently rendering tree like structures with support for position: sticky",
4-
"version": "2.0.15",
4+
"version": "2.0.16",
55
"author": "Marc McIntyre <[email protected]>",
66
"license": "MIT",
77
"main": "dist/commonjs/index.js",

src/StickyTree.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3+
import vendorSticky from './vendorSticky';
34

45
export default class StickyTree extends React.PureComponent {
56

@@ -450,7 +451,7 @@ export default class StickyTree extends React.PureComponent {
450451
getClientNodeStyle(node) {
451452
const style = { height: node.height };
452453
if (node.isSticky) {
453-
style.position = 'sticky';
454+
style.position = vendorSticky();
454455
style.top = node.stickyTop;
455456
style.zIndex = node.zIndex;
456457
}

src/vendorSticky.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default () => {
2+
if (/Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor)) {
3+
return '-webkit-sticky';
4+
}
5+
6+
return 'sticky';
7+
}

0 commit comments

Comments
 (0)