React Native Modal Component not visible randomly in iOS (workaround solution provided) #29353
Labels
Component: Modal
Needs: Triage 🔍
Platform: iOS
iOS applications.
Stale
There has been a lack of activity on this issue and it may be closed soon.
Description
In some difficult-to-reproduce circumstances, setting the
visible
prop of a Modal does not cause the Modal to become visible. This has been reported as an issue multiple times over the past two years, but each time Facebook are closing them without any resolution. I have yet to come across a published workaround. I appreciate this one will likely be closed too, but I wanted to share a workaround for other developers banging their heads against the keyboard first :)These two are exactly the same issue:
#19345
#20394
React Native version:
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
if
this.props.visibilityStatus==true
when the parent component mounts, this modal will not be visible on iOS (sometimes), but on a reload, it will then become visible.WORKAROUND
As stupid as this seems, this is fixed by replacing the bool with a function that returns the bool. For example:
et voila! Now the Modal will always be visible when the
visibilityStatus
props changes, without requiring a reload.The text was updated successfully, but these errors were encountered: