jitsi / jitsi-meet-react-sdk

React SDK for Jitsi Meet
Apache License 2.0
65 stars 36 forks source link

Object returned by getIFrameRef is not reactive #16

Closed federico-ntr closed 2 years ago

federico-ntr commented 2 years ago

I have a boolean variable which should control some of the styles of Jitsi.

<JitsiMeeting
  domain={content.domain}
  roomName={content.roomName}
  onApiReady={handleApiReady}
  getIFrameRef={(iframeRef) => {
    iframeRef.style.height = "calc(100% - 35px)";
    iframeRef.style.pointerEvents = minimized ? "none" : "unset"
  }}
/>

I expect the style attribute of the iframe to change when the value of minimized changes but it doesn't.

not minimized

minimized

It may be that it's completely impossible to do this thing and I'm missing some fundamental concept of how this works.

saghul commented 2 years ago

Ping @mihhu

saghul commented 2 years ago

I'd say you want to get the ref and update the style when the minimized variable changes. The getIFrameRef will only be called once, when the API object is created.

mihhu commented 2 years ago

Confirming what @saghul said. Please save the getIFrameRef argument into a local ref that you can adjust whenever you need. Here's a tiny demo of how it should work.

federico-ntr commented 2 years ago

I'd say you want to get the ref and update the style when the minimized variable changes. The getIFrameRef will only be called once, when the API object is created.

Yes, I should've known, it was actually pretty obvious.

Confirming what @saghul said. Please save the getIFrameRef argument into a local ref that you can adjust whenever you need. Here's a tiny demo of how it should work.

Really thanks for even providing an example!