ReactNativeLocalization icon indicating copy to clipboard operation
ReactNativeLocalization copied to clipboard

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

Open omarabualhija opened this issue 2 years ago • 1 comments

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",

omarabualhija avatar Apr 15 '23 14:04 omarabualhija

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

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

shintiazhou avatar Jan 23 '24 04:01 shintiazhou