I'm currently experiencing a problem with React's LiveChat widget, I hope someone can shed some light and possibly suggest a fix.
Our app currently runs in a native web view, which allows us to use React (HTML, JS and CSS) as a frontend for our native app.
When running the web view, iOS exposes CSS env() variables like safe-area-inset-top
, which is a non-zero value in case the phone has a notch. This variable is used to define a safe area so that content isn't rendered behind the notch.
This works pretty well except when we open the LiveChat widget, which seemingly sets all the values to 0.
How the App usually looks:
![Screenshot 2022-05-10 at 14 18 11](https://user-images.githubusercontent.com/23533178/167637590-da870317-25eb-4f3c-beb6-e6c81932c290.png)
How the chat looks when the LiveChat component is open:
![Screenshot 2022-05-10 at 14 22 23](https://user-images.githubusercontent.com/23533178/167638451-d40b63df-5bc4-448f-9ac7-57344093e1bd.png)
You can see the minimise button is being rendered behind the notch. And if I increase the padding of the iframe rendering he chat, I can take a peek behind to reveal the CSS variables setting the safe areas have been reset:
![Screenshot 2022-05-10 at 14 23 58](https://user-images.githubusercontent.com/23533178/167638751-9f3cc3df-5d2a-40a0-92cc-7c89df6248cf.png)
If I go look at my inspector, I can tell that --safe-area-inset-top
(which I previously assigned to env(safe-area-inset-top)
has been set to 0.
The strange thing is that before opening LiveChat, I can see that #chat-widget-container
actually has a non-zero value assigned to the variable, which is then set to 0 the moment I click on the button to open LiveChat.
Our implementation is pretty standard:
<LiveChatWidget
license={liveChatLicense}
visibility={visibility}
customerEmail={user.data?.data.email}
customerName={user.data?.data.firstName}
/>
Any idea how we can work around this issue?