oblador / react-native-collapsible

Animated collapsible component for React Native, good for accordions, toggles etc
MIT License
2.46k stars 452 forks source link

Webview inside collapsible acts weirdly #438

Closed benazir46 closed 2 years ago

benazir46 commented 2 years ago

I use a webview to load html, css and javascript content inside collapsible. The issue is, if the height of the webview changes and the collapsible's collapse state is false, the webview's height becomes zero. I have attached the source code and a video.

In my app, JS changes the webview height, but for simplicity I used a button to change the height manually here. A fix or a workaround would be greatly appreciated.

collapsible.zip

https://user-images.githubusercontent.com/21985993/171036593-671332e9-6904-425f-ab52-dfff48794ece.mp4

benazir46 commented 2 years ago

I got a solution: there is a containerStyle property in the react-native-webview. By setting flex: 0, position: 'relative', height: webviewHeight', the height never gets zero. I was confused because if I set the collapse state to false by default, I didn't have the issue. Anyways, I'm closing this.