I want to force my app to reload after changing layout to RTL this is my code :
if (!I18nManager.isRTL) {
I18nManager.forceRTL(true);
await Updates.reloadAsync();
}
Im using async keyword in front of my function name , but my app doesn’t reload automatically , I need to close the app manually to RTL take effect , any way to force app to reload , thanks
It looks like you’re using the method from the new Updates module rather than the one bundled with SDK36 which is Updates.reload(). Also, it might be worth using Updates.reloadFromCache() if you’re looking for a quicker reload experience and aren’t concerned with fetching new JS bundle updates.
thanks adam for your response , that’s true with SDK36 I need to use Updates.reload() , but it stay didn’t reload from the first lunch even I use reloadFromCache , I dont know how to handle reload in app.js , do I need to reload after checking if I18nManager.isRTL ==false and on else rendering my app or I need to handle reload with an other way , my idea is to reload app after forcing app to RTL , any help plz Im stuck
OK, so the problem seems to be that when you call I18nManager.forceRTL(true) it does not necessarily update it immediately. When I tried calling Updates.reloadFromCache() immediately after I18nManager.forceRTL(true) in useEffect() it did not work, but if I wait a bit before trying to reload it works.
@adamjnav, I suspect this is not the correct way to do this. How should one ensure that the I18nManager.forceRTL(true) call has taken effect before reloading?