Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble using both ref and onIframeAdded #100

Open
RapidOwl opened this issue Dec 13, 2023 · 0 comments
Open

Trouble using both ref and onIframeAdded #100

RapidOwl opened this issue Dec 13, 2023 · 0 comments
Assignees
Labels
bug Something isn't working triage

Comments

@RapidOwl
Copy link

Describe the bug

  • ref never seems to get populated.
  • onIFrameAdded doesn't seem to get called.

I'm relatively inexperienced with React and this is my first attempt at using ref so it's entirely possible this is my fault.

To Reproduce

Here's my code extracted for readability:

const videoRef = useRef<HTMLIFrameElement>(null);

useEffect(() => {
  if (videoRef.current) {
    console.log("videoRef.current is present");
  }
}, []);

<LiteYouTubeEmbed
  id={post.content.youtubeId}
  title={post.content.title}
  onIframeAdded={() => console.log("onIframeAdded")}
  ref={videoRef}
/>

Expected behavior

I would expect the console to contain logs showing "videoRef.current is present" and "onIframeAdded".

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • Version: 120

Additional context

I'm trying to add react-lite-youtube-embed to a Next.js app (v14). We have a number of event handlers we need to attach to the YouTube iframe and I was expecting to do that inside an effect.

@ibrahimcesar ibrahimcesar added bug Something isn't working triage labels Jan 11, 2024
@ibrahimcesar ibrahimcesar self-assigned this Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants