Skip to content

Commit 5da9bfb

Browse files
authored
Merge pull request #11 from pettiboy/pull#10
✨ NEW: updateHistoryStack prop
2 parents 9fb07aa + 429c1c4 commit 5da9bfb

File tree

11 files changed

+395
-125
lines changed

11 files changed

+395
-125
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [2.2.0] - 2022-12-29
6+
7+
### Added
8+
9+
- Option to disable the URL getting updated by setting `updateHistoryStack` to `false`.
10+
11+
### Fixed
12+
13+
- Error when using `module` with `gatsby` or `next.js`.
14+
- use `replaceState` instead of `pushState` to avoid polluting history.
15+
516
## [2.1.0] - 2021-11-13
617

718
### Added

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ html {
140140
| `useDataAttribute` | `string` | To customize the string after `data-` | `"to-scrollspy-id"` | no |
141141
| `activeClass` | `string` | To customize the `class` added when the `Element` in view | `"active-scroll-spy"` | no |
142142
| `useBoxMethod` | `boolean` | Set to `false` if you want your spy to be active only if more than `50%` of that `div` is in the viewport | `true` | no |
143+
| `updateHistoryStack` | `boolean` | Set to `false` to disable the URL getting automatically updated when scrolling | `true` | no
143144

144145
##
145146

demo-app/package-lock.json

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"react-dom": "^17.0.2",
1616
"react-router-dom": "^6.0.2",
1717
"react-scripts": "4.0.3",
18-
"react-ui-scrollspy": "file:react-ui-scrollspy-2.0.1.tgz",
18+
"react-ui-scrollspy": "file:react-ui-scrollspy-2.2.0.tgz",
1919
"typescript": "^4.4.4",
2020
"web-vitals": "^1.1.2"
2121
},

dev.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ creates a `.tgz`
1414
```bash
1515
npm run build
1616
npm pack
17-
mv react-ui-scrollspy-2.1.0.tgz ./demo-app
17+
mv react-ui-scrollspy-2.2.0.tgz ./demo-app
1818
cd demo-app
1919
npm uninstall react-ui-scrollspy
20-
npm install react-ui-scrollspy-2.1.0.tgz --production
20+
npm install react-ui-scrollspy-2.2.0.tgz --production
2121
cd ..
2222
```
2323

dist/ScrollSpy/ScrollSpy.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ interface ScrollSpyProps {
1010
useDataAttribute?: string;
1111
activeClass?: string;
1212
useBoxMethod?: boolean;
13+
updateHistoryStack?: boolean;
1314
}
14-
declare const ScrollSpy: ({ children, navContainerRef, parentScrollContainerRef, scrollThrottle, onUpdateCallback, offsetTop, offsetBottom, useDataAttribute, activeClass, useBoxMethod, }: ScrollSpyProps) => JSX.Element;
15+
declare const ScrollSpy: ({ children, navContainerRef, parentScrollContainerRef, scrollThrottle, onUpdateCallback, offsetTop, offsetBottom, useDataAttribute, activeClass, useBoxMethod, updateHistoryStack, }: ScrollSpyProps) => JSX.Element;
1516
export default ScrollSpy;

dist/index.js

Lines changed: 21 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)