Print Timeline using ref


I’m having issues printing the Timeline component. When trying to use the ‘ref’ attribute of the Timeline component, I get the following react warning:

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

I’m following your print guide where I’m being told to use a useState() for the Timeline’s ref option:

const [inst, setInst] = React.useState(null);
<Eventcalendar modules={MY_MODULES} ref={setInst} />

Using forwardRef() and innerRef() do not work either.

This is when using:

@mobiscroll/react”: “^5.27.1”
@mobiscroll/print”: “^5.27.1”
“react”: “^18.2.0”

Thank you.


Let us know if the issue persists. I could not reproduce the warning, using the versions you’ve mentioned.

Correct, sorry this was my issue where the Eventcalendar component was being wrapped by another component. All working as described, thank you.