When you go to a react component, then go to another, and finally come back, the react component is showing blank, or half-blank.
If you inspect the page with the mobile safari inspector , you can see the elements are there, but safari just refuse to show the data on the screen.
In my case, this seems to be related with data reloading when I come back to the component. It reloads the data in its componentDidAmount() then re-render. Safari may not perform well enough to handle this kind of re-rendering.
A workaround is to not reload the data when you come back to the component. You can do this by checking if the data exists, and only loads the data if not existing.
It comes with a price: when you come back to the component, you are not seeing the data that’s up-to-data. There are a few things you can do to make it up:
- A delayed data re-loading
- Always reload the data 24 hours (e.g.) after last data loading
- Very important: destroy the data if a user logs out to make sure a different user won’t see the first user’s data