Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/osm/react-scroll into osm…
Browse files Browse the repository at this point in the history
…-master
  • Loading branch information
fisshy committed Dec 12, 2022
2 parents 989d440 + 03a53bb commit 4061867
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ activeClass
</tr>
<tr>
<td>
activeStyle
</td>
<td>
style applied when element is reached
</td>
</tr>
<tr>
<td>
to
</td>
<td>
Expand Down
11 changes: 10 additions & 1 deletion modules/mixins/scroll-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const protoTypes = {
containerId: PropTypes.string,
container: PropTypes.object,
activeClass: PropTypes.string,
activeStyle: PropTypes.object,
spy: PropTypes.bool,
horizontal: PropTypes.bool,
smooth: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
Expand Down Expand Up @@ -207,6 +208,14 @@ export default (Component, customScroller) => {
className = this.props.className;
}

var style = {};

if (this.state && this.state.active) {
style = Object.assign({}, this.props.style, this.props.activeStyle);
} else {
style = Object.assign({}, this.props.style);
}

let props = Object.assign({}, this.props);

for (var prop in protoTypes) {
Expand All @@ -216,9 +225,9 @@ export default (Component, customScroller) => {
}

props.className = className;
props.style = style;
props.onClick = this.handleClick;


return React.createElement(Component, props);
}
};
Expand Down

0 comments on commit 4061867

Please sign in to comment.