Closed SickanK closed 1 month ago
I was able to replicate this issue.. It's a race condition.. Not really much I can do however :/
The issue is that the sheet presented with the initial 0
height. But when the content size changed, the sheet didn't finished presenting yet so it didn't update the content.
I will leave it to the developer to handle this case. You can either:
.present()
).onPresent
event. The sheet will automatically resize gracefully.Thanks for testing it though!
Just a thought... if your content changes sizes dynamically everytime, try to avoid auto
size and just use ['medium', 'large']
.
When it comes to auto resizing, the sheet needs the content height "before" it presents so there's a lot of work there to get the correct size.
How hard would it be to add support for dynamically changing the sizes array? So e.g. for state A I'd set sizes to ["30%"] and for state B I'd change it to ["60%"]. That'd probably be optimal for my use case as I need precise height which I can calculate beforehand.
You can do that... the flow is similar though, the sheet has to be hidden or shown first before you do anything on the sizes
Thanks for the response!
Unfortunately, I've encountered difficulties using the onPresent method for resizing the sheet as suggested. Neither medium/large
options nor using auto
and updating the content have worked for me. I've updated the reproduction repository to reflect my current implementation. I might be missing something obvious here, but I'd really appreciate if you could take a quick look when you get a chance.
Description The TrueSheet component doesn't consistently auto-resize when changing its internal content height and immediately presenting it. The sheet sometimes fails to adjust to the correct height when switching between different content heights.
Steps to Reproduce
Reproduction Repository A minimal reproduction of this issue can be found at: https://github.com/SickanK/react-native-true-sheet-resize
Environment
Additional Notes
Please let me know if there is a work-around to this. Another solution is to be able to manually run a resize update method. It would allow for using react-native-reanimated for updating the internal content height on the ui thread.