diff --git a/.eslintrc.yml b/.eslintrc.yml index 7a04aec..d80c8c8 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -5,6 +5,9 @@ parserOptions: ecmaVersion: 12 sourceType: module +env: + es6: true + plugins: - prettier diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dbd656..b53a041 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Changed + +- Added `styleOptions.stylesRoot` property which allows to specify a container node component styles will be placed into, by [@OEvgeny](https://github.com/OEvgeny) in PR [#137](https://github.com/compulim/react-scroll-to-bottom/pull/137) + ## [4.2.0] - 2021-10-14 ### Changed diff --git a/README.md b/README.md index 8d60e69..80220cf 100644 --- a/README.md +++ b/README.md @@ -62,18 +62,19 @@ export default props => ( ## Props -| Name | Type | Default | Description | -| ----------------------- | ---------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -| `checkInterval` | `number` | 150 | Recurring interval of stickiness check, in milliseconds (minimum is 17 ms) | -| `className` | `string` | | Set the class name for the root element | -| `debounce` | `number` | `17` | Set the debounce for tracking the `onScroll` event | -| `debug` | `bool` | `NODE_ENV === 'development'` | Show debug information in console | -| `followButtonClassName` | `string` | | Set the class name for the follow button | -| `initialScrollBehavior` | `string` | `smooth` | Set the initial scroll behavior, either `"auto"` (discrete scrolling) or `"smooth"` | -| `mode` | `string` | `"bottom"` | Set it to `"bottom"` for scroll-to-bottom, `"top"` for scroll-to-top | -| `nonce` | `string` | | Set the nonce for [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) | -| `scroller` | `function` | `() => Infinity` | A function to determine how far should scroll when scroll is needed | -| `scrollViewClassName` | `string` | | Set the class name for the container element that house all `props.children` | +| Name | Type | Default | Description | +| ------------------------- | ---------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| `checkInterval` | `number` | 150 | Recurring interval of stickiness check, in milliseconds (minimum is 17 ms) | +| `className` | `string` | | Set the class name for the root element | +| `debounce` | `number` | `17` | Set the debounce for tracking the `onScroll` event | +| `debug` | `bool` | `NODE_ENV === 'development'` | Show debug information in console | +| `followButtonClassName` | `string` | | Set the class name for the follow button | +| `initialScrollBehavior` | `string` | `smooth` | Set the initial scroll behavior, either `"auto"` (discrete scrolling) or `"smooth"` | +| `mode` | `string` | `"bottom"` | Set it to `"bottom"` for scroll-to-bottom, `"top"` for scroll-to-top | +| `nonce` | `string` | | Set the nonce for [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) | +| `scroller` | `function` | `() => Infinity` | A function to determine how far should scroll when scroll is needed | +| `scrollViewClassName` | `string` | | Set the class name for the container element that house all `props.children` | +| `styleOptions.stylesRoot` | `Node` | `undefined` | Set the container node for component styles to be placed into. When set to `undefined`, will use `document.head` | ## Hooks diff --git a/__tests__/should-respect-container-change.html b/__tests__/should-respect-container-change.html new file mode 100644 index 0000000..4133053 --- /dev/null +++ b/__tests__/should-respect-container-change.html @@ -0,0 +1,72 @@ + + +
+