fix(PaginationNav): add forwardRef
MODIFY
packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
@@ -4138,6 +4138,7 @@ Map {
},
},
"PaginationNav" => Object {
+ "$$typeof": Symbol(react.forward_ref),
"propTypes": Object {
"className": Object {
"type": "string",
@@ -4161,6 +4162,7 @@ Map {
"type": "func",
},
},
+ "render": [Function],
},
"PrimaryButton" => Object {},
"ProgressIndicator" => Object {

MODIFY
packages/react/src/components/PaginationNav/PaginationNav.js
packages/react/src/components/PaginationNav/PaginationNav.js
@@ -172,7 +172,8 @@ function PaginationOverflow({
return null;
}
-export default function PaginationNav({
+const PaginationNav = React.forwardRef(function PaginationNav(
+ {
className,
onChange = () => {},
totalItems,
@@ -181,7 +182,9 @@ export default function PaginationNav({
loop = false,
translateWithId: t = translateWithId,
...rest
-}) {
+ },
+ ref
+) {
const [currentPage, setCurrentPage] = useState(page);
const [itemsThatFit, setItemsThatFit] = useState(
itemsShown >= 4 ? itemsShown : 4
@@ -266,7 +269,7 @@ export default function PaginationNav({
const startOffset = itemsThatFit <= 4 && currentPage > 1 ? 0 : 1;
return (
- <nav className={classNames} {...rest} aria-label="pagination">
+ <nav className={classNames} ref={ref} {...rest} aria-label="pagination">
<ul className={`${prefix}--pagination-nav__list`}>
<DirectionButton
direction="backward"
@@ -353,7 +356,7 @@ export default function PaginationNav({
</div>
</nav>
);
-}
+});
DirectionButton.propTypes = {
/**
@@ -460,3 +463,5 @@ PaginationNav.propTypes = {
*/
translateWithId: PropTypes.func,
};
+
+export default PaginationNav;

fix(PaginationNav): add forwardRef (#6647)

Co-authored-by: TJ Egan <tw15egan@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>