stefalda / ReactNativeLocalization

Class to localize the ReactNative interface
MIT License
898 stars 123 forks source link

language.setLanguage() function is not updating the language with out rerender the component ? #221

Open omarabualhija opened 1 year ago

omarabualhija commented 1 year ago

i'm trying to update my language using Language.setLanguage("ar") but the language is not change

What I'm trying to do :

//return 1 for English Lang or 2 for Arabic Lang ` let selectedLang =await AsyncStoregApp.getDate(CONSTANT.AsyncStorageKey.Lang,); if (selectedLang === 2) { LANGUAGES.setLanguage('ar'); I18nManager.allowRTL(true); I18nManager.forceRTL(true); } else { LANGUAGES.setLanguage('en'); I18nManager.allowRTL(false); I18nManager.forceRTL(false); }

packege.json

"dependencies": { "@react-native-async-storage/async-storage": "^1.17.12", "react": "18.2.0", "react-native": "0.71.4",

shintiazhou commented 5 months ago

Please check out this solution, you need to add dummy setState @omarabualhija

e.g : setDummyState({}) Check this out