Reputation: 743
My native app support multi-language functionality like 'English' and 'Danish'. For this I have created a drop down on top of the header with two menu options, for example if click on Danish language,it will set the 'Danish' language, but the effect is not displayed, for this I have to click on current menu, then the effect of the language is seen. So my questions is how to reload current page in react native programmatically.
Thanks in advance.
Upvotes: 0
Views: 6931
Reputation: 443
You don't need reload current page if you only need to change language, You can achive that with this library https://github.com/derniercri/react-native-redux-i18n
Upvotes: 0
Reputation: 2295
Try storing your locale in Redux and then update the UI from that state using container components.
Upvotes: 2
Reputation: 83527
The correct way to cause a render of a page is by calling this.setState()
. This will trigger the React lifecycle.
Upvotes: 0
Reputation: 462
I don't think your problem is reloading. You must change the state on click, but believe me do not write custom localization. Here is the great plugin to do it https://github.com/stefalda/ReactNativeLocalization
Upvotes: 0