Skip to content

Commit 14dcc67

Browse files
committed
Use React.forwardRef in Page and Outline components
1 parent e6ae4d2 commit 14dcc67

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Outline.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,12 @@ OutlineInternal.propTypes = {
176176
...eventsProps(),
177177
};
178178

179-
export default function Outline(props) {
179+
function Outline(props, ref) {
180180
return (
181181
<DocumentContext.Consumer>
182-
{context => <OutlineInternal {...context} {...props} />}
182+
{context => <OutlineInternal ref={ref} {...context} {...props} />}
183183
</DocumentContext.Consumer>
184184
);
185185
}
186+
187+
export default React.forwardRef(Outline);

src/Page.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,11 +444,12 @@ PageInternal.propTypes = {
444444
...eventsProps(),
445445
};
446446

447-
export default function Page(props) {
447+
function Page(props, ref) {
448448
return (
449449
<DocumentContext.Consumer>
450450
{context => (
451451
<PageInternal
452+
ref={ref}
452453
{...context}
453454
{...props}
454455
// For backwards compatibility
@@ -462,3 +463,5 @@ export default function Page(props) {
462463
</DocumentContext.Consumer>
463464
);
464465
}
466+
467+
export default React.forwardRef(Page);

0 commit comments

Comments
 (0)